@100mslive/hms-video-store 0.2.82 → 0.2.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/common/ui-logger.d.ts +13 -13
  2. package/dist/core/IHMSActions.d.ts +266 -264
  3. package/dist/core/IHMSNotifications.d.ts +14 -15
  4. package/dist/core/IHMSStore.d.ts +54 -56
  5. package/dist/core/hmsSDKStore/HMSNotifications.d.ts +25 -25
  6. package/dist/core/hmsSDKStore/HMSPlaylist.d.ts +21 -21
  7. package/dist/core/hmsSDKStore/HMSReactiveStore.d.ts +79 -79
  8. package/dist/core/hmsSDKStore/HMSSDKActions.d.ts +157 -157
  9. package/dist/core/hmsSDKStore/adapter.d.ts +49 -49
  10. package/dist/core/hmsSDKStore/common/mapping.d.ts +7 -7
  11. package/dist/core/hmsSDKStore/internalTypes.d.ts +4 -4
  12. package/dist/core/hmsSDKStore/sdkTypes.d.ts +3 -2
  13. package/dist/core/hmsSDKStore/sdkUtils/ActionBatcher.d.ts +19 -19
  14. package/dist/core/hmsSDKStore/sdkUtils/sdkUtils.d.ts +2 -2
  15. package/dist/core/hmsSDKStore/sdkUtils/storeMergeUtils.d.ts +14 -14
  16. package/dist/core/index.d.ts +9 -7
  17. package/dist/core/schema/device-change.d.ts +13 -13
  18. package/dist/core/schema/error.d.ts +13 -13
  19. package/dist/core/schema/index.d.ts +11 -11
  20. package/dist/core/schema/message.d.ts +31 -31
  21. package/dist/core/schema/notification.d.ts +40 -40
  22. package/dist/core/schema/peer.d.ts +67 -67
  23. package/dist/core/schema/playlist.d.ts +127 -109
  24. package/dist/core/schema/requests.d.ts +31 -31
  25. package/dist/core/schema/role.d.ts +3 -3
  26. package/dist/core/schema/room.d.ts +23 -23
  27. package/dist/core/schema/schema.d.ts +29 -29
  28. package/dist/core/schema/settings.d.ts +5 -5
  29. package/dist/core/selectors/derivedSelectors.d.ts +29 -29
  30. package/dist/core/selectors/index.d.ts +5 -5
  31. package/dist/core/selectors/playlistselectors.d.ts +3 -3
  32. package/dist/core/selectors/selectorUtils.d.ts +18 -18
  33. package/dist/core/selectors/selectors.d.ts +185 -191
  34. package/dist/core/selectors/selectorsByID.d.ts +127 -128
  35. package/dist/core/selectors/selectorsByReference.d.ts +3 -3
  36. package/dist/hms-video-store.cjs.js +1 -0
  37. package/dist/hms-video-store.esm.js +1 -5376
  38. package/dist/index.d.ts +1 -1
  39. package/package.json +21 -84
  40. package/dist/hms-video-store.cjs.development.js +0 -5468
  41. package/dist/hms-video-store.cjs.development.js.map +0 -1
  42. package/dist/hms-video-store.cjs.production.min.js +0 -2
  43. package/dist/hms-video-store.cjs.production.min.js.map +0 -1
  44. package/dist/hms-video-store.esm.js.map +0 -1
  45. package/dist/index.js +0 -8
  46. package/dist/test/fakeStore.d.ts +0 -23
  47. package/dist/test/fixtures.d.ts +0 -3
  48. package/src/common/ui-logger.ts +0 -88
  49. package/src/core/IHMSActions.ts +0 -318
  50. package/src/core/IHMSNotifications.ts +0 -16
  51. package/src/core/IHMSStore.ts +0 -60
  52. package/src/core/hmsSDKStore/HMSNotifications.ts +0 -194
  53. package/src/core/hmsSDKStore/HMSPlaylist.ts +0 -78
  54. package/src/core/hmsSDKStore/HMSReactiveStore.ts +0 -271
  55. package/src/core/hmsSDKStore/HMSSDKActions.ts +0 -1156
  56. package/src/core/hmsSDKStore/adapter.ts +0 -244
  57. package/src/core/hmsSDKStore/common/mapping.ts +0 -32
  58. package/src/core/hmsSDKStore/internalTypes.ts +0 -8
  59. package/src/core/hmsSDKStore/sdkTypes.ts +0 -55
  60. package/src/core/hmsSDKStore/sdkUtils/ActionBatcher.ts +0 -63
  61. package/src/core/hmsSDKStore/sdkUtils/sdkUtils.ts +0 -5
  62. package/src/core/hmsSDKStore/sdkUtils/storeMergeUtils.ts +0 -98
  63. package/src/core/index.ts +0 -18
  64. package/src/core/schema/device-change.ts +0 -14
  65. package/src/core/schema/error.ts +0 -13
  66. package/src/core/schema/index.ts +0 -11
  67. package/src/core/schema/message.ts +0 -35
  68. package/src/core/schema/notification.ts +0 -41
  69. package/src/core/schema/peer.ts +0 -78
  70. package/src/core/schema/playlist.ts +0 -114
  71. package/src/core/schema/requests.ts +0 -36
  72. package/src/core/schema/role.ts +0 -5
  73. package/src/core/schema/room.ts +0 -26
  74. package/src/core/schema/schema.ts +0 -94
  75. package/src/core/schema/settings.ts +0 -5
  76. package/src/core/selectors/derivedSelectors.ts +0 -81
  77. package/src/core/selectors/index.ts +0 -5
  78. package/src/core/selectors/playlistselectors.ts +0 -67
  79. package/src/core/selectors/selectorUtils.ts +0 -63
  80. package/src/core/selectors/selectors.ts +0 -400
  81. package/src/core/selectors/selectorsByID.ts +0 -401
  82. package/src/core/selectors/selectorsByReference.ts +0 -45
  83. package/src/index.ts +0 -1
  84. package/src/test/fakeStore.ts +0 -272
  85. package/src/test/fixtures.ts +0 -22
  86. package/src/test/integration/.gitkeep +0 -0
  87. package/src/test/unit/HMSNotifications.test.ts +0 -123
  88. package/src/test/unit/reactiveStore.test.ts +0 -129
  89. package/src/test/unit/roleSelectors.test.ts +0 -85
  90. package/src/test/unit/selectors.test.ts +0 -316
  91. package/src/test/unit/selectorsByReference.test.ts +0 -27
  92. package/src/test/unit/storeMergeUtils.test.ts +0 -168
@@ -1,157 +1,157 @@
1
- import { HMSMessage, HMSTrackID, HMSTrackSource, HMSChangeMultiTrackStateParams, IHMSPlaylistActions } from '../schema';
2
- import { IHMSActions } from '../IHMSActions';
3
- import * as sdkTypes from './sdkTypes';
4
- import { HMSRoleChangeRequest } from '../selectors';
5
- import { HMSAudioPlugin, HMSException as SDKHMSException, HMSLogLevel, HMSChangeTrackStateRequest as SDKHMSChangeTrackStateRequest, HMSChangeMultiTrackStateRequest as SDKHMSChangeMultiTrackStateRequest, HMSSdk, HMSSimulcastLayer, HMSTrack as SDKHMSTrack, HMSVideoPlugin } from '@100mslive/hms-video';
6
- import { IHMSStore } from '../IHMSStore';
7
- import { HMSNotifications } from './HMSNotifications';
8
- /**
9
- * This class implements the IHMSActions interface for 100ms SDK. It connects with SDK
10
- * and takes control of data management by letting every action pass through it. The
11
- * passed in store is ensured to be the single source of truth reflecting current
12
- * room related data at any point in time.
13
- *
14
- * @privateRemarks
15
- * Things to keep in mind while updating store -
16
- * 1. Treat setState as an atomic operation, if an action results in multiple changes,
17
- * the changes should all happen within single setState function.
18
- * 2. While updating the state it's very important to not update the reference if
19
- * something is unchanged. Copy data in same reference object don't assign new
20
- * object.
21
- * 3. Mental Model(1) - Actions from backend -> Listeners of this class -> update store -> views update themselves
22
- * eg. for this - peer added, remote muted etc.
23
- * 4. Mental Model(2) - Actions from local -> View calls actions -> update store -> views update themselves
24
- * eg. local track enabled, join, leave etc.
25
- * 5. State is immutable, a new copy with new references is created when there is a change,
26
- * if you try to modify state outside of setState, there'll be an error.
27
- */
28
- export declare class HMSSDKActions implements IHMSActions {
29
- private hmsSDKTracks;
30
- private hmsSDKPeers;
31
- private readonly sdk;
32
- private readonly store;
33
- private isRoomJoinCalled;
34
- private hmsNotifications;
35
- audioPlaylist: IHMSPlaylistActions;
36
- videoPlaylist: IHMSPlaylistActions;
37
- constructor(store: IHMSStore, sdk: HMSSdk, notificationManager: HMSNotifications);
38
- unblockAudio(): Promise<void>;
39
- setVolume(value: number, trackId?: HMSTrackID): void;
40
- setAudioOutputDevice(deviceId: string): void;
41
- setPreferredLayer(trackId: string, layer: HMSSimulcastLayer): void;
42
- preview(config: sdkTypes.HMSConfig): Promise<void>;
43
- join(config: sdkTypes.HMSConfig): void;
44
- leave(): Promise<void>;
45
- setScreenShareEnabled(enabled: boolean, audioOnly?: boolean): Promise<void>;
46
- addTrack(track: MediaStreamTrack, type?: HMSTrackSource): Promise<void>;
47
- removeTrack(trackId: string): Promise<void>;
48
- setLocalAudioEnabled(enabled: boolean): Promise<void>;
49
- setLocalVideoEnabled(enabled: boolean): Promise<void>;
50
- setEnabledTrack(trackID: string, enabled: boolean): Promise<void>;
51
- setAudioSettings(settings: Partial<sdkTypes.HMSAudioTrackSettings>): Promise<void>;
52
- setVideoSettings(settings: Partial<sdkTypes.HMSVideoTrackSettings>): Promise<void>;
53
- sendMessage(message: string): void;
54
- sendBroadcastMessage(message: string, type?: string): Promise<void>;
55
- sendGroupMessage(message: string, roles: string[], type?: string): Promise<void>;
56
- sendDirectMessage(message: string, peerID: string, type?: string): Promise<void>;
57
- private updateMessageInStore;
58
- setMessageRead(readStatus: boolean, messageId?: string): void;
59
- attachVideo(trackID: string, videoElement: HTMLVideoElement): Promise<void>;
60
- detachVideo(trackID: string, videoElement: HTMLVideoElement): Promise<void>;
61
- addPluginToVideoTrack(plugin: HMSVideoPlugin, pluginFrameRate?: number): Promise<void>;
62
- addPluginToAudioTrack(plugin: HMSAudioPlugin): Promise<void>;
63
- removePluginFromVideoTrack(plugin: HMSVideoPlugin): Promise<void>;
64
- removePluginFromAudioTrack(plugin: HMSAudioPlugin): Promise<void>;
65
- changeRole(forPeerId: string, toRole: string, force?: boolean): Promise<void>;
66
- acceptChangeRole(request: HMSRoleChangeRequest): Promise<void>;
67
- /**
68
- * @privateRemarks
69
- * there is no corresponding sdk method for rejecting change role but as the store also maintains the full
70
- * state of current pending requests, this method allows it to clean up when the request is rejected
71
- */
72
- rejectChangeRole(request: HMSRoleChangeRequest): void;
73
- endRoom(lock: boolean, reason: string): Promise<void>;
74
- removePeer(peerID: string, reason: string): Promise<void>;
75
- startRTMPOrRecording(params: sdkTypes.RTMPRecordingConfig): Promise<void>;
76
- stopRTMPAndRecording(): Promise<void>;
77
- changeName(name: string): Promise<void>;
78
- changeMetadata(metadata: string | any): Promise<void>;
79
- setRemoteTrackEnabled(trackID: HMSTrackID | HMSTrackID[], enabled: boolean): Promise<void>;
80
- setRemoteTracksEnabled(params: HMSChangeMultiTrackStateParams): Promise<void>;
81
- setLogLevel(level: HMSLogLevel): void;
82
- private resetState;
83
- private sdkJoinWithListeners;
84
- private onRemovedFromRoom;
85
- private onDeviceChange;
86
- private sdkPreviewWithListeners;
87
- private startScreenShare;
88
- private stopScreenShare;
89
- private attachVideoInternal;
90
- /**
91
- * This is a very important function as it's responsible for maintaining the source of
92
- * truth with maximum efficiency. The efficiency comes from the fact that the only
93
- * those portions of the store are updated which have actually changed.
94
- * While making a change in this function don't use functions like map, reduce etc.
95
- * which return a new copy of the data. Use Object.assign etc. to ensure that if the data
96
- * doesn't change reference is also not changed.
97
- * The UI and selectors rely on the fact that the store is immutable that is if there is
98
- * any change and only if there is a change, they'll get a new copy of the data they're
99
- * interested in with a new reference.
100
- * @protected
101
- */
102
- protected syncRoomState(action?: string): void;
103
- protected onPreview(sdkRoom: sdkTypes.HMSRoom): void;
104
- protected onJoin(sdkRoom: sdkTypes.HMSRoom): void;
105
- protected onRoomUpdate(type: sdkTypes.HMSRoomUpdate, room: sdkTypes.HMSRoom): void;
106
- protected onPeerUpdate(type: sdkTypes.HMSPeerUpdate, sdkPeer: sdkTypes.HMSPeer | sdkTypes.HMSPeer[]): void;
107
- protected onTrackUpdate(type: sdkTypes.HMSTrackUpdate, track: SDKHMSTrack, peer: sdkTypes.HMSPeer): void;
108
- protected onMessageReceived(sdkMessage: sdkTypes.HMSMessage): void;
109
- protected onHMSMessage(hmsMessage: HMSMessage): void;
110
- protected onAudioLevelUpdate(sdkSpeakers: sdkTypes.HMSSpeaker[]): void;
111
- protected onChangeTrackStateRequest(request: SDKHMSChangeTrackStateRequest): void;
112
- protected onChangeMultiTrackStateRequest(request: SDKHMSChangeMultiTrackStateRequest): void;
113
- protected onReconnected(): void;
114
- protected onReconnecting(sdkError: SDKHMSException): void;
115
- protected onError(sdkException: SDKHMSException): void;
116
- /**
117
- * the layer gets updated on addsink/removesink/preferlayer calls, for simulcast there
118
- * can be multiple layers, while for non simulcast there will be None and High.
119
- */
120
- private updateVideoLayer;
121
- private handleTrackRemove;
122
- private setEnabledSDKTrack;
123
- private setSDKLocalVideoTrackSettings;
124
- private setSDKLocalAudioTrackSettings;
125
- private getMediaSettings;
126
- private setTrackVolume;
127
- /**
128
- * Tells if the trackID is for local peer and video unmute is in process
129
- * @private
130
- */
131
- private localAndVideoUnmuting;
132
- private logPossibleInconsistency;
133
- private addRemoveVideoPlugin;
134
- private addRemoveAudioPlugin;
135
- /**
136
- * In case of replace track id is changed but not in store. Given the store id, check the real id
137
- * sdk is using to refer to the track and match them.
138
- */
139
- private isSameStoreSDKTrack;
140
- /**
141
- * convert new role change requests to store format and save.
142
- * keep only one request at a time in store till we figure out how to handle multiple requests at the same time
143
- */
144
- private onRoleChangeRequest;
145
- private removeRoleChangeRequest;
146
- private onRoleUpdate;
147
- private getStoreLocalTrackIDfromSDKTrack;
148
- private setProgress;
149
- private syncPlaylistState;
150
- private sendPeerUpdateNotification;
151
- /**
152
- * setState is separate so any future changes to how state change can be done from one place.
153
- * @param fn
154
- * @param name
155
- */
156
- private setState;
157
- }
1
+ import { HMSMessage, HMSTrackID, HMSTrackSource, HMSChangeMultiTrackStateParams, IHMSPlaylistActions } from '../schema';
2
+ import { IHMSActions } from '../IHMSActions';
3
+ import * as sdkTypes from './sdkTypes';
4
+ import { HMSRoleChangeRequest } from '../selectors';
5
+ import { HMSAudioPlugin, HMSException as SDKHMSException, HMSLogLevel, HMSChangeTrackStateRequest as SDKHMSChangeTrackStateRequest, HMSChangeMultiTrackStateRequest as SDKHMSChangeMultiTrackStateRequest, HMSSdk, HMSSimulcastLayer, HMSTrack as SDKHMSTrack, HMSVideoPlugin } from '@100mslive/hms-video';
6
+ import { IHMSStore } from '../IHMSStore';
7
+ import { HMSNotifications } from './HMSNotifications';
8
+ /**
9
+ * This class implements the IHMSActions interface for 100ms SDK. It connects with SDK
10
+ * and takes control of data management by letting every action pass through it. The
11
+ * passed in store is ensured to be the single source of truth reflecting current
12
+ * room related data at any point in time.
13
+ *
14
+ * @privateRemarks
15
+ * Things to keep in mind while updating store -
16
+ * 1. Treat setState as an atomic operation, if an action results in multiple changes,
17
+ * the changes should all happen within single setState function.
18
+ * 2. While updating the state it's very important to not update the reference if
19
+ * something is unchanged. Copy data in same reference object don't assign new
20
+ * object.
21
+ * 3. Mental Model(1) - Actions from backend -> Listeners of this class -> update store -> views update themselves
22
+ * eg. for this - peer added, remote muted etc.
23
+ * 4. Mental Model(2) - Actions from local -> View calls actions -> update store -> views update themselves
24
+ * eg. local track enabled, join, leave etc.
25
+ * 5. State is immutable, a new copy with new references is created when there is a change,
26
+ * if you try to modify state outside of setState, there'll be an error.
27
+ */
28
+ export declare class HMSSDKActions implements IHMSActions {
29
+ private hmsSDKTracks;
30
+ private hmsSDKPeers;
31
+ private readonly sdk;
32
+ private readonly store;
33
+ private isRoomJoinCalled;
34
+ private hmsNotifications;
35
+ audioPlaylist: IHMSPlaylistActions;
36
+ videoPlaylist: IHMSPlaylistActions;
37
+ constructor(store: IHMSStore, sdk: HMSSdk, notificationManager: HMSNotifications);
38
+ unblockAudio(): Promise<void>;
39
+ setVolume(value: number, trackId?: HMSTrackID): void;
40
+ setAudioOutputDevice(deviceId: string): void;
41
+ setPreferredLayer(trackId: string, layer: HMSSimulcastLayer): void;
42
+ preview(config: sdkTypes.HMSConfig): Promise<void>;
43
+ join(config: sdkTypes.HMSConfig): void;
44
+ leave(): Promise<void>;
45
+ setScreenShareEnabled(enabled: boolean, audioOnly?: boolean): Promise<void>;
46
+ addTrack(track: MediaStreamTrack, type?: HMSTrackSource): Promise<void>;
47
+ removeTrack(trackId: string): Promise<void>;
48
+ setLocalAudioEnabled(enabled: boolean): Promise<void>;
49
+ setLocalVideoEnabled(enabled: boolean): Promise<void>;
50
+ setEnabledTrack(trackID: string, enabled: boolean): Promise<void>;
51
+ setAudioSettings(settings: Partial<sdkTypes.HMSAudioTrackSettings>): Promise<void>;
52
+ setVideoSettings(settings: Partial<sdkTypes.HMSVideoTrackSettings>): Promise<void>;
53
+ sendMessage(message: string): void;
54
+ sendBroadcastMessage(message: string, type?: string): Promise<void>;
55
+ sendGroupMessage(message: string, roles: string[], type?: string): Promise<void>;
56
+ sendDirectMessage(message: string, peerID: string, type?: string): Promise<void>;
57
+ private updateMessageInStore;
58
+ setMessageRead(readStatus: boolean, messageId?: string): void;
59
+ attachVideo(trackID: string, videoElement: HTMLVideoElement): Promise<void>;
60
+ detachVideo(trackID: string, videoElement: HTMLVideoElement): Promise<void>;
61
+ addPluginToVideoTrack(plugin: HMSVideoPlugin, pluginFrameRate?: number): Promise<void>;
62
+ addPluginToAudioTrack(plugin: HMSAudioPlugin): Promise<void>;
63
+ removePluginFromVideoTrack(plugin: HMSVideoPlugin): Promise<void>;
64
+ removePluginFromAudioTrack(plugin: HMSAudioPlugin): Promise<void>;
65
+ changeRole(forPeerId: string, toRole: string, force?: boolean): Promise<void>;
66
+ acceptChangeRole(request: HMSRoleChangeRequest): Promise<void>;
67
+ /**
68
+ * @privateRemarks
69
+ * there is no corresponding sdk method for rejecting change role but as the store also maintains the full
70
+ * state of current pending requests, this method allows it to clean up when the request is rejected
71
+ */
72
+ rejectChangeRole(request: HMSRoleChangeRequest): void;
73
+ endRoom(lock: boolean, reason: string): Promise<void>;
74
+ removePeer(peerID: string, reason: string): Promise<void>;
75
+ startRTMPOrRecording(params: sdkTypes.RTMPRecordingConfig): Promise<void>;
76
+ stopRTMPAndRecording(): Promise<void>;
77
+ changeName(name: string): Promise<void>;
78
+ changeMetadata(metadata: string | any): Promise<void>;
79
+ setRemoteTrackEnabled(trackID: HMSTrackID | HMSTrackID[], enabled: boolean): Promise<void>;
80
+ setRemoteTracksEnabled(params: HMSChangeMultiTrackStateParams): Promise<void>;
81
+ setLogLevel(level: HMSLogLevel): void;
82
+ private resetState;
83
+ private sdkJoinWithListeners;
84
+ private onRemovedFromRoom;
85
+ private onDeviceChange;
86
+ private sdkPreviewWithListeners;
87
+ private startScreenShare;
88
+ private stopScreenShare;
89
+ private attachVideoInternal;
90
+ /**
91
+ * This is a very important function as it's responsible for maintaining the source of
92
+ * truth with maximum efficiency. The efficiency comes from the fact that the only
93
+ * those portions of the store are updated which have actually changed.
94
+ * While making a change in this function don't use functions like map, reduce etc.
95
+ * which return a new copy of the data. Use Object.assign etc. to ensure that if the data
96
+ * doesn't change reference is also not changed.
97
+ * The UI and selectors rely on the fact that the store is immutable that is if there is
98
+ * any change and only if there is a change, they'll get a new copy of the data they're
99
+ * interested in with a new reference.
100
+ * @protected
101
+ */
102
+ protected syncRoomState(action?: string): void;
103
+ protected onPreview(sdkRoom: sdkTypes.HMSRoom): void;
104
+ protected onJoin(sdkRoom: sdkTypes.HMSRoom): void;
105
+ protected onRoomUpdate(type: sdkTypes.HMSRoomUpdate, room: sdkTypes.HMSRoom): void;
106
+ protected onPeerUpdate(type: sdkTypes.HMSPeerUpdate, sdkPeer: sdkTypes.HMSPeer | sdkTypes.HMSPeer[]): void;
107
+ protected onTrackUpdate(type: sdkTypes.HMSTrackUpdate, track: SDKHMSTrack, peer: sdkTypes.HMSPeer): void;
108
+ protected onMessageReceived(sdkMessage: sdkTypes.HMSMessage): void;
109
+ protected onHMSMessage(hmsMessage: HMSMessage): void;
110
+ protected onAudioLevelUpdate(sdkSpeakers: sdkTypes.HMSSpeaker[]): void;
111
+ protected onChangeTrackStateRequest(request: SDKHMSChangeTrackStateRequest): void;
112
+ protected onChangeMultiTrackStateRequest(request: SDKHMSChangeMultiTrackStateRequest): void;
113
+ protected onReconnected(): void;
114
+ protected onReconnecting(sdkError: SDKHMSException): void;
115
+ protected onError(sdkException: SDKHMSException): void;
116
+ /**
117
+ * the layer gets updated on addsink/removesink/preferlayer calls, for simulcast there
118
+ * can be multiple layers, while for non simulcast there will be None and High.
119
+ */
120
+ private updateVideoLayer;
121
+ private handleTrackRemove;
122
+ private setEnabledSDKTrack;
123
+ private setSDKLocalVideoTrackSettings;
124
+ private setSDKLocalAudioTrackSettings;
125
+ private getMediaSettings;
126
+ private setTrackVolume;
127
+ /**
128
+ * Tells if the trackID is for local peer and video unmute is in process
129
+ * @private
130
+ */
131
+ private localAndVideoUnmuting;
132
+ private logPossibleInconsistency;
133
+ private addRemoveVideoPlugin;
134
+ private addRemoveAudioPlugin;
135
+ /**
136
+ * In case of replace track id is changed but not in store. Given the store id, check the real id
137
+ * sdk is using to refer to the track and match them.
138
+ */
139
+ private isSameStoreSDKTrack;
140
+ /**
141
+ * convert new role change requests to store format and save.
142
+ * keep only one request at a time in store till we figure out how to handle multiple requests at the same time
143
+ */
144
+ private onRoleChangeRequest;
145
+ private removeRoleChangeRequest;
146
+ private onRoleUpdate;
147
+ private getStoreLocalTrackIDfromSDKTrack;
148
+ private setProgress;
149
+ private syncPlaylistState;
150
+ private sendPeerUpdateNotification;
151
+ /**
152
+ * setState is separate so any future changes to how state change can be done from one place.
153
+ * @param fn
154
+ * @param name
155
+ */
156
+ private setState;
157
+ }
@@ -1,49 +1,49 @@
1
- import { HMSRoleChangeRequest as SDKHMSRoleChangeRequest, HMSTrack as SDKHMSTrack } from '@100mslive/hms-video';
2
- import { HMSDeviceChangeEvent, HMSException, HMSMessage, HMSPeer, HMSPeerID, HMSPlaylistItem, HMSRole, HMSRoleChangeStoreRequest, HMSRoleName, HMSRoom, HMSTrack } from '../schema';
3
- import * as sdkTypes from './sdkTypes';
4
- export declare class SDKToHMS {
5
- static convertPeer(sdkPeer: sdkTypes.HMSPeer): Partial<HMSPeer> & Pick<HMSPeer, 'id'>;
6
- static convertTrack(sdkTrack: SDKHMSTrack, peerId?: HMSPeerID): HMSTrack;
7
- static enrichTrack(track: HMSTrack, sdkTrack: SDKHMSTrack): void;
8
- static updateDeviceID(track: HMSTrack, sdkTrack: SDKHMSTrack): void;
9
- static enrichVideoTrack(track: HMSTrack, sdkTrack: SDKHMSTrack): void;
10
- static enrichPluginsDetails(track: HMSTrack, sdkTrack: SDKHMSTrack): void;
11
- static convertRoom(sdkRoom: sdkTypes.HMSRoom): Partial<HMSRoom>;
12
- static convertMessage(sdkMessage: sdkTypes.HMSMessage): Partial<HMSMessage> & Pick<HMSMessage, 'sender'>;
13
- static convertRoles(sdkRoles: HMSRole[]): Record<HMSRoleName, HMSRole>;
14
- static convertRoleChangeRequest(req: SDKHMSRoleChangeRequest): HMSRoleChangeStoreRequest;
15
- static convertException(sdkException: sdkTypes.HMSException): HMSException;
16
- static convertDeviceChangeUpdate(sdkDeviceChangeEvent: sdkTypes.HMSDeviceChangeEvent): HMSDeviceChangeEvent;
17
- static convertPlaylist(playlistManager: sdkTypes.HMSPlaylistManager): {
18
- audio: {
19
- list: Record<string, HMSPlaylistItem<any>>;
20
- selection: {
21
- id: string | undefined;
22
- hasPrevious: boolean;
23
- hasNext: boolean;
24
- };
25
- progress: number;
26
- volume: number;
27
- currentTime: number;
28
- playbackRate: number;
29
- };
30
- video: {
31
- list: Record<string, HMSPlaylistItem<any>>;
32
- selection: {
33
- id: string | undefined;
34
- hasPrevious: boolean;
35
- hasNext: boolean;
36
- };
37
- progress: number;
38
- volume: number;
39
- currentTime: number;
40
- playbackRate: number;
41
- };
42
- };
43
- static convertPlaylistItem<T>(playlistManager: sdkTypes.HMSPlaylistManager, playlistItem: sdkTypes.HMSPlaylistItem<T>): HMSPlaylistItem<T>;
44
- private static getConvertedPlaylistType;
45
- static convertRecordingRTMPState(recording: sdkTypes.HMSRecording | undefined, rtmp: sdkTypes.HMSRTMP | undefined): {
46
- recording: sdkTypes.HMSRecording;
47
- rtmp: sdkTypes.HMSRTMP;
48
- };
49
- }
1
+ import { HMSRoleChangeRequest as SDKHMSRoleChangeRequest, HMSTrack as SDKHMSTrack } from '@100mslive/hms-video';
2
+ import { HMSDeviceChangeEvent, HMSException, HMSMessage, HMSPeer, HMSPeerID, HMSPlaylistItem, HMSRole, HMSRoleChangeStoreRequest, HMSRoleName, HMSRoom, HMSTrack } from '../schema';
3
+ import * as sdkTypes from './sdkTypes';
4
+ export declare class SDKToHMS {
5
+ static convertPeer(sdkPeer: sdkTypes.HMSPeer): Partial<HMSPeer> & Pick<HMSPeer, 'id'>;
6
+ static convertTrack(sdkTrack: SDKHMSTrack, peerId?: HMSPeerID): HMSTrack;
7
+ static enrichTrack(track: HMSTrack, sdkTrack: SDKHMSTrack): void;
8
+ static updateDeviceID(track: HMSTrack, sdkTrack: SDKHMSTrack): void;
9
+ static enrichVideoTrack(track: HMSTrack, sdkTrack: SDKHMSTrack): void;
10
+ static enrichPluginsDetails(track: HMSTrack, sdkTrack: SDKHMSTrack): void;
11
+ static convertRoom(sdkRoom: sdkTypes.HMSRoom): Partial<HMSRoom>;
12
+ static convertMessage(sdkMessage: sdkTypes.HMSMessage): Partial<HMSMessage> & Pick<HMSMessage, 'sender'>;
13
+ static convertRoles(sdkRoles: HMSRole[]): Record<HMSRoleName, HMSRole>;
14
+ static convertRoleChangeRequest(req: SDKHMSRoleChangeRequest): HMSRoleChangeStoreRequest;
15
+ static convertException(sdkException: sdkTypes.HMSException): HMSException;
16
+ static convertDeviceChangeUpdate(sdkDeviceChangeEvent: sdkTypes.HMSDeviceChangeEvent): HMSDeviceChangeEvent;
17
+ static convertPlaylist(playlistManager: sdkTypes.HMSPlaylistManager): {
18
+ audio: {
19
+ list: Record<string, HMSPlaylistItem<any>>;
20
+ selection: {
21
+ id: string | undefined;
22
+ hasPrevious: boolean;
23
+ hasNext: boolean;
24
+ };
25
+ progress: number;
26
+ volume: number;
27
+ currentTime: number;
28
+ playbackRate: number;
29
+ };
30
+ video: {
31
+ list: Record<string, HMSPlaylistItem<any>>;
32
+ selection: {
33
+ id: string | undefined;
34
+ hasPrevious: boolean;
35
+ hasNext: boolean;
36
+ };
37
+ progress: number;
38
+ volume: number;
39
+ currentTime: number;
40
+ playbackRate: number;
41
+ };
42
+ };
43
+ static convertPlaylistItem<T>(playlistManager: sdkTypes.HMSPlaylistManager, playlistItem: sdkTypes.HMSPlaylistItem<T>): HMSPlaylistItem<T>;
44
+ private static getConvertedPlaylistType;
45
+ static convertRecordingRTMPState(recording: sdkTypes.HMSRecording | undefined, rtmp: sdkTypes.HMSRTMP | undefined): {
46
+ recording: sdkTypes.HMSRecording;
47
+ rtmp: sdkTypes.HMSRTMP;
48
+ };
49
+ }
@@ -1,7 +1,7 @@
1
- interface notifcationMap {
2
- [key: number]: string;
3
- }
4
- export declare const PEER_NOTIFICATION_TYPES: notifcationMap;
5
- export declare const TRACK_NOTIFICATION_TYPES: notifcationMap;
6
- export declare const ACTION_TYPES: notifcationMap;
7
- export {};
1
+ interface notifcationMap {
2
+ [key: number]: string;
3
+ }
4
+ export declare const PEER_NOTIFICATION_TYPES: notifcationMap;
5
+ export declare const TRACK_NOTIFICATION_TYPES: notifcationMap;
6
+ export declare const ACTION_TYPES: notifcationMap;
7
+ export {};
@@ -1,4 +1,4 @@
1
- import { PartialState, State } from 'zustand/vanilla';
2
- export declare type NamedSetState<T extends State> = {
3
- <K1 extends keyof T, K2 extends keyof T = K1, K3 extends keyof T = K2, K4 extends keyof T = K3>(partial: PartialState<T, K1, K2, K3, K4>, name?: string): void;
4
- };
1
+ import { PartialState, State } from 'zustand/vanilla';
2
+ export declare type NamedSetState<T extends State> = {
3
+ <K1 extends keyof T, K2 extends keyof T = K1, K3 extends keyof T = K2, K4 extends keyof T = K3>(partial: PartialState<T, K1, K2, K3, K4>, name?: string): void;
4
+ };
@@ -1,2 +1,3 @@
1
- import { HMSException, HMSSimulcastLayer, HMSPeerUpdate, HMSRoomUpdate, HMSTrackUpdate, HMSAudioTrackSettings, HMSVideoTrackSettings, HMSPeer, HMSRoom, HMSMessage, HMSConfig, HMSSpeaker, HMSRole, HMSLocalPeer, HMSRemotePeer, SimulcastLayerDefinition, DeviceMap, HMSLogLevel, HMSDeviceChangeEvent, HMSPlaylistItem, HMSPlaylistManager, HMSPlaylistProgressEvent, RTMPRecordingConfig, HMSRecording, HMSRTMP } from '@100mslive/hms-video';
2
- export { HMSPeer, HMSRoom, HMSMessage, HMSSpeaker, HMSConfig, HMSAudioTrackSettings, HMSVideoTrackSettings, HMSException, HMSSimulcastLayer, HMSRoomUpdate, HMSPeerUpdate, HMSTrackUpdate, HMSRole, HMSLocalPeer, HMSRemotePeer, HMSLogLevel, SimulcastLayerDefinition, DeviceMap, HMSDeviceChangeEvent, HMSPlaylistItem, HMSPlaylistManager, HMSPlaylistProgressEvent, RTMPRecordingConfig, HMSRecording, HMSRTMP, };
1
+ import { HMSException, HMSSimulcastLayer, HMSPeerUpdate, HMSRoomUpdate, HMSTrackUpdate, HMSAudioTrackSettings, HMSVideoTrackSettings, HMSPeer, HMSRoom, HMSMessage, HMSConfig, HMSSpeaker, HMSRole, HMSLocalPeer, HMSRemotePeer, SimulcastLayerDefinition, DeviceMap, HMSLogLevel, HMSDeviceChangeEvent, HMSPlaylistItem, HMSPlaylistManager, HMSPlaylistProgressEvent, RTMPRecordingConfig, HMSRecording, HMSRTMP, HMSAudioPluginType, HMSVideoPluginType, HMSVideoPlugin, HMSAudioPlugin } from '@100mslive/hms-video';
2
+ export { HMSException, HMSSimulcastLayer, HMSRoomUpdate, HMSPeerUpdate, HMSTrackUpdate, HMSLogLevel, HMSAudioPluginType, HMSVideoPluginType, };
3
+ export type { DeviceMap, HMSPeer, HMSRoom, HMSMessage, HMSSpeaker, HMSConfig, HMSAudioTrackSettings, HMSVideoTrackSettings, HMSRole, HMSLocalPeer, HMSRemotePeer, SimulcastLayerDefinition, HMSDeviceChangeEvent, HMSPlaylistItem, HMSPlaylistManager, HMSPlaylistProgressEvent, RTMPRecordingConfig, HMSRecording, HMSRTMP, HMSVideoPlugin, HMSAudioPlugin, };
@@ -1,19 +1,19 @@
1
- import { HMSStore } from '../../schema';
2
- import { IHMSStore } from '../../IHMSStore';
3
- declare type ActionName = string;
4
- declare type SetState = (store: HMSStore) => void;
5
- /**
6
- * pass in an action and an update function, the update functions will be batched and run such that
7
- * store updates are limited to only one action in a time interval
8
- *
9
- */
10
- export declare class ActionBatcher {
11
- private queuedUpdates;
12
- private timers;
13
- private DEFAULT_INTERVAL_MS;
14
- private store;
15
- constructor(store: IHMSStore);
16
- setState(fn: SetState, action: ActionName): void;
17
- private setStateBatched;
18
- }
19
- export {};
1
+ import { HMSStore } from '../../schema';
2
+ import { IHMSStore } from '../../IHMSStore';
3
+ declare type ActionName = string;
4
+ declare type SetState = (store: HMSStore) => void;
5
+ /**
6
+ * pass in an action and an update function, the update functions will be batched and run such that
7
+ * store updates are limited to only one action in a time interval
8
+ *
9
+ */
10
+ export declare class ActionBatcher {
11
+ private queuedUpdates;
12
+ private timers;
13
+ private DEFAULT_INTERVAL_MS;
14
+ private store;
15
+ constructor(store: IHMSStore);
16
+ setState(fn: SetState, action: ActionName): void;
17
+ private setStateBatched;
18
+ }
19
+ export {};
@@ -1,2 +1,2 @@
1
- import { HMSTrack } from '@100mslive/hms-video';
2
- export declare function isRemoteTrack(track: HMSTrack): boolean;
1
+ import { HMSTrack } from '@100mslive/hms-video';
2
+ export declare function isRemoteTrack(track: HMSTrack): boolean;
@@ -1,14 +1,14 @@
1
- import { HMSPeer, HMSPeerID, HMSTrack, HMSTrackID } from '../../schema';
2
- /**
3
- * updates draftPeers with newPeers ensuring minimal reference changes
4
- * @remarks
5
- * This is mutable and impure function, it modifies the passed in data to ensure
6
- * minimal reference changes
7
- * @param draftPeers the current peers object in store, an immer draft object
8
- * @param newPeers the latest update which needs to be stored
9
- * @param newHmsTracks this will be update if required
10
- * @param newHmsSDkTracks this is future value of local hms tacks map
11
- */
12
- export declare const mergeNewPeersInDraft: (draftPeers: Record<HMSPeerID, HMSPeer>, newPeers: Record<HMSPeerID, Partial<HMSPeer>>) => void;
13
- export declare const mergeNewTracksInDraft: (draftTracks: Record<HMSTrackID, HMSTrack>, newTracks: Record<HMSTrackID, Partial<HMSTrack>>) => void;
14
- export declare const areArraysEqual: <T>(arr1: T[], arr2?: T[] | undefined) => boolean;
1
+ import { HMSPeer, HMSPeerID, HMSTrack, HMSTrackID } from '../../schema';
2
+ /**
3
+ * updates draftPeers with newPeers ensuring minimal reference changes
4
+ * @remarks
5
+ * This is mutable and impure function, it modifies the passed in data to ensure
6
+ * minimal reference changes
7
+ * @param draftPeers the current peers object in store, an immer draft object
8
+ * @param newPeers the latest update which needs to be stored
9
+ * @param newHmsTracks this will be update if required
10
+ * @param newHmsSDkTracks this is future value of local hms tacks map
11
+ */
12
+ export declare const mergeNewPeersInDraft: (draftPeers: Record<HMSPeerID, HMSPeer>, newPeers: Record<HMSPeerID, Partial<HMSPeer>>) => void;
13
+ export declare const mergeNewTracksInDraft: (draftTracks: Record<HMSTrackID, HMSTrack>, newTracks: Record<HMSTrackID, Partial<HMSTrack>>) => void;
14
+ export declare const areArraysEqual: <T>(arr1: T[], arr2?: T[] | undefined) => boolean;
@@ -1,7 +1,9 @@
1
- export { IHMSStore, IHMSStoreReadOnly as HMSStoreWrapper } from './IHMSStore';
2
- export { IHMSActions as HMSActions } from './IHMSActions';
3
- export { IHMSNotifications as HMSNotifications } from './IHMSNotifications';
4
- export { HMSReactiveStore } from './hmsSDKStore/HMSReactiveStore';
5
- export * from './schema';
6
- export * from './selectors';
7
- export { HMSConfig, HMSAudioTrackSettings, HMSVideoTrackSettings, HMSSimulcastLayer, SimulcastLayerDefinition, DeviceMap, HMSLogLevel, RTMPRecordingConfig, HMSRecording, HMSRTMP, } from './hmsSDKStore/sdkTypes';
1
+ export type { IHMSStore, IHMSStoreReadOnly as HMSStoreWrapper, GetState } from './IHMSStore';
2
+ export type { IHMSActions as HMSActions } from './IHMSActions';
3
+ export type { IHMSNotifications as HMSNotifications } from './IHMSNotifications';
4
+ export type { HMSNotificationCallback } from './IHMSNotifications';
5
+ export { HMSReactiveStore } from './hmsSDKStore/HMSReactiveStore';
6
+ export * from './schema';
7
+ export * from './selectors';
8
+ export { HMSLogLevel, HMSAudioPluginType, HMSVideoPluginType } from './hmsSDKStore/sdkTypes';
9
+ export type { HMSConfig, HMSAudioTrackSettings, HMSVideoTrackSettings, HMSSimulcastLayer, SimulcastLayerDefinition, DeviceMap, RTMPRecordingConfig, HMSRecording, HMSRTMP, } from './hmsSDKStore/sdkTypes';
@@ -1,13 +1,13 @@
1
- import { DeviceMap } from '../hmsSDKStore/sdkTypes';
2
- import { HMSException } from './error';
3
- /**
4
- * Test fails when adding InputDeviceInfo[error TS2304: Cannot find name 'InputDeviceInfo'.]
5
- * InputDeviceInfo extends MediaDeviceInfo. See https://w3c.github.io/mediacapture-main/#input-specific-device-info
6
- * So, `selection?: MediaDeviceInfo` instead of `selection?: InputDeviceInfo | MediaDeviceInfo` is valid
7
- */
8
- export interface HMSDeviceChangeEvent {
9
- error?: HMSException;
10
- devices: DeviceMap;
11
- selection?: MediaDeviceInfo;
12
- type: 'audioOutput' | 'audioInput' | 'video';
13
- }
1
+ import { DeviceMap } from '../hmsSDKStore/sdkTypes';
2
+ import { HMSException } from './error';
3
+ /**
4
+ * Test fails when adding InputDeviceInfo[error TS2304: Cannot find name 'InputDeviceInfo'.]
5
+ * InputDeviceInfo extends MediaDeviceInfo. See https://w3c.github.io/mediacapture-main/#input-specific-device-info
6
+ * So, `selection?: MediaDeviceInfo` instead of `selection?: InputDeviceInfo | MediaDeviceInfo` is valid
7
+ */
8
+ export interface HMSDeviceChangeEvent {
9
+ error?: HMSException;
10
+ devices: DeviceMap;
11
+ selection?: MediaDeviceInfo;
12
+ type: 'audioOutput' | 'audioInput' | 'video';
13
+ }
@@ -1,13 +1,13 @@
1
- /**
2
- * any mid call error notification will be in this format
3
- */
4
- export interface HMSException {
5
- code: number;
6
- action: string;
7
- name: string;
8
- message: string;
9
- description: string;
10
- isTerminal: boolean;
11
- timestamp: Date;
12
- nativeError?: Error;
13
- }
1
+ /**
2
+ * any mid call error notification will be in this format
3
+ */
4
+ export interface HMSException {
5
+ code: number;
6
+ action: string;
7
+ name: string;
8
+ message: string;
9
+ description: string;
10
+ isTerminal: boolean;
11
+ timestamp: Date;
12
+ nativeError?: Error;
13
+ }
@@ -1,11 +1,11 @@
1
- export * from './schema';
2
- export * from './room';
3
- export * from './peer';
4
- export * from './message';
5
- export * from './settings';
6
- export * from './notification';
7
- export * from './role';
8
- export * from './error';
9
- export * from './requests';
10
- export * from './device-change';
11
- export * from './playlist';
1
+ export * from './schema';
2
+ export * from './room';
3
+ export * from './peer';
4
+ export * from './message';
5
+ export * from './settings';
6
+ export * from './notification';
7
+ export * from './role';
8
+ export * from './error';
9
+ export * from './requests';
10
+ export * from './device-change';
11
+ export * from './playlist';