PHPackages                             theunwindfront/nativephp-audio - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. theunwindfront/nativephp-audio

ActiveNativephp-plugin[Utility &amp; Helpers](/categories/utility)

theunwindfront/nativephp-audio
==============================

Audio player plugin for NativePHP Mobile apps

1.2.2(4w ago)8284MITKotlinPHP ^8.2

Since Mar 13Pushed 4w agoCompare

[ Source](https://github.com/theunwindfront/nativephp-audio)[ Packagist](https://packagist.org/packages/theunwindfront/nativephp-audio)[ RSS](/packages/theunwindfront-nativephp-audio/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (8)Dependencies (2)Versions (10)Used By (0)

NativePHP Audio Player Plugin
=============================

[](#nativephp-audio-player-plugin)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9de71d9ebe65994efc29a494964e7e83284a633e3f2a5be54ecde8fb6a26d88d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746865756e77696e6466726f6e742f6e61746976657068702d617564696f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/theunwindfront/nativephp-audio)[![Total Downloads](https://camo.githubusercontent.com/0378abb5a07c981d8e2b082f998a3154370b2983e0e514228c1487116e5ae426/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746865756e77696e6466726f6e742f6e61746976657068702d617564696f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/theunwindfront/nativephp-audio)[![License](https://camo.githubusercontent.com/38f40d1b009907bd64f20d45ec9703503d0f99825a0e2ba8f2963555a0c9ebde/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746865756e77696e6466726f6e742f6e61746976657068702d617564696f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/theunwindfront/nativephp-audio)

A premium NativePHP plugin for professional audio playback on mobile devices (Android &amp; iOS). This plugin provides deep integration with native OS features like MediaSession, background services, and remote controls.

✨ Features
----------

[](#-features)

- **🏆 Native Media Integration** - Full support for OS Lock Screen controls, Bluetooth devices, and Android Auto/CarPlay.
- **📱 Background Excellence** - Reliable background playback using Foreground Services (Android) and specialized Audio Sessions (iOS).
- **🎶 Advanced Playlist Management** - Natively managed queues with Shuffle and Repeat modes.
- **🎧 Audio Focus Intelligence** - Gracefully handles interruptions (phone calls, notifications, Siri) with auto-ducking and resuming.
- **🕒 Sleep Timers** - Programmatic sleep timers that safely release native resources.
- **📊 Detailed Analytics Events** - Granular event reporting for playback progress, track changes, buffering, and remote commands.
- **🖼 Rich Metadata** - Support for high-quality artwork, titles, artists, and arbitrary custom metadata.

🚀 Installation
--------------

[](#-installation)

```
# Install via Composer
composer require theunwindfront/nativephp-audio

# Publish the plugins provider (if not already done)
php artisan vendor:publish --tag=nativephp-plugins-provider

# Register the plugin with NativePHP
php artisan native:plugin:register theunwindfront/nativephp-audio
```

📖 Usage
-------

[](#-usage)

### PHP Interface (Livewire / Controller)

[](#php-interface-livewire--controller)

```
use Theunwindfront\Audio\Facades\Audio;

// 1. Play a single track with metadata
Audio::play('https://example.com/song.mp3', [
    'title'    => 'Midnight City',
    'artist'   => 'M83',
    'artwork'  => 'https://example.com/artwork.jpg',
]);

// 2. Play a Local File (Mobile Storage)
// Raw paths from storage_path() are natively supported
Audio::play(storage_path('app/public/recordings/audio.mp3'), [
    'title'  => 'Voice Note',
    'artist' => 'Recorded Local'
]);

// 3. Manage a Playlist (Natively handled auto-advance)
Audio::setPlaylist([
    [
        'url'   => 'https://example.com/track1.mp3',
        'title' => 'Track 01',
    ],
    // ... more tracks
], autoPlay: true, startIndex: 0);

// 4. Playback Controls
Audio::pause();
Audio::resume();
Audio::next();
Audio::previous();
Audio::skipTo(5); // Skip to index 5 in playlist

// 5. State & Settings
$state = Audio::getState();
Audio::setVolume(0.8);
Audio::setPlaybackRate(1.5);
Audio::setShuffleMode(true);
Audio::setRepeatMode('all'); // 'none', 'one', 'all'

// 6. Sleep Timer
Audio::setSleepTimer(1800); // 30 minutes
```

### ⚡ JavaScript Bridge

[](#-javascript-bridge)

If you are building a SPA (Inertia/Vue/React) or using Alpine.js, you can use the JavaScript bridge directly.

First, include the bridge in your layout:

```
@include('audio::bridge')
```

Then, use the `audio` helper:

```
import audio from './resources/js/audio.js';

// Play immediately
await audio.play('https://server.com/live.mp3', { title: 'Live Stream' });

// Listen for native events on the window
window.addEventListener('audio:playback-progress-updated', (event) => {
    const { position, duration } = event.detail;
    console.log(`Playing: ${position} / ${duration}`);
});
```

### 📡 Event Synchronization

[](#-event-synchronization)

This plugin dispatches powerful Laravel events that you can listen to in your application:

EventDescription`PlaybackStarted`Fired when audio actually begins playing.`PlaybackProgressUpdated`Heartbeat event with `position` and `duration`.`PlaylistTrackChanged`Fired on auto-advance or manual track skip.`AudioFocusLost`Fired when another app takes over audio (e.g. phone call).`RemotePlayReceived`Fired when the user hits 'Play' on headphones/lockscreen.`SleepTimerExpired`Fired when the scheduled sleep timer hits zero.🛠 Advanced Features
-------------------

[](#-advanced-features)

### Background Sync

[](#background-sync)

When your app returns from the background, you can "drain" any missed events that occurred while the PHP process was suspended:

```
$missedEvents = Audio::drainEvents();
```

### Absolute Local Paths

[](#absolute-local-paths)

Unlike standard web players, this plugin has direct filesystem access. On Android, it even requests `READ_MEDIA_AUDIO` permissions automatically.

```
Audio::play('/storage/emulated/0/Download/my-song.mp3');
```

📋 API Reference
---------------

[](#-api-reference)

MethodParametersDescription`play``string $url, array $options`Play/Restart audio`load``string $url, array $options`Prepare audio without playing`setPlaylist``array $tracks, bool $autoPlay, int $idx`Set native queue`next / previous`-Navigate playlist`skipTo``int $index`Jump to specific track`setVolume``float $level` (0.0 - 1.0)Set player volume`setPlaybackRate``float $rate` (0.25 - 4.0)Set playback speed`setSleepTimer``int $seconds`Schedule a shutdown`cancelSleepTimer`-Stop the active timer`getState`-Get full status object`getPlaylist`-Get full playlist state`drainEvents`-Get background events📱 Version Support
-----------------

[](#-version-support)

- **Android**: 5.0 (API 21) or higher.
- **iOS**: 13.0 or higher.

👥 Credits
---------

[](#-credits)

- **[Sagar Pansuriya](https://github.com/theunwindfront)** - Lead Developer
- [All Contributors](../../contributors)

🤝 Support
---------

[](#-support)

For questions or issues, contact **** or open a [GitHub Issue](https://github.com/theunwindfront/nativephp-audio/issues).

📄 License
---------

[](#-license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance94

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~8 days

Total

8

Last Release

29d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/57458034?v=4)[Sagar Pansuriya](/maintainers/theunwindfront)[@theunwindfront](https://github.com/theunwindfront)

---

Top Contributors

[![theunwindfront](https://avatars.githubusercontent.com/u/57458034?v=4)](https://github.com/theunwindfront "theunwindfront (29 commits)")

### Embed Badge

![Health badge](/badges/theunwindfront-nativephp-audio/health.svg)

```
[![Health](https://phpackages.com/badges/theunwindfront-nativephp-audio/health.svg)](https://phpackages.com/packages/theunwindfront-nativephp-audio)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M11](/packages/renatomarinho-laravel-page-speed)[illuminate/pipeline

The Illuminate Pipeline package.

9348.3M264](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10533.5M984](/packages/illuminate-pagination)[illuminate/redis

The Illuminate Redis package.

8314.4M356](/packages/illuminate-redis)[illuminate/cookie

The Illuminate Cookie package.

244.5M131](/packages/illuminate-cookie)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
