mirror of
git://f0xx.org/ac/ac-ms-sfu-signaling
synced 2026-08-12 18:12:44 +03:00
SFU M0: browser lab E2E client for Janus VideoRoom.
Add lab page with screen-share publisher and subscriber viewer, join API feed support, shared session auth, static assets route, and lab docs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -21,9 +21,11 @@ $janusRoomId = (int) ($input['room_id'] ?? 0);
|
||||
$jsep = $input['jsep'] ?? null;
|
||||
$role = in_array($input['role'] ?? '', ['publisher', 'subscriber'], true)
|
||||
? $input['role'] : 'publisher';
|
||||
$feedId = (int) ($input['feed_id'] ?? 0);
|
||||
|
||||
if (!$janusRoomId) { sfuJsonErr('room_id required'); }
|
||||
if (!$jsep || empty($jsep['sdp'])) { sfuJsonErr('jsep.sdp required'); }
|
||||
if ($role === 'subscriber' && $feedId <= 0) { sfuJsonErr('feed_id required for subscriber'); }
|
||||
|
||||
$repo = new \AndroidCast\Sfu\SfuRoomRepository(sfuPdo());
|
||||
$janus = janusClient();
|
||||
@@ -44,6 +46,9 @@ $joinBody = [
|
||||
'ptype' => $role === 'publisher' ? 'publisher' : 'subscriber',
|
||||
'display' => $user['email'] ?? 'anon',
|
||||
];
|
||||
if ($role === 'subscriber') {
|
||||
$joinBody['streams'] = [['feed' => $feedId]];
|
||||
}
|
||||
$resp = $janus->sendJsep($sid, $hid, $joinBody, [
|
||||
'type' => $jsep['type'],
|
||||
'sdp' => $jsep['sdp'],
|
||||
@@ -59,10 +64,13 @@ $participantId = $repo->joinRoom(
|
||||
|
||||
/* Return negotiated JSEP answer + WS connection details */
|
||||
$answer = $resp['jsep'] ?? null;
|
||||
$plugin = $resp['plugindata']['data'] ?? [];
|
||||
$publisherId = isset($plugin['id']) ? (int) $plugin['id'] : null;
|
||||
sfuJsonOk([
|
||||
'session_id' => $sid,
|
||||
'handle_id' => $hid,
|
||||
'participant_id' => $participantId,
|
||||
'publisher_id' => $publisherId,
|
||||
'jsep' => $answer,
|
||||
'ws_url' => '/app/androidcast_project/sfu/ws',
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user