From 2fbef21abcff232b438aba7b28ca65750768517a Mon Sep 17 00:00:00 2001 From: amar-1995 <110378139+amar-1995@users.noreply.github.com> Date: Fri, 29 Sep 2023 10:57:37 +0530 Subject: [PATCH] feat: integrate on-hls-init --- .../src/notification-manager/HMSNotificationMethod.ts | 1 + .../notification-manager/managers/RoomUpdateManager.ts | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/hms-video-web/src/notification-manager/HMSNotificationMethod.ts b/packages/hms-video-web/src/notification-manager/HMSNotificationMethod.ts index 5a5dad15d5..6ffeae050a 100644 --- a/packages/hms-video-web/src/notification-manager/HMSNotificationMethod.ts +++ b/packages/hms-video-web/src/notification-manager/HMSNotificationMethod.ts @@ -29,6 +29,7 @@ export enum HMSNotificationMethod { RTMP_STOP = 'on-rtmp-stop', RECORDING_START = 'on-record-start', RECORDING_STOP = 'on-record-stop', + HLS_INIT = 'on-hls-init', HLS_START = 'on-hls-start', HLS_STOP = 'on-hls-stop', METADATA_CHANGE = 'on-metadata-change', diff --git a/packages/hms-video-web/src/notification-manager/managers/RoomUpdateManager.ts b/packages/hms-video-web/src/notification-manager/managers/RoomUpdateManager.ts index 7db53caac6..4356a0d438 100644 --- a/packages/hms-video-web/src/notification-manager/managers/RoomUpdateManager.ts +++ b/packages/hms-video-web/src/notification-manager/managers/RoomUpdateManager.ts @@ -125,7 +125,11 @@ export class RoomUpdateManager { } private onHLS(method: string, notification: HLSNotification) { - if (![HMSNotificationMethod.HLS_START, HMSNotificationMethod.HLS_STOP].includes(method as HMSNotificationMethod)) { + if ( + ![HMSNotificationMethod.HLS_INIT, HMSNotificationMethod.HLS_START, HMSNotificationMethod.HLS_STOP].includes( + method as HMSNotificationMethod, + ) + ) { return; } const room = this.store.getRoom(); @@ -134,7 +138,9 @@ export class RoomUpdateManager { return; } - notification.enabled = method === HMSNotificationMethod.HLS_START && !notification.error?.code; + notification.enabled = + [HMSNotificationMethod.HLS_INIT, HMSNotificationMethod.HLS_START].includes(method as HMSNotificationMethod) && + !notification.error?.code; room.hls = this.convertHls(notification); room.recording.hls = this.getHLSRecording(notification); this.listener?.onRoomUpdate(HMSRoomUpdate.HLS_STREAMING_STATE_UPDATED, room);