@100mslive/hms-video-store 0.2.65 → 0.2.69
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/common/ui-logger.d.ts +3 -0
- package/dist/core/IHMSActions.d.ts +3 -3
- package/dist/core/hmsSDKStore/HMSNotifications.d.ts +1 -0
- package/dist/core/schema/notification.d.ts +1 -0
- package/dist/hms-video-store.cjs.development.js +86 -6
- 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 +86 -6
- package/dist/hms-video-store.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/common/ui-logger.ts +31 -0
- package/src/core/IHMSActions.ts +3 -3
- package/src/core/hmsSDKStore/HMSNotifications.ts +10 -0
- package/src/core/hmsSDKStore/HMSReactiveStore.ts +23 -1
- package/src/core/hmsSDKStore/HMSSDKActions.ts +12 -3
- package/src/core/schema/notification.ts +1 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HMSConfig, HMSSimulcastLayer, HMSAudioTrackSettings, HMSVideoTrackSettings, HMSLogLevel, HMSVideoPlugin, HMSAudioPlugin } from '@100mslive/hms-video';
|
|
2
|
-
import { HMSMessageID, HMSPeerID, HMSRoleName, HMSTrackID, HMSTrackSource, IHMSPlaylistActions,
|
|
2
|
+
import { HMSMessageID, HMSPeerID, HMSRoleName, HMSTrackID, HMSTrackSource, IHMSPlaylistActions, HMSChangeMultiTrackStateParams } from './schema';
|
|
3
3
|
import { HMSRoleChangeRequest } from './selectors';
|
|
4
4
|
import { RTMPRecordingConfig } from './hmsSDKStore/sdkTypes';
|
|
5
5
|
/**
|
|
@@ -193,9 +193,9 @@ export interface IHMSActions {
|
|
|
193
193
|
setRemoteTrackEnabled(forRemoteTrackID: HMSTrackID | HMSTrackID[], enabled: boolean): Promise<void>;
|
|
194
194
|
/**
|
|
195
195
|
* Use this to mute/unmute multipe tracks by source, role or type
|
|
196
|
-
* @param {
|
|
196
|
+
* @param {HMSChangeMultiTrackStateParams} params
|
|
197
197
|
*/
|
|
198
|
-
setRemoteTracksEnabled(params:
|
|
198
|
+
setRemoteTracksEnabled(params: HMSChangeMultiTrackStateParams): Promise<void>;
|
|
199
199
|
/**
|
|
200
200
|
* Method to be called with some UI interaction after autoplay error is received
|
|
201
201
|
* Most browsers have limitations where an audio can not be played if there was no user interaction.
|
|
@@ -10,6 +10,7 @@ export declare class HMSNotifications implements IHMSNotifications {
|
|
|
10
10
|
onNotification: (cb: (notification: HMSNotification) => void) => (() => void);
|
|
11
11
|
sendDeviceChange(request: HMSDeviceChangeEvent): void;
|
|
12
12
|
sendLeaveRoom(request: HMSLeaveRoomRequest): void;
|
|
13
|
+
sendPeerList(peers: HMSPeer[]): void;
|
|
13
14
|
sendPeerUpdate(type: sdkTypes.HMSPeerUpdate, peer: HMSPeer | null): void;
|
|
14
15
|
sendTrackUpdate(type: sdkTypes.HMSTrackUpdate, trackID: string): void;
|
|
15
16
|
sendMessageReceived(message: HMSMessage): void;
|
|
@@ -16,6 +16,7 @@ export declare enum HMSNotificationSeverity {
|
|
|
16
16
|
export declare enum HMSNotificationTypes {
|
|
17
17
|
PEER_JOINED = "PEER_JOINED",
|
|
18
18
|
PEER_LEFT = "PEER_LEFT",
|
|
19
|
+
PEER_LIST = "PEER_LIST",
|
|
19
20
|
NEW_MESSAGE = "NEW_MESSAGE",
|
|
20
21
|
ERROR = "ERROR",
|
|
21
22
|
RECONNECTING = "RECONNECTING",
|
|
@@ -963,6 +963,7 @@ var createDefaultStoreState = function createDefaultStoreState() {
|
|
|
963
963
|
(function (HMSNotificationTypes) {
|
|
964
964
|
HMSNotificationTypes["PEER_JOINED"] = "PEER_JOINED";
|
|
965
965
|
HMSNotificationTypes["PEER_LEFT"] = "PEER_LEFT";
|
|
966
|
+
HMSNotificationTypes["PEER_LIST"] = "PEER_LIST";
|
|
966
967
|
HMSNotificationTypes["NEW_MESSAGE"] = "NEW_MESSAGE";
|
|
967
968
|
HMSNotificationTypes["ERROR"] = "ERROR";
|
|
968
969
|
HMSNotificationTypes["RECONNECTING"] = "RECONNECTING";
|
|
@@ -1934,6 +1935,19 @@ var HMSLogger = /*#__PURE__*/function () {
|
|
|
1934
1935
|
}
|
|
1935
1936
|
|
|
1936
1937
|
this.log.apply(this, [sdkTypes.HMSLogLevel.ERROR].concat(data));
|
|
1938
|
+
};
|
|
1939
|
+
|
|
1940
|
+
HMSLogger.time = function time(mark) {
|
|
1941
|
+
this.log(sdkTypes.HMSLogLevel.TIME, '[HMSPerformanceTiming]', mark);
|
|
1942
|
+
};
|
|
1943
|
+
|
|
1944
|
+
HMSLogger.timeEnd = function timeEnd(mark) {
|
|
1945
|
+
this.log(sdkTypes.HMSLogLevel.TIMEEND, '[HMSPerformanceTiming]', mark, mark);
|
|
1946
|
+
};
|
|
1947
|
+
|
|
1948
|
+
HMSLogger.cleanUp = function cleanUp() {
|
|
1949
|
+
performance.clearMarks();
|
|
1950
|
+
performance.clearMeasures();
|
|
1937
1951
|
}
|
|
1938
1952
|
/* eslint-disable */
|
|
1939
1953
|
;
|
|
@@ -1990,6 +2004,30 @@ var HMSLogger = /*#__PURE__*/function () {
|
|
|
1990
2004
|
|
|
1991
2005
|
(_console5 = console).error.apply(_console5, [HMS_STORE_TAG].concat(data));
|
|
1992
2006
|
|
|
2007
|
+
break;
|
|
2008
|
+
}
|
|
2009
|
+
|
|
2010
|
+
case sdkTypes.HMSLogLevel.TIME:
|
|
2011
|
+
{
|
|
2012
|
+
performance.mark(data[1]);
|
|
2013
|
+
break;
|
|
2014
|
+
}
|
|
2015
|
+
|
|
2016
|
+
case sdkTypes.HMSLogLevel.TIMEEND:
|
|
2017
|
+
{
|
|
2018
|
+
var tag = data[0];
|
|
2019
|
+
var mark = data[1];
|
|
2020
|
+
|
|
2021
|
+
try {
|
|
2022
|
+
var entry = performance.measure(mark, mark); //@ts-ignore
|
|
2023
|
+
|
|
2024
|
+
this.log(sdkTypes.HMSLogLevel.DEBUG, tag, mark, entry == null ? void 0 : entry.duration);
|
|
2025
|
+
performance.clearMarks(mark);
|
|
2026
|
+
performance.clearMeasures(mark);
|
|
2027
|
+
} catch (error) {
|
|
2028
|
+
this.log(sdkTypes.HMSLogLevel.DEBUG, tag, mark, error);
|
|
2029
|
+
}
|
|
2030
|
+
|
|
1993
2031
|
break;
|
|
1994
2032
|
}
|
|
1995
2033
|
}
|
|
@@ -2686,6 +2724,8 @@ var HMSSDKActions = /*#__PURE__*/function () {
|
|
|
2686
2724
|
|
|
2687
2725
|
|
|
2688
2726
|
this.syncRemoteTrackState = function (action, track, peer) {
|
|
2727
|
+
HMSLogger.time(action + "-" + track.trackId);
|
|
2728
|
+
|
|
2689
2729
|
_this.setState(function (draftStore) {
|
|
2690
2730
|
var draftPeer = draftStore.peers[peer.peerId];
|
|
2691
2731
|
/**
|
|
@@ -2713,6 +2753,8 @@ var HMSSDKActions = /*#__PURE__*/function () {
|
|
|
2713
2753
|
|
|
2714
2754
|
_this.hmsSDKTracks[track.trackId] = track;
|
|
2715
2755
|
}, action);
|
|
2756
|
+
|
|
2757
|
+
HMSLogger.timeEnd(action + "-" + track.trackId);
|
|
2716
2758
|
};
|
|
2717
2759
|
/**
|
|
2718
2760
|
* setState is separate so any future changes to how state change can be done from one place.
|
|
@@ -3874,6 +3916,7 @@ var HMSSDKActions = /*#__PURE__*/function () {
|
|
|
3874
3916
|
}, reason);
|
|
3875
3917
|
this.isRoomJoinCalled = false;
|
|
3876
3918
|
this.hmsSDKTracks = {};
|
|
3919
|
+
HMSLogger.cleanUp();
|
|
3877
3920
|
};
|
|
3878
3921
|
|
|
3879
3922
|
_proto.sdkJoinWithListeners = function sdkJoinWithListeners(config) {
|
|
@@ -4122,7 +4165,7 @@ var HMSSDKActions = /*#__PURE__*/function () {
|
|
|
4122
4165
|
_proto.syncRoomState = function syncRoomState(action) {
|
|
4123
4166
|
var _this9 = this;
|
|
4124
4167
|
|
|
4125
|
-
|
|
4168
|
+
HMSLogger.time("store-sync-" + action);
|
|
4126
4169
|
var newHmsPeers = {};
|
|
4127
4170
|
var newHmsPeerIDs = []; // to add in room.peers
|
|
4128
4171
|
|
|
@@ -4174,7 +4217,7 @@ var HMSSDKActions = /*#__PURE__*/function () {
|
|
|
4174
4217
|
Object.assign(draftStore.playlist, SDKToHMS.convertPlaylist(_this9.sdk.getPlaylistManager()));
|
|
4175
4218
|
Object.assign(draftStore.room, SDKToHMS.convertRecordingRTMPState(recording, rtmp));
|
|
4176
4219
|
}, action);
|
|
4177
|
-
|
|
4220
|
+
HMSLogger.timeEnd("store-sync-" + action);
|
|
4178
4221
|
};
|
|
4179
4222
|
|
|
4180
4223
|
_proto.onPreview = function onPreview(sdkRoom) {
|
|
@@ -4217,12 +4260,18 @@ var HMSSDKActions = /*#__PURE__*/function () {
|
|
|
4217
4260
|
return; // ignore, high frequency update so no point of syncing peers
|
|
4218
4261
|
} else if (Array.isArray(sdkPeer)) {
|
|
4219
4262
|
this.syncRoomState('peersJoined');
|
|
4263
|
+
var hmsPeers = [];
|
|
4220
4264
|
|
|
4221
4265
|
for (var _iterator3 = _createForOfIteratorHelperLoose(sdkPeer), _step3; !(_step3 = _iterator3()).done;) {
|
|
4222
4266
|
var peer = _step3.value;
|
|
4223
4267
|
var hmsPeer = this.store.getState(selectPeerByID(peer.peerId));
|
|
4224
|
-
|
|
4268
|
+
|
|
4269
|
+
if (hmsPeer) {
|
|
4270
|
+
hmsPeers.push(hmsPeer);
|
|
4271
|
+
}
|
|
4225
4272
|
}
|
|
4273
|
+
|
|
4274
|
+
this.hmsNotifications.sendPeerList(hmsPeers);
|
|
4226
4275
|
} else {
|
|
4227
4276
|
this.peerUpdateInternal(type, sdkPeer);
|
|
4228
4277
|
}
|
|
@@ -4823,6 +4872,7 @@ var HMSSDKActions = /*#__PURE__*/function () {
|
|
|
4823
4872
|
actionName = 'peerLeft';
|
|
4824
4873
|
}
|
|
4825
4874
|
|
|
4875
|
+
HMSLogger.time(actionName + "-" + sdkPeer.peerId);
|
|
4826
4876
|
this.setState(function (draftStore) {
|
|
4827
4877
|
if (actionName === 'peerLeft') {
|
|
4828
4878
|
var index = draftStore.room.peers.indexOf(sdkPeer.peerId);
|
|
@@ -4845,7 +4895,8 @@ var HMSSDKActions = /*#__PURE__*/function () {
|
|
|
4845
4895
|
|
|
4846
4896
|
_this14.hmsSDKPeers[sdkPeer.peerId] = sdkPeer;
|
|
4847
4897
|
}
|
|
4848
|
-
}, actionName);
|
|
4898
|
+
}, actionName);
|
|
4899
|
+
HMSLogger.time(actionName + "-" + sdkPeer.peerId); // if peer wasn't available before sync(will happen if event is peer join)
|
|
4849
4900
|
|
|
4850
4901
|
if (!peer) {
|
|
4851
4902
|
peer = this.store.getState(selectPeerByID(sdkPeer.peerId));
|
|
@@ -4906,6 +4957,11 @@ var HMSNotifications = /*#__PURE__*/function () {
|
|
|
4906
4957
|
this.emitEvent(notification);
|
|
4907
4958
|
};
|
|
4908
4959
|
|
|
4960
|
+
_proto.sendPeerList = function sendPeerList(peers) {
|
|
4961
|
+
var notification = this.createNotification(exports.HMSNotificationTypes.PEER_LIST, peers, exports.HMSNotificationSeverity.INFO);
|
|
4962
|
+
this.emitEvent(notification);
|
|
4963
|
+
};
|
|
4964
|
+
|
|
4909
4965
|
_proto.sendPeerUpdate = function sendPeerUpdate(type, peer) {
|
|
4910
4966
|
var hmsPeer = this.store.getState(selectPeerByID(peer == null ? void 0 : peer.id)) || peer;
|
|
4911
4967
|
var notificationType = PEER_NOTIFICATION_TYPES[type];
|
|
@@ -5071,10 +5127,34 @@ var HMSReactiveStore = /*#__PURE__*/function () {
|
|
|
5071
5127
|
}; // add option to pass selector to getState
|
|
5072
5128
|
|
|
5073
5129
|
|
|
5074
|
-
var prevGetState = hmsStore.getState;
|
|
5130
|
+
var prevGetState = hmsStore.getState; // eslint-disable-next-line complexity
|
|
5075
5131
|
|
|
5076
5132
|
hmsStore.getState = function (selector) {
|
|
5077
|
-
|
|
5133
|
+
if (selector) {
|
|
5134
|
+
var name = selector.name || 'byIDSelector'; // @ts-ignore
|
|
5135
|
+
|
|
5136
|
+
if (!window.selectorsCount) {
|
|
5137
|
+
// @ts-ignore
|
|
5138
|
+
window.selectorsCount = {};
|
|
5139
|
+
} // @ts-ignore
|
|
5140
|
+
|
|
5141
|
+
|
|
5142
|
+
window.selectorsCount[name] = (window.selectorsCount[name] || 0) + 1;
|
|
5143
|
+
var start = performance.now();
|
|
5144
|
+
var updatedState = selector(prevGetState());
|
|
5145
|
+
var diff = performance.now() - start; // store selectors that take more than 1ms
|
|
5146
|
+
|
|
5147
|
+
if (diff > 1) {
|
|
5148
|
+
// @ts-ignore
|
|
5149
|
+
window.expensiveSelectors = window.expensiveSelectors || new Map(); // @ts-ignore
|
|
5150
|
+
|
|
5151
|
+
window.expensiveSelectors.set(name, diff);
|
|
5152
|
+
}
|
|
5153
|
+
|
|
5154
|
+
return updatedState;
|
|
5155
|
+
}
|
|
5156
|
+
|
|
5157
|
+
return prevGetState();
|
|
5078
5158
|
};
|
|
5079
5159
|
|
|
5080
5160
|
HMSReactiveStore.useShallowCheckInSubscribe(hmsStore);
|