frontend: add onRoomCreated event handler to manage room preferences updates
This commit is contained in:
parent
7361b71a7a
commit
4ebc5a2e16
@ -133,6 +133,7 @@
|
||||
(onParticipantLeft)="onParticipantLeft($event)"
|
||||
(onRecordingStartRequested)="onRecordingStartRequested($event)"
|
||||
(onRecordingStopRequested)="onRecordingStopRequested($event)"
|
||||
(onRoomCreated)="onRoomCreated($event)"
|
||||
>
|
||||
@if (features().canModerateRoom) {
|
||||
<div *ovToolbarAdditionalButtons>
|
||||
|
||||
@ -23,16 +23,27 @@ import {
|
||||
SessionStorageService,
|
||||
WebComponentManagerService
|
||||
} from '@lib/services';
|
||||
import { ParticipantRole, WebComponentEvent, WebComponentOutboundEventMessage } from '@lib/typings/ce';
|
||||
import {
|
||||
MeetRoomPreferences,
|
||||
ParticipantRole,
|
||||
WebComponentEvent,
|
||||
WebComponentOutboundEventMessage
|
||||
} from '@lib/typings/ce';
|
||||
import { MeetSignalType } from '@lib/typings/ce/event.model';
|
||||
|
||||
import {
|
||||
ApiDirectiveModule,
|
||||
DataPacket_Kind,
|
||||
OpenViduComponentsUiModule,
|
||||
OpenViduService,
|
||||
ParticipantLeftEvent,
|
||||
ParticipantLeftReason,
|
||||
ParticipantModel,
|
||||
RecordingStartRequestedEvent,
|
||||
RecordingStopRequestedEvent
|
||||
RecordingStopRequestedEvent,
|
||||
RemoteParticipant,
|
||||
Room,
|
||||
RoomEvent
|
||||
} from 'openvidu-components-angular';
|
||||
|
||||
@Component({
|
||||
@ -100,6 +111,19 @@ export class VideoRoomComponent implements OnInit, OnDestroy {
|
||||
this.wcManagerService.stopCommandsListener();
|
||||
}
|
||||
|
||||
onRoomCreated(room: Room) {
|
||||
room.on(
|
||||
RoomEvent.DataReceived,
|
||||
(payload: Uint8Array, participant?: RemoteParticipant, _?: DataPacket_Kind, topic?: string) => {
|
||||
const event = JSON.parse(new TextDecoder().decode(payload));
|
||||
if (topic === MeetSignalType.MEET_ROOM_PREFERENCES_UPDATED) {
|
||||
const roomPreferences: MeetRoomPreferences = event.preferences;
|
||||
this.featureConfService.setRoomPreferences(roomPreferences);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
get isAdmin(): boolean {
|
||||
return this.authService.isAdmin();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user