@100mslive/hms-video-store 0.2.50 → 0.2.51
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/hmsSDKStore/HMSSDKActions.d.ts +7 -3
- package/dist/hms-video-store.cjs.development.js +22 -13
- 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 +22 -13
- package/dist/hms-video-store.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/core/hmsSDKStore/HMSSDKActions.ts +37 -31
package/package.json
CHANGED
|
@@ -5,63 +5,64 @@ import {
|
|
|
5
5
|
HMSMessageInput,
|
|
6
6
|
HMSPeer,
|
|
7
7
|
HMSPeerID,
|
|
8
|
+
HMSPlaylistType,
|
|
8
9
|
HMSRoomState,
|
|
9
10
|
HMSStore,
|
|
10
11
|
HMSTrack,
|
|
11
12
|
HMSTrackID,
|
|
12
13
|
HMSTrackSource,
|
|
14
|
+
IHMSPlaylistActions,
|
|
13
15
|
} from '../schema';
|
|
14
16
|
import { IHMSActions } from '../IHMSActions';
|
|
15
17
|
import * as sdkTypes from './sdkTypes';
|
|
16
18
|
import { SDKToHMS } from './adapter';
|
|
17
19
|
import {
|
|
20
|
+
HMSRoleChangeRequest,
|
|
21
|
+
selectHMSMessagesCount,
|
|
18
22
|
selectIsLocalScreenShared,
|
|
23
|
+
selectIsLocalVideoDisplayEnabled,
|
|
19
24
|
selectIsLocalVideoEnabled,
|
|
20
25
|
selectLocalAudioTrackID,
|
|
21
|
-
selectLocalVideoTrackID,
|
|
22
|
-
selectHMSMessagesCount,
|
|
23
|
-
selectIsLocalVideoDisplayEnabled,
|
|
24
26
|
selectLocalPeer,
|
|
27
|
+
selectLocalTrackIDs,
|
|
28
|
+
selectLocalVideoTrackID,
|
|
25
29
|
selectPeerByID,
|
|
26
|
-
HMSRoleChangeRequest,
|
|
27
|
-
selectTrackByID,
|
|
28
|
-
selectRoomStarted,
|
|
29
30
|
selectPermissions,
|
|
30
31
|
selectRolesMap,
|
|
31
|
-
|
|
32
|
+
selectRoomStarted,
|
|
32
33
|
selectRoomState,
|
|
34
|
+
selectTrackByID,
|
|
33
35
|
} from '../selectors';
|
|
34
36
|
import { HMSLogger } from '../../common/ui-logger';
|
|
35
37
|
import {
|
|
36
|
-
HMSSdk,
|
|
37
|
-
HMSVideoPlugin,
|
|
38
38
|
HMSAudioPlugin,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
HMSAudioTrack as SDKHMSAudioTrack,
|
|
40
|
+
HMSChangeTrackStateRequest as SDKHMSChangeTrackStateRequest,
|
|
41
|
+
HMSException as SDKHMSException,
|
|
42
|
+
HMSLeaveRoomRequest as SDKHMSLeaveRoomRequest,
|
|
42
43
|
HMSLocalAudioTrack as SDKHMSLocalAudioTrack,
|
|
44
|
+
HMSLocalTrack as SDKHMSLocalTrack,
|
|
43
45
|
HMSLocalVideoTrack as SDKHMSLocalVideoTrack,
|
|
46
|
+
HMSLogLevel,
|
|
44
47
|
HMSRemoteTrack as SDKHMSRemoteTrack,
|
|
45
|
-
|
|
46
|
-
HMSVideoTrack as SDKHMSVideoTrack,
|
|
47
|
-
HMSException as SDKHMSException,
|
|
48
|
+
HMSRemoteVideoTrack as SDKHMSRemoteVideoTrack,
|
|
48
49
|
HMSRoleChangeRequest as SDKHMSRoleChangeRequest,
|
|
49
|
-
|
|
50
|
+
HMSSdk,
|
|
50
51
|
HMSSimulcastLayer,
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
HMSTrack as SDKHMSTrack,
|
|
53
|
+
HMSVideoPlugin,
|
|
54
|
+
HMSVideoTrack as SDKHMSVideoTrack,
|
|
53
55
|
} from '@100mslive/hms-video';
|
|
54
56
|
import { IHMSStore } from '../IHMSStore';
|
|
55
57
|
|
|
56
58
|
import {
|
|
59
|
+
areArraysEqual,
|
|
57
60
|
mergeNewPeersInDraft,
|
|
58
61
|
mergeNewTracksInDraft,
|
|
59
|
-
areArraysEqual,
|
|
60
62
|
} from './sdkUtils/storeMergeUtils';
|
|
61
63
|
import { HMSNotifications } from './HMSNotifications';
|
|
62
64
|
import { NamedSetState } from './internalTypes';
|
|
63
65
|
import { isRemoteTrack } from './sdkUtils/sdkUtils';
|
|
64
|
-
import { HMSPlaylistType, IHMSPlaylistActions } from '../schema';
|
|
65
66
|
import { HMSPlaylist } from './HMSPlaylist';
|
|
66
67
|
|
|
67
68
|
/**
|
|
@@ -123,7 +124,7 @@ export class HMSSDKActions implements IHMSActions {
|
|
|
123
124
|
if (track) {
|
|
124
125
|
if (track instanceof SDKHMSRemoteVideoTrack) {
|
|
125
126
|
track.preferLayer(layer);
|
|
126
|
-
this.
|
|
127
|
+
this.updateVideoLayer(trackId, 'setPreferredLayer');
|
|
127
128
|
} else {
|
|
128
129
|
HMSLogger.w(`track ${trackId} is not an video track`);
|
|
129
130
|
}
|
|
@@ -348,6 +349,7 @@ export class HMSSDKActions implements IHMSActions {
|
|
|
348
349
|
const sdkTrack = this.hmsSDKTracks[trackID];
|
|
349
350
|
if (sdkTrack && sdkTrack.type === 'video') {
|
|
350
351
|
await (sdkTrack as SDKHMSVideoTrack).removeSink(videoElement);
|
|
352
|
+
this.updateVideoLayer(trackID, 'detachVideo');
|
|
351
353
|
} else {
|
|
352
354
|
this.logPossibleInconsistency('no video track found to remove sink');
|
|
353
355
|
}
|
|
@@ -559,16 +561,7 @@ export class HMSSDKActions implements IHMSActions {
|
|
|
559
561
|
const sdkTrack = this.hmsSDKTracks[trackID];
|
|
560
562
|
if (sdkTrack && sdkTrack.type === 'video') {
|
|
561
563
|
await (sdkTrack as SDKHMSVideoTrack).addSink(videoElement);
|
|
562
|
-
|
|
563
|
-
if (
|
|
564
|
-
sdkTrack instanceof SDKHMSRemoteVideoTrack &&
|
|
565
|
-
sdkTrack.getSimulcastDefinitions().length > 0
|
|
566
|
-
) {
|
|
567
|
-
this.setState(draft => {
|
|
568
|
-
const layer = sdkTrack.getSimulcastLayer();
|
|
569
|
-
draft.tracks[trackID].layer = layer;
|
|
570
|
-
}, 'updateLayerOnAttach');
|
|
571
|
-
}
|
|
564
|
+
this.updateVideoLayer(trackID, 'attachVideo');
|
|
572
565
|
} else {
|
|
573
566
|
this.logPossibleInconsistency('no video track found to add sink');
|
|
574
567
|
}
|
|
@@ -834,6 +827,19 @@ export class HMSSDKActions implements IHMSActions {
|
|
|
834
827
|
HMSLogger.e('received error from sdk', error);
|
|
835
828
|
}
|
|
836
829
|
|
|
830
|
+
/**
|
|
831
|
+
* the layer gets updated on addsink/removesink/preferlayer calls, for simulcast there
|
|
832
|
+
* can be multiple layers, while for non simulcast there will be None and High.
|
|
833
|
+
*/
|
|
834
|
+
private updateVideoLayer(trackID: string, action: string) {
|
|
835
|
+
const sdkTrack = this.hmsSDKTracks[trackID];
|
|
836
|
+
if (sdkTrack && sdkTrack instanceof SDKHMSRemoteVideoTrack) {
|
|
837
|
+
this.setState(draft => {
|
|
838
|
+
draft.tracks[trackID].layer = sdkTrack.getSimulcastLayer();
|
|
839
|
+
}, action);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
|
|
837
843
|
private handleTrackRemove(sdkTrack: SDKHMSTrack, sdkPeer: sdkTypes.HMSPeer) {
|
|
838
844
|
this.setState(draftStore => {
|
|
839
845
|
const hmsPeer = draftStore.peers[sdkPeer.peerId];
|