@100mslive/hms-video-store 0.2.58 → 0.2.59
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.
- package/dist/core/IHMSActions.d.ts +7 -1
- package/dist/core/hmsSDKStore/HMSNotifications.d.ts +2 -1
- package/dist/core/hmsSDKStore/HMSSDKActions.d.ts +4 -2
- package/dist/core/schema/notification.d.ts +1 -0
- package/dist/core/schema/requests.d.ts +14 -0
- package/dist/hms-video-store.cjs.development.js +169 -92
- package/dist/hms-video-store.cjs.development.js.map +1 -1
- package/dist/hms-video-store.cjs.production.min.js +1 -1
- package/dist/hms-video-store.cjs.production.min.js.map +1 -1
- package/dist/hms-video-store.esm.js +169 -92
- package/dist/hms-video-store.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/core/IHMSActions.ts +8 -0
- package/src/core/hmsSDKStore/HMSNotifications.ts +11 -0
- package/src/core/hmsSDKStore/HMSSDKActions.ts +50 -1
- package/src/core/schema/notification.ts +1 -0
- package/src/core/schema/requests.ts +16 -0
- package/src/core/selectors/selectors.ts +0 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.2.
|
|
2
|
+
"version": "0.2.59",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
"zustand": "3.5.7"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@100mslive/hms-video": "0.0.
|
|
58
|
+
"@100mslive/hms-video": "0.0.205",
|
|
59
59
|
"events": "^3.3.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@100mslive/hms-video": "0.0.
|
|
62
|
+
"@100mslive/hms-video": "0.0.205",
|
|
63
63
|
"@size-limit/file": "^5.0.3",
|
|
64
64
|
"events": "^3.3.0",
|
|
65
65
|
"husky": "^6.0.0",
|
package/src/core/IHMSActions.ts
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
HMSTrackID,
|
|
15
15
|
HMSTrackSource,
|
|
16
16
|
IHMSPlaylistActions,
|
|
17
|
+
HMSChangeMultiTrackStateRequest,
|
|
17
18
|
} from './schema';
|
|
18
19
|
import { HMSRoleChangeRequest } from './selectors';
|
|
19
20
|
import { RTMPRecordingConfig } from './hmsSDKStore/sdkTypes';
|
|
@@ -236,6 +237,13 @@ export interface IHMSActions {
|
|
|
236
237
|
): Promise<void>;
|
|
237
238
|
|
|
238
239
|
/**
|
|
240
|
+
* Use this to mute/unmute multipe tracks by source, role or type
|
|
241
|
+
* @param {HMSChangeMultiTrackStateRequest} params
|
|
242
|
+
*/
|
|
243
|
+
setRemoteTracksEnabled(params: HMSChangeMultiTrackStateRequest): Promise<void>;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Method to be called with some UI interaction after autoplay error is received
|
|
239
247
|
* Most browsers have limitations where an audio can not be played if there was no user interaction.
|
|
240
248
|
* SDK throws an autoplay error in this case, this method can be called after an UI interaction
|
|
241
249
|
* to resolve the autoplay error
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
HMSMessage,
|
|
14
14
|
HMSTrack,
|
|
15
15
|
HMSChangeTrackStateRequest,
|
|
16
|
+
HMSChangeMultiTrackStateRequest,
|
|
16
17
|
HMSLeaveRoomRequest,
|
|
17
18
|
HMSDeviceChangeEvent,
|
|
18
19
|
} from '../schema';
|
|
@@ -126,6 +127,15 @@ export class HMSNotifications implements IHMSNotifications {
|
|
|
126
127
|
this.emitEvent(notification);
|
|
127
128
|
}
|
|
128
129
|
|
|
130
|
+
sendChangeMultiTrackStateRequest(request: HMSChangeMultiTrackStateRequest) {
|
|
131
|
+
const notification = this.createNotification(
|
|
132
|
+
HMSNotificationTypes.CHANGE_MULTI_TRACK_STATE_REQUEST,
|
|
133
|
+
request,
|
|
134
|
+
HMSNotificationSeverity.INFO,
|
|
135
|
+
);
|
|
136
|
+
this.emitEvent(notification);
|
|
137
|
+
}
|
|
138
|
+
|
|
129
139
|
private emitEvent(notification: HMSNotification) {
|
|
130
140
|
this.eventEmitter.emit(HMS_NOTIFICATION_EVENT, notification);
|
|
131
141
|
}
|
|
@@ -138,6 +148,7 @@ export class HMSNotifications implements IHMSNotifications {
|
|
|
138
148
|
| HMSMessage
|
|
139
149
|
| HMSException
|
|
140
150
|
| HMSChangeTrackStateRequest
|
|
151
|
+
| HMSChangeMultiTrackStateRequest
|
|
141
152
|
| HMSLeaveRoomRequest
|
|
142
153
|
| HMSDeviceChangeEvent
|
|
143
154
|
| null,
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
HMSTrack,
|
|
12
12
|
HMSTrackID,
|
|
13
13
|
HMSTrackSource,
|
|
14
|
+
HMSChangeMultiTrackStateParams,
|
|
14
15
|
IHMSPlaylistActions,
|
|
15
16
|
} from '../schema';
|
|
16
17
|
import { IHMSActions } from '../IHMSActions';
|
|
@@ -33,12 +34,12 @@ import {
|
|
|
33
34
|
selectRoomState,
|
|
34
35
|
selectLocalMediaSettings,
|
|
35
36
|
selectTrackByID,
|
|
37
|
+
selectTracksMap,
|
|
36
38
|
} from '../selectors';
|
|
37
39
|
import { HMSLogger } from '../../common/ui-logger';
|
|
38
40
|
import {
|
|
39
41
|
HMSAudioPlugin,
|
|
40
42
|
HMSAudioTrack as SDKHMSAudioTrack,
|
|
41
|
-
HMSChangeTrackStateRequest as SDKHMSChangeTrackStateRequest,
|
|
42
43
|
HMSException as SDKHMSException,
|
|
43
44
|
HMSLeaveRoomRequest as SDKHMSLeaveRoomRequest,
|
|
44
45
|
HMSLocalAudioTrack as SDKHMSLocalAudioTrack,
|
|
@@ -48,6 +49,9 @@ import {
|
|
|
48
49
|
HMSRemoteTrack as SDKHMSRemoteTrack,
|
|
49
50
|
HMSRemoteVideoTrack as SDKHMSRemoteVideoTrack,
|
|
50
51
|
HMSRoleChangeRequest as SDKHMSRoleChangeRequest,
|
|
52
|
+
HMSChangeTrackStateRequest as SDKHMSChangeTrackStateRequest,
|
|
53
|
+
HMSChangeMultiTrackStateParams as SDKHMSChangeMultiTrackStateParams,
|
|
54
|
+
HMSChangeMultiTrackStateRequest as SDKHMSChangeMultiTrackStateRequest,
|
|
51
55
|
HMSSdk,
|
|
52
56
|
HMSSimulcastLayer,
|
|
53
57
|
HMSTrack as SDKHMSTrack,
|
|
@@ -452,6 +456,19 @@ export class HMSSDKActions implements IHMSActions {
|
|
|
452
456
|
}
|
|
453
457
|
}
|
|
454
458
|
|
|
459
|
+
async setRemoteTracksEnabled(params: HMSChangeMultiTrackStateParams) {
|
|
460
|
+
const sdkRequest: SDKHMSChangeMultiTrackStateParams = {
|
|
461
|
+
enabled: params.enabled,
|
|
462
|
+
type: params.type,
|
|
463
|
+
source: params.source,
|
|
464
|
+
};
|
|
465
|
+
if (params.roles) {
|
|
466
|
+
const rolesMap = this.store.getState(selectRolesMap);
|
|
467
|
+
sdkRequest.roles = params.roles.map(role => rolesMap[role]);
|
|
468
|
+
}
|
|
469
|
+
await this.sdk.changeMultiTrackState(sdkRequest);
|
|
470
|
+
}
|
|
471
|
+
|
|
455
472
|
setLogLevel(level: HMSLogLevel) {
|
|
456
473
|
HMSLogger.level = level;
|
|
457
474
|
this.sdk.setLogLevel(level);
|
|
@@ -479,6 +496,7 @@ export class HMSSDKActions implements IHMSActions {
|
|
|
479
496
|
onRoleUpdate: this.onRoleUpdate.bind(this),
|
|
480
497
|
onDeviceChange: this.onDeviceChange.bind(this),
|
|
481
498
|
onChangeTrackStateRequest: this.onChangeTrackStateRequest.bind(this),
|
|
499
|
+
onChangeMultiTrackStateRequest: this.onChangeMultiTrackStateRequest.bind(this),
|
|
482
500
|
onRemovedFromRoom: this.onRemovedFromRoom.bind(this),
|
|
483
501
|
});
|
|
484
502
|
this.sdk.addAudioListener({
|
|
@@ -791,6 +809,37 @@ export class HMSSDKActions implements IHMSActions {
|
|
|
791
809
|
});
|
|
792
810
|
}
|
|
793
811
|
|
|
812
|
+
protected onChangeMultiTrackStateRequest(request: SDKHMSChangeMultiTrackStateRequest) {
|
|
813
|
+
const requestedBy = this.store.getState(selectPeerByID(request.requestedBy.peerId));
|
|
814
|
+
|
|
815
|
+
if (!requestedBy) {
|
|
816
|
+
return this.logPossibleInconsistency(
|
|
817
|
+
`Not found peer who requested track state change, ${request.requestedBy}`,
|
|
818
|
+
);
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
if (!request.enabled) {
|
|
822
|
+
this.syncRoomState('changeMultiTrackStateRequest');
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
const tracks: HMSTrack[] = [];
|
|
826
|
+
const tracksMap = this.store.getState(selectTracksMap);
|
|
827
|
+
for (const track of request.tracks) {
|
|
828
|
+
const storeTrackID = this.getStoreLocalTrackIDfromSDKTrack(track);
|
|
829
|
+
if (storeTrackID && tracksMap[storeTrackID]) {
|
|
830
|
+
tracks.push(tracksMap[storeTrackID]);
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
this.hmsNotifications.sendChangeMultiTrackStateRequest({
|
|
835
|
+
requestedBy,
|
|
836
|
+
tracks,
|
|
837
|
+
enabled: request.enabled,
|
|
838
|
+
type: request.type,
|
|
839
|
+
source: request.source,
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
|
|
794
843
|
protected onReconnected() {
|
|
795
844
|
this.syncRoomState('reconnectedSync');
|
|
796
845
|
this.hmsNotifications.sendReconnected();
|
|
@@ -28,6 +28,7 @@ export enum HMSNotificationTypes {
|
|
|
28
28
|
ROLE_CHANGE_REQUEST = 'ROLE_CHANGE_REQUEST',
|
|
29
29
|
ROLE_UPDATED = 'ROLE_UPDATED',
|
|
30
30
|
CHANGE_TRACK_STATE_REQUEST = 'CHANGE_TRACK_STATE_REQUEST',
|
|
31
|
+
CHANGE_MULTI_TRACK_STATE_REQUEST = 'CHANGE_MULTI_TRACK_STATE_REQUEST',
|
|
31
32
|
ROOM_ENDED = 'ROOM_ENDED',
|
|
32
33
|
REMOVED_FROM_ROOM = 'REMOVED_FROM_ROOM',
|
|
33
34
|
DEVICE_CHANGE_UPDATE = 'DEVICE_CHANGE_UPDATE',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HMSTrackSource } from '.';
|
|
1
2
|
import { HMSPeer, HMSPeerID, HMSTrack } from './peer';
|
|
2
3
|
import { HMSRoleName } from './role';
|
|
3
4
|
|
|
@@ -13,6 +14,21 @@ export interface HMSChangeTrackStateRequest {
|
|
|
13
14
|
enabled: boolean;
|
|
14
15
|
}
|
|
15
16
|
|
|
17
|
+
export interface HMSChangeMultiTrackStateRequest {
|
|
18
|
+
requestedBy: HMSPeer;
|
|
19
|
+
tracks: HMSTrack[];
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
type?: 'audio' | 'video';
|
|
22
|
+
source?: HMSTrackSource;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface HMSChangeMultiTrackStateParams {
|
|
26
|
+
enabled: boolean;
|
|
27
|
+
roles?: HMSRoleName[];
|
|
28
|
+
type?: 'audio' | 'video';
|
|
29
|
+
source?: HMSTrackSource;
|
|
30
|
+
}
|
|
31
|
+
|
|
16
32
|
export interface HMSLeaveRoomRequest {
|
|
17
33
|
requestedBy: HMSPeer;
|
|
18
34
|
reason: string;
|
|
@@ -379,6 +379,5 @@ export const selectIsAllowedToSubscribe = createSelector([selectLocalPeerRole],
|
|
|
379
379
|
* Select the permissions which determine what actions the local peer can do.
|
|
380
380
|
*/
|
|
381
381
|
export const selectPermissions = createSelector(selectLocalPeerRole, role => role?.permissions);
|
|
382
|
-
|
|
383
382
|
export const selectRecordingState = createSelector(selectRoom, room => room.recording);
|
|
384
383
|
export const selectRTMPState = createSelector(selectRoom, room => room.rtmp);
|