PARQORE Video Rooms Plugin for NativePHP Mobile#
Face-to-face video calls in your app, in one line.#
Add video and voice rooms to your NativePHP app: telehealth visits, tutoring, support calls, team huddles. Call VideoRooms::join() and your users get a native full-screen call screen with the other people's video, their own camera in the corner, and buttons for mute, camera on/off, flip camera and hang up. Under the hood it's LiveKit, the open-source WebRTC platform (use LiveKit Cloud or host your own server). Your Laravel server makes the room token with one helper method, so the API secret never ships in the app.
✅ Device tested (2026-10-11, local LiveKit server) on an iPad Air (M3) and a Galaxy A54 calling each other: join, see and hear each other, Mute, Camera off/on (the other side shows a dark "Camera off" tile), Flip, Hang up, upright video whichever way either device is held, and all events.
Works alongside PARqore Native Calls (ring with the system call screen, then join() when the user answers). That combination isn't device-tested yet; on iOS, test audio after answering from the lock screen before relying on it.
Installation#
composer require partek/video-roomsphp artisan native:plugin:register partek/video-rooms
Rebuild the native projects afterwards (php artisan native:run android or ios).
- iOS: adds the LiveKit Swift package (2.17.0), the camera and microphone usage strings, and the
audiobackground mode (so a call keeps going when the user leaves the app). iOS 18+. - Android: adds
io.livekit:livekit-android2.29.0 (and the JitPack repository it needs), the camera, microphone, Bluetooth and network permissions, and the call-screen Activity. The camera is marked optional, so the app still installs on devices without one. Android 8+. The call screen asks for permissions itself; if the user says no to the camera or microphone, they join without it (and can turn it on later, which asks again). - A LiveKit server: LiveKit Cloud (free tier) or your own. You need its URL, API key and API secret.
Usage#
1. Server: make a token#
Make tokens on your own web server, never inside the NativePHP app. The app runs your Laravel code on the phone, so anything in its .env or config ships inside the app, including a LiveKit API secret. AccessToken::make() refuses to run inside a device build.
use PARTek\VideoRooms\AccessToken; Route::post('/rooms/{room}/token', function (Request $request, string $room) { return ['token' => AccessToken::make( config('services.livekit.key'), config('services.livekit.secret'), identity: (string) $request->user()->id, room: $room, name: $request->user()->name, )];});
Options: ttl (seconds the token can be used to join, default 600), grants (publish, subscribe, publishData), metadata. For a listen-only viewer, give them grants: ['publish' => false] and join with ['audio' => false, 'video' => false] (if publishing is refused anyway, the plugin turns the camera and mic back off and reports them off).
2. App: join#
use Native\Mobile\Attributes\On;use PARTek\VideoRooms\Events\ParticipantJoined;use PARTek\VideoRooms\Events\RoomConnected;use PARTek\VideoRooms\Events\RoomDisconnected;use PARTek\VideoRooms\Facades\VideoRooms; public function startVisit(): void{ $token = Http::withToken($this->apiToken)->post("https://api.example.com/rooms/visit-{$this->visitId}/token")->json('token'); VideoRooms::join('wss://my-app.livekit.cloud', $token, ['title' => 'Dr. Ana', 'video' => true]);} #[On(RoomConnected::class)]public function inRoom(string $room, int $participants): void { /* the call screen is up */ } #[On(ParticipantJoined::class)]public function joined(string $identity, string $name = ''): void { /* ... */ } #[On(RoomDisconnected::class)]public function ended(string $reason, string $message = ''): void{ // left: hang-up button or leave(); failed: couldn't connect (url/token/network); // removed: the server removed you or closed the room; lost: the connection dropped for good}
In Livewire, listen with #[On('native:PARTek\\VideoRooms\\Events\\RoomConnected')].
JavaScript#
Alias vendor/partek/video-rooms/resources/js/index.js in vite.config.js (for example as partek-video-rooms), then:
import { join, leave } from 'partek-video-rooms'; await join('wss://my-app.livekit.cloud', token, { title: 'Standup' });
Methods#
| Method | Returns | Notes |
|---|---|---|
join(string $url, string $token, array $options = []) |
bool | Shows the call screen and connects. Options: video (default true; false = voice only), audio (default true), title, frontCamera (default true). url must be wss:// (plain ws:// is accepted only for localhost, private IPs and *.local test servers). Throws VideoRoomsException ALREADY_IN_ROOM, or NO_PRESENTER on iOS when there's no screen yet |
leave() |
bool | Hangs up and closes the call screen (RoomDisconnected, reason left). You can join() again straight away |
setMicrophone(bool $on) / setCamera(bool $on) |
bool | Same as the call screen's buttons; both send LocalMediaChanged |
state() |
array | state (disconnected, connecting, connected, reconnecting), room, participants (identity, name), microphone, camera |
Events#
| Event | Properties |
|---|---|
RoomConnected |
room, participants (others already there), platform |
RoomDisconnected |
reason (left, failed, removed, lost), message, platform |
ParticipantJoined / ParticipantLeft |
identity, name, platform. A network drop doesn't send ParticipantLeft for people who are still there after reconnecting |
LocalMediaChanged |
microphone, camera, platform |
Platform notes#
- One room at a time. The call screen shows one remote video full screen (the most recent camera to arrive; if that person leaves, it switches to another camera) and your own camera in the corner. Everyone's audio plays. Screen shares aren't shown.
- Video adapts to the network (LiveKit's adaptive stream and dynacast are on).
- iOS keeps the call going in the background (the
audiobackground mode). On Android, if the user leaves the call screen (Home), the call stays connected but Android stops the camera and microphone for apps in the background, so the others see a still picture and hear silence until the user comes back. If Android closes the call screen itself, the call ends withRoomDisconnectedreasonlost. - The status line shows "Reconnecting…" while the network recovers.
- Works in portrait-only apps: the call screen turns with the device, and your video is sent upright however the phone or tablet is held (read from the motion sensor, not the screen).
- When the other person turns their camera off, their tile goes dark with "Camera off" instead of freezing on the last frame.
Testing#
Native::fakeBridge()->withVideoRooms(); Native::test(ClassScreen::class) ->tap('Join class') ->assertRoomJoined('wss://my-app.livekit.cloud', video: false) ->roomConnects('class-7b', participants: 3) ->participantJoins('teacher', 'Ms. Ana') ->roomDisconnects('removed') ->assertSee('Class ended');
| Helper | Called on | What it does |
|---|---|---|
withVideoRooms(array $state = []) |
bridge | Every call succeeds; scripts state() |
assertRoomJoined(?string $url = null, ?bool $video = null) / assertRoomLeft() |
bridge | |
roomConnects(string $room = 'test-room', int $participants = 0) |
screen | Delivers RoomConnected |
roomDisconnects(string $reason = 'left', string $message = '') |
screen | Delivers RoomDisconnected |
participantJoins(string $identity, string $name = '') / participantLeaves(...) |
screen | |
localMediaChanges(bool $microphone, bool $camera) |
screen |
This package's own suite:
composer installvendor/bin/phpunit
License#
Proprietary commercial software. See LICENSE. LiveKit's SDKs are Apache 2.0.