feat: full package — typed rooms (public/private/presence/open-presence) + call recording
Rooms
- Rooms\RoomType derived from the name prefix (like laravel-websockets channels):
public, private-* (authorized), presence-* (authorized + member list),
open-presence-* (public + member list). Room/RoomManager carry per-member info.
- Contracts\RoomAuthorizer + secure DefaultRoomAuthorizer (denies private/presence
until the host binds one). Presence rooms broadcast the member list + info.
Recording (store the FULL call audio, in PHP, today)
- Pure-P2P audio is DTLS-SRTP end-to-end, so the server can't capture it. Instead
the browser MediaRecords its mic and streams chunks over the WS as BINARY frames
(needs the new laravel-ws onBinary); RelaySignalingHandler appends them per
participant via a RecordingStore. Recording\FileRecordingStore -> <room>/<peer>.webm.
welcome/joined carry a record flag telling the client to stream.
- Contracts\CallEventListener call-log seam (peer/room/recording lifecycle) so calls
are auditable even when unrecorded.
Wiring
- RelaySignalingHandler(authorizer, recorder, events); webrtc:serve + provider +
config/webrtc.php (recording enabled/path/format, authorizer, events).
Tests 35/99 incl on-disk FileRecordingStore, presence member lists, auth gating,
binary recording+finalize+events, RoomType, and the real WS round-trip. README
documents room types + the browser MediaRecorder->WS recording flow.
rel learn-atc #1060 #1055 #1057 #1051
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 07:01:12 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Blax\WebRtc\Tests\Fixtures;
|
|
|
|
|
|
|
|
|
|
use Blax\WebRtc\Contracts\RecordingStore;
|
|
|
|
|
|
|
|
|
|
final class MemoryRecordingStore implements RecordingStore
|
|
|
|
|
{
|
|
|
|
|
/** @var array<string,string> "room|peer" => concatenated bytes */
|
|
|
|
|
public array $data = [];
|
|
|
|
|
|
|
|
|
|
/** @var array<int,string> finalized keys */
|
|
|
|
|
public array $finalized = [];
|
|
|
|
|
|
|
|
|
|
public function append(string $roomId, string $peerId, string $chunk): void
|
|
|
|
|
{
|
|
|
|
|
$key = "{$roomId}|{$peerId}";
|
|
|
|
|
$this->data[$key] = ($this->data[$key] ?? '').$chunk;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function finalize(string $roomId, string $peerId): ?string
|
|
|
|
|
{
|
|
|
|
|
$key = "{$roomId}|{$peerId}";
|
|
|
|
|
if (! isset($this->data[$key])) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
$this->finalized[] = $key;
|
|
|
|
|
|
|
|
|
|
return "mem://{$key}";
|
|
|
|
|
}
|
2026-07-08 09:22:53 +00:00
|
|
|
|
|
|
|
|
public function discard(string $roomId, string $peerId): void
|
|
|
|
|
{
|
|
|
|
|
unset($this->data["{$roomId}|{$peerId}"]);
|
|
|
|
|
}
|
feat: full package — typed rooms (public/private/presence/open-presence) + call recording
Rooms
- Rooms\RoomType derived from the name prefix (like laravel-websockets channels):
public, private-* (authorized), presence-* (authorized + member list),
open-presence-* (public + member list). Room/RoomManager carry per-member info.
- Contracts\RoomAuthorizer + secure DefaultRoomAuthorizer (denies private/presence
until the host binds one). Presence rooms broadcast the member list + info.
Recording (store the FULL call audio, in PHP, today)
- Pure-P2P audio is DTLS-SRTP end-to-end, so the server can't capture it. Instead
the browser MediaRecords its mic and streams chunks over the WS as BINARY frames
(needs the new laravel-ws onBinary); RelaySignalingHandler appends them per
participant via a RecordingStore. Recording\FileRecordingStore -> <room>/<peer>.webm.
welcome/joined carry a record flag telling the client to stream.
- Contracts\CallEventListener call-log seam (peer/room/recording lifecycle) so calls
are auditable even when unrecorded.
Wiring
- RelaySignalingHandler(authorizer, recorder, events); webrtc:serve + provider +
config/webrtc.php (recording enabled/path/format, authorizer, events).
Tests 35/99 incl on-disk FileRecordingStore, presence member lists, auth gating,
binary recording+finalize+events, RoomType, and the real WS round-trip. README
documents room types + the browser MediaRecorder->WS recording flow.
rel learn-atc #1060 #1055 #1057 #1051
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 07:01:12 +00:00
|
|
|
}
|