@100mslive/react-native-hms 1.8.0 → 1.9.1-beta.0
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/android/build.gradle +3 -3
- package/android/local.properties +8 -1
- package/android/src/main/java/com/reactnativehmssdk/HMSAudioshareActivity.kt +1 -1
- package/android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt +15 -5
- package/android/src/main/java/com/reactnativehmssdk/HMSHLSPlayer.kt +4 -3
- package/android/src/main/java/com/reactnativehmssdk/HMSHelper.kt +43 -5
- package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +147 -47
- package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +419 -248
- package/android/src/main/java/com/reactnativehmssdk/HMSView.kt +24 -4
- package/android/src/main/java/com/reactnativehmssdk/HmsScreenshareActivity.kt +1 -1
- package/ios/HMSConstants.swift +1 -0
- package/ios/HMSDecoder.swift +16 -5
- package/ios/HMSHLSPlayerManager.swift +20 -11
- package/ios/HMSHelper.swift +33 -4
- package/ios/HMSManager.m +66 -10
- package/ios/HMSManager.swift +65 -21
- package/ios/HMSRNSDK.swift +244 -100
- package/ios/Hmssdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcuserdata/jatinnagar.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/Hmssdk.xcodeproj/xcuserdata/jatinnagar.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/lib/commonjs/classes/HMSAudioCodec.js +1 -2
- package/lib/commonjs/classes/HMSAudioCodec.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioDevice.js +1 -2
- package/lib/commonjs/classes/HMSAudioDevice.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioMixingMode.js +1 -2
- package/lib/commonjs/classes/HMSAudioMixingMode.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioMode.js +1 -2
- package/lib/commonjs/classes/HMSAudioMode.js.map +1 -1
- package/lib/commonjs/classes/HMSCameraFacing.js +1 -2
- package/lib/commonjs/classes/HMSCameraFacing.js.map +1 -1
- package/lib/commonjs/classes/HMSConstants.js +1 -2
- package/lib/commonjs/classes/HMSConstants.js.map +1 -1
- package/lib/commonjs/classes/HMSEventEmitter.js +1 -2
- package/lib/commonjs/classes/HMSEventEmitter.js.map +1 -1
- package/lib/commonjs/classes/HMSIOSAudioMode.js +1 -2
- package/lib/commonjs/classes/HMSIOSAudioMode.js.map +1 -1
- package/lib/commonjs/classes/HMSLayer.js +1 -2
- package/lib/commonjs/classes/HMSLayer.js.map +1 -1
- package/lib/commonjs/classes/HMSLogAlarmManager.js +1 -2
- package/lib/commonjs/classes/HMSLogAlarmManager.js.map +1 -1
- package/lib/commonjs/classes/HMSLogLevel.js +1 -2
- package/lib/commonjs/classes/HMSLogLevel.js.map +1 -1
- package/lib/commonjs/classes/HMSLogger.js +1 -2
- package/lib/commonjs/classes/HMSLogger.js.map +1 -1
- package/lib/commonjs/classes/HMSManagerModule.js +1 -2
- package/lib/commonjs/classes/HMSManagerModule.js.map +1 -1
- package/lib/commonjs/classes/HMSMessageRecipientType.js +1 -2
- package/lib/commonjs/classes/HMSMessageRecipientType.js.map +1 -1
- package/lib/commonjs/classes/HMSNativeEventListener.js +1 -2
- package/lib/commonjs/classes/HMSNativeEventListener.js.map +1 -1
- package/lib/commonjs/classes/HMSPIPConfig.js +4 -0
- package/lib/commonjs/classes/HMSPIPConfig.js.map +1 -0
- package/lib/commonjs/classes/HMSPIPListenerActions.js +2 -2
- package/lib/commonjs/classes/HMSPIPListenerActions.js.map +1 -1
- package/lib/commonjs/classes/HMSPeer.js +15 -0
- package/lib/commonjs/classes/HMSPeer.js.map +1 -1
- package/lib/commonjs/classes/HMSPeerListIterator.js +64 -0
- package/lib/commonjs/classes/HMSPeerListIterator.js.map +1 -0
- package/lib/commonjs/classes/HMSPeerListIteratorOptions.js +2 -0
- package/lib/commonjs/classes/HMSPeerListIteratorOptions.js.map +1 -0
- package/lib/commonjs/classes/HMSPeerUpdate.js +3 -4
- package/lib/commonjs/classes/HMSPeerUpdate.js.map +1 -1
- package/lib/commonjs/classes/HMSPeersCache.js +8 -2
- package/lib/commonjs/classes/HMSPeersCache.js.map +1 -1
- package/lib/commonjs/classes/HMSQualityLimitationReason.js +1 -2
- package/lib/commonjs/classes/HMSQualityLimitationReason.js.map +1 -1
- package/lib/commonjs/classes/HMSRoomCache.js +1 -2
- package/lib/commonjs/classes/HMSRoomCache.js.map +1 -1
- package/lib/commonjs/classes/HMSRoomUpdate.js +1 -2
- package/lib/commonjs/classes/HMSRoomUpdate.js.map +1 -1
- package/lib/commonjs/classes/HMSSDK.js +152 -8
- package/lib/commonjs/classes/HMSSDK.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackSettingsInitState.js +1 -2
- package/lib/commonjs/classes/HMSTrackSettingsInitState.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackSource.js +1 -2
- package/lib/commonjs/classes/HMSTrackSource.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackType.js +1 -2
- package/lib/commonjs/classes/HMSTrackType.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackUpdate.js +1 -2
- package/lib/commonjs/classes/HMSTrackUpdate.js.map +1 -1
- package/lib/commonjs/classes/HMSUpdateListenerActions.js +2 -2
- package/lib/commonjs/classes/HMSUpdateListenerActions.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoCodec.js +1 -2
- package/lib/commonjs/classes/HMSVideoCodec.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoViewMode.js +1 -2
- package/lib/commonjs/classes/HMSVideoViewMode.js.map +1 -1
- package/lib/commonjs/classes/HmsView.js +17 -5
- package/lib/commonjs/classes/HmsView.js.map +1 -1
- package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.js +11 -9
- package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.js.map +1 -1
- package/lib/commonjs/components/HMSHLSPlayer/RCTHMSHLSPlayer.js +2 -4
- package/lib/commonjs/components/HMSHLSPlayer/RCTHMSHLSPlayer.js.map +1 -1
- package/lib/commonjs/components/HMSHLSPlayer/hooks.js +11 -11
- package/lib/commonjs/components/HMSHLSPlayer/hooks.js.map +1 -1
- package/lib/commonjs/components/HMSHLSPlayer/index.js +8 -1
- package/lib/commonjs/components/HMSHLSPlayer/index.js.map +1 -1
- package/lib/commonjs/hooks/hmsviews.js +17 -0
- package/lib/commonjs/hooks/hmsviews.js.map +1 -0
- package/lib/commonjs/hooks/useHMSPeerUpdates.js +2 -2
- package/lib/commonjs/hooks/useHMSPeerUpdates.js.map +1 -1
- package/lib/commonjs/index.js +10 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/stores/hls-player-playback-slice.js +4 -0
- package/lib/commonjs/stores/hls-player-playback-slice.js.map +1 -1
- package/lib/commonjs/stores/hls-player-stats-store.js +1 -2
- package/lib/commonjs/stores/hls-player-stats-store.js.map +1 -1
- package/lib/commonjs/stores/hms-store.js +4 -3
- package/lib/commonjs/stores/hms-store.js.map +1 -1
- package/lib/commonjs/stores/hmsviews-slice.js +19 -0
- package/lib/commonjs/stores/hmsviews-slice.js.map +1 -0
- package/lib/commonjs/stores/types.js +9 -0
- package/lib/commonjs/stores/types.js.map +1 -1
- package/lib/commonjs/types.js +4 -7
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/classes/HMSPIPConfig.js +2 -0
- package/lib/module/classes/HMSPIPConfig.js.map +1 -0
- package/lib/module/classes/HMSPIPListenerActions.js +1 -0
- package/lib/module/classes/HMSPIPListenerActions.js.map +1 -1
- package/lib/module/classes/HMSPeer.js +15 -0
- package/lib/module/classes/HMSPeer.js.map +1 -1
- package/lib/module/classes/HMSPeerListIterator.js +58 -0
- package/lib/module/classes/HMSPeerListIterator.js.map +1 -0
- package/lib/module/classes/HMSPeerListIteratorOptions.js +2 -0
- package/lib/module/classes/HMSPeerListIteratorOptions.js.map +1 -0
- package/lib/module/classes/HMSPeerUpdate.js +2 -1
- package/lib/module/classes/HMSPeerUpdate.js.map +1 -1
- package/lib/module/classes/HMSPeersCache.js +7 -0
- package/lib/module/classes/HMSPeersCache.js.map +1 -1
- package/lib/module/classes/HMSSDK.js +153 -10
- package/lib/module/classes/HMSSDK.js.map +1 -1
- package/lib/module/classes/HMSUpdateListenerActions.js +1 -0
- package/lib/module/classes/HMSUpdateListenerActions.js.map +1 -1
- package/lib/module/classes/HmsView.js +14 -1
- package/lib/module/classes/HmsView.js.map +1 -1
- package/lib/module/components/HMSHLSPlayer/HMSHLSPlayer.js +9 -6
- package/lib/module/components/HMSHLSPlayer/HMSHLSPlayer.js.map +1 -1
- package/lib/module/components/HMSHLSPlayer/hooks.js +4 -0
- package/lib/module/components/HMSHLSPlayer/hooks.js.map +1 -1
- package/lib/module/components/HMSHLSPlayer/index.js +1 -1
- package/lib/module/components/HMSHLSPlayer/index.js.map +1 -1
- package/lib/module/hooks/hmsviews.js +12 -0
- package/lib/module/hooks/hmsviews.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/stores/hls-player-playback-slice.js +4 -0
- package/lib/module/stores/hls-player-playback-slice.js.map +1 -1
- package/lib/module/stores/hms-store.js +3 -1
- package/lib/module/stores/hms-store.js.map +1 -1
- package/lib/module/stores/hmsviews-slice.js +12 -0
- package/lib/module/stores/hmsviews-slice.js.map +1 -0
- package/lib/module/stores/types.js +9 -0
- package/lib/module/stores/types.js.map +1 -1
- package/lib/module/types.js +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/classes/HMSPIPConfig.d.ts +7 -0
- package/lib/typescript/classes/HMSPIPListenerActions.d.ts +1 -0
- package/lib/typescript/classes/HMSPeer.d.ts +3 -0
- package/lib/typescript/classes/HMSPeerListIterator.d.ts +9 -0
- package/lib/typescript/classes/HMSPeerListIteratorOptions.d.ts +24 -0
- package/lib/typescript/classes/HMSPeerUpdate.d.ts +2 -1
- package/lib/typescript/classes/HMSPeersCache.d.ts +1 -0
- package/lib/typescript/classes/HMSSDK.d.ts +47 -8
- package/lib/typescript/classes/HMSUpdateListenerActions.d.ts +2 -1
- package/lib/typescript/components/HMSHLSPlayer/hooks.d.ts +2 -0
- package/lib/typescript/components/HMSHLSPlayer/index.d.ts +1 -1
- package/lib/typescript/hooks/hmsviews.d.ts +3 -0
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/stores/hms-store.d.ts +4 -3
- package/lib/typescript/stores/hmsviews-slice.d.ts +5 -0
- package/lib/typescript/stores/types.d.ts +14 -2
- package/lib/typescript/types.d.ts +9 -5
- package/package.json +3 -1
- package/sdk-versions.json +2 -2
- package/src/classes/HMSPIPConfig.ts +7 -0
- package/src/classes/HMSPIPListenerActions.ts +1 -0
- package/src/classes/HMSPeer.ts +25 -0
- package/src/classes/HMSPeerListIterator.ts +60 -0
- package/src/classes/HMSPeerListIteratorOptions.ts +26 -0
- package/src/classes/HMSPeerUpdate.ts +2 -0
- package/src/classes/HMSPeersCache.ts +7 -0
- package/src/classes/HMSSDK.tsx +188 -13
- package/src/classes/HMSUpdateListenerActions.ts +1 -0
- package/src/classes/HmsView.tsx +16 -2
- package/src/components/HMSHLSPlayer/HMSHLSPlayer.tsx +11 -5
- package/src/components/HMSHLSPlayer/hooks.ts +7 -0
- package/src/components/HMSHLSPlayer/index.ts +1 -0
- package/src/hooks/hmsviews.ts +13 -0
- package/src/index.ts +2 -0
- package/src/stores/hls-player-playback-slice.ts +3 -0
- package/src/stores/hms-store.ts +2 -0
- package/src/stores/hmsviews-slice.ts +20 -0
- package/src/stores/types.ts +20 -1
- package/src/types.ts +13 -3
- package/android/.gradle/6.7.1/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/6.7.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.7.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/6.7.1/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/6.7.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/6.7.1/gc.properties +0 -0
- package/android/.gradle/6.9/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/6.9/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.9/fileChanges/last-build.bin +0 -0
- package/android/.gradle/6.9/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/6.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/6.9/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/configuration-cache/gc.properties +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
package/src/classes/HMSSDK.tsx
CHANGED
|
@@ -41,19 +41,14 @@ import {
|
|
|
41
41
|
HMSRoomCache,
|
|
42
42
|
setHmsRoomCache,
|
|
43
43
|
} from './HMSRoomCache';
|
|
44
|
-
import { HMSPeerUpdateOrdinals } from './HMSPeerUpdate';
|
|
44
|
+
import { HMSPeerUpdate, HMSPeerUpdateOrdinals } from './HMSPeerUpdate';
|
|
45
45
|
import { HMSSessionStore } from './HMSSessionStore';
|
|
46
|
+
import type { HMSPeerListIteratorOptions } from './HMSPeerListIteratorOptions';
|
|
47
|
+
import { HMSPeerListIterator } from './HMSPeerListIterator';
|
|
48
|
+
import type { HMSPIPConfig } from './HMSPIPConfig';
|
|
46
49
|
|
|
47
50
|
type HmsViewProps = Omit<HmsComponentProps, 'id'>;
|
|
48
51
|
|
|
49
|
-
// TODO: Rename to HMSPIPConfig & to be moved to a separate file
|
|
50
|
-
interface PIPConfig {
|
|
51
|
-
aspectRatio?: [number, number];
|
|
52
|
-
endButton?: boolean;
|
|
53
|
-
audioButton?: boolean;
|
|
54
|
-
videoButton?: boolean;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
52
|
const ReactNativeVersion = require('react-native/Libraries/Core/ReactNativeVersion');
|
|
58
53
|
|
|
59
54
|
let HmsSdk: HMSSDK | undefined;
|
|
@@ -66,6 +61,7 @@ export class HMSSDK {
|
|
|
66
61
|
private onJoinDelegate?: any;
|
|
67
62
|
private onRoomDelegate?: any;
|
|
68
63
|
private onPeerDelegate?: any;
|
|
64
|
+
private onPeerListUpdatedDelegate?: any;
|
|
69
65
|
private onTrackDelegate?: any;
|
|
70
66
|
private onErrorDelegate?: any;
|
|
71
67
|
private onMessageDelegate?: any;
|
|
@@ -83,6 +79,7 @@ export class HMSSDK {
|
|
|
83
79
|
private onAudioDeviceChangedDelegate?: any;
|
|
84
80
|
private onSessionStoreAvailableDelegate?: any;
|
|
85
81
|
private onPIPRoomLeaveDelegate?: any;
|
|
82
|
+
private onPIPModeChangedDelegate?: any;
|
|
86
83
|
|
|
87
84
|
private emitterSubscriptions: Partial<
|
|
88
85
|
Record<
|
|
@@ -1145,6 +1142,86 @@ export class HMSSDK {
|
|
|
1145
1142
|
return HMSEncoder.encodeHmsPeer({ peerID: peerId });
|
|
1146
1143
|
};
|
|
1147
1144
|
|
|
1145
|
+
/**
|
|
1146
|
+
* - This function is used to raise hand for the local peer
|
|
1147
|
+
* @memberof HMSSDK
|
|
1148
|
+
*/
|
|
1149
|
+
raiseLocalPeerHand = async () => {
|
|
1150
|
+
const data = {
|
|
1151
|
+
id: this.id,
|
|
1152
|
+
};
|
|
1153
|
+
logger?.verbose('#Function raiseLocalPeerHand', data);
|
|
1154
|
+
return HMSManager.raiseLocalPeerHand(data);
|
|
1155
|
+
};
|
|
1156
|
+
|
|
1157
|
+
/**
|
|
1158
|
+
* - This function is used to lower hand for the local peer
|
|
1159
|
+
* @memberof HMSSDK
|
|
1160
|
+
*/
|
|
1161
|
+
lowerLocalPeerHand = async () => {
|
|
1162
|
+
const data = {
|
|
1163
|
+
id: this.id,
|
|
1164
|
+
};
|
|
1165
|
+
logger?.verbose('#Function lowerLocalPeerHand', data);
|
|
1166
|
+
return HMSManager.lowerLocalPeerHand(data);
|
|
1167
|
+
};
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* - This function is used to lower hand for the remote peer
|
|
1171
|
+
* @param peer
|
|
1172
|
+
*/
|
|
1173
|
+
lowerRemotePeerHand = async (peer: HMSPeer) => {
|
|
1174
|
+
const data = {
|
|
1175
|
+
peerId: peer.peerID,
|
|
1176
|
+
id: this.id,
|
|
1177
|
+
};
|
|
1178
|
+
logger?.verbose('#Function lowerRemotePeerHand', data);
|
|
1179
|
+
return HMSManager.lowerRemotePeerHand(data);
|
|
1180
|
+
};
|
|
1181
|
+
|
|
1182
|
+
/**
|
|
1183
|
+
* `getPeerListIterator` method returns an instance of `HMSPeerListIterator` class
|
|
1184
|
+
*
|
|
1185
|
+
* @param options options for configuring iterator
|
|
1186
|
+
* @returns instance of HMSPeerListIterator class
|
|
1187
|
+
*
|
|
1188
|
+
* Example usage:
|
|
1189
|
+
* ```
|
|
1190
|
+
* const peerListIterator = hmsInstance.getPeerListIterator();
|
|
1191
|
+
* ```
|
|
1192
|
+
* OR
|
|
1193
|
+
* ```
|
|
1194
|
+
* const peerListIterator = hmsInstance.getPeerListIterator({
|
|
1195
|
+
* limit: 10,
|
|
1196
|
+
* byRoleName: 'viewer-realtime',
|
|
1197
|
+
* });
|
|
1198
|
+
* ```
|
|
1199
|
+
*/
|
|
1200
|
+
getPeerListIterator = (
|
|
1201
|
+
options?: HMSPeerListIteratorOptions
|
|
1202
|
+
): HMSPeerListIterator => {
|
|
1203
|
+
logger?.verbose('#Function getPeerListIterator', {
|
|
1204
|
+
id: this.id,
|
|
1205
|
+
options,
|
|
1206
|
+
});
|
|
1207
|
+
|
|
1208
|
+
const uniqueId = Math.random().toString(16).slice(2);
|
|
1209
|
+
|
|
1210
|
+
const data: null | { sucess: boolean; uniqueId: string; totalCount: number; } =
|
|
1211
|
+
HMSManager.getPeerListIterator({
|
|
1212
|
+
id: this.id,
|
|
1213
|
+
...options,
|
|
1214
|
+
limit: options?.limit ?? 10,
|
|
1215
|
+
uniqueId,
|
|
1216
|
+
});
|
|
1217
|
+
|
|
1218
|
+
if (!data) {
|
|
1219
|
+
throw new Error('Unable to create PeerListIterator');
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
return new HMSPeerListIterator(data.uniqueId, data.totalCount);
|
|
1223
|
+
};
|
|
1224
|
+
|
|
1148
1225
|
/**
|
|
1149
1226
|
* - This is a prototype event listener that takes action and listens for updates related to that particular action
|
|
1150
1227
|
*
|
|
@@ -1229,6 +1306,28 @@ export class HMSSDK {
|
|
|
1229
1306
|
this.onPeerDelegate = callback;
|
|
1230
1307
|
break;
|
|
1231
1308
|
}
|
|
1309
|
+
case HMSUpdateListenerActions.ON_PEER_LIST_UPDATED: {
|
|
1310
|
+
// Checking if we already have ON_PEER_LIST_UPDATED subscription
|
|
1311
|
+
if (
|
|
1312
|
+
!this.emitterSubscriptions[
|
|
1313
|
+
HMSUpdateListenerActions.ON_PEER_LIST_UPDATED
|
|
1314
|
+
]
|
|
1315
|
+
) {
|
|
1316
|
+
// Adding ON_PEER_LIST_UPDATED native listener
|
|
1317
|
+
const peerListUpdatedSubscription =
|
|
1318
|
+
HMSNativeEventListener.addListener(
|
|
1319
|
+
this.id,
|
|
1320
|
+
HMSUpdateListenerActions.ON_PEER_LIST_UPDATED,
|
|
1321
|
+
this.onPeerListUpdatedListener
|
|
1322
|
+
);
|
|
1323
|
+
this.emitterSubscriptions[
|
|
1324
|
+
HMSUpdateListenerActions.ON_PEER_LIST_UPDATED
|
|
1325
|
+
] = peerListUpdatedSubscription;
|
|
1326
|
+
}
|
|
1327
|
+
// Adding App Delegate listener
|
|
1328
|
+
this.onPeerListUpdatedDelegate = callback;
|
|
1329
|
+
break;
|
|
1330
|
+
}
|
|
1232
1331
|
case HMSUpdateListenerActions.ON_TRACK_UPDATE: {
|
|
1233
1332
|
// Checking if we already have ON_TRACK_UPDATE subscription
|
|
1234
1333
|
if (
|
|
@@ -1554,6 +1653,25 @@ export class HMSSDK {
|
|
|
1554
1653
|
}
|
|
1555
1654
|
break;
|
|
1556
1655
|
}
|
|
1656
|
+
case HMSPIPListenerActions.ON_PIP_MODE_CHANGED: {
|
|
1657
|
+
if (Platform.OS === 'android') {
|
|
1658
|
+
// Checking if we already have ON_PIP_MODE_CHANGED subscription
|
|
1659
|
+
if (
|
|
1660
|
+
!this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_MODE_CHANGED]
|
|
1661
|
+
) {
|
|
1662
|
+
const pipModeChangedSubscription = HMSNativeEventListener.addListener(
|
|
1663
|
+
this.id,
|
|
1664
|
+
HMSPIPListenerActions.ON_PIP_MODE_CHANGED,
|
|
1665
|
+
this.onPIPModeChangedListener
|
|
1666
|
+
);
|
|
1667
|
+
this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_MODE_CHANGED] =
|
|
1668
|
+
pipModeChangedSubscription;
|
|
1669
|
+
}
|
|
1670
|
+
// Adding PIP mode changed Delegate listener
|
|
1671
|
+
this.onPIPModeChangedDelegate = callback;
|
|
1672
|
+
}
|
|
1673
|
+
break;
|
|
1674
|
+
}
|
|
1557
1675
|
default:
|
|
1558
1676
|
}
|
|
1559
1677
|
};
|
|
@@ -1893,6 +2011,22 @@ export class HMSSDK {
|
|
|
1893
2011
|
}
|
|
1894
2012
|
break;
|
|
1895
2013
|
}
|
|
2014
|
+
case HMSPIPListenerActions.ON_PIP_MODE_CHANGED: {
|
|
2015
|
+
if (Platform.OS === 'android') {
|
|
2016
|
+
const subscription =
|
|
2017
|
+
this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_MODE_CHANGED];
|
|
2018
|
+
// Removing ON_PIP_MODE_CHANGED native listener
|
|
2019
|
+
if (subscription) {
|
|
2020
|
+
subscription.remove();
|
|
2021
|
+
|
|
2022
|
+
this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_MODE_CHANGED] =
|
|
2023
|
+
undefined;
|
|
2024
|
+
}
|
|
2025
|
+
// Removing App Delegate listener
|
|
2026
|
+
this.onPIPModeChangedDelegate = null;
|
|
2027
|
+
}
|
|
2028
|
+
break;
|
|
2029
|
+
}
|
|
1896
2030
|
default:
|
|
1897
2031
|
}
|
|
1898
2032
|
};
|
|
@@ -2015,8 +2149,15 @@ export class HMSSDK {
|
|
|
2015
2149
|
const peer: HMSPeer = HMSEncoder.encodeHmsPeer(data.peer);
|
|
2016
2150
|
const type = HMSEncoder.encodeHmsPeerUpdate(data.type) || data.type;
|
|
2017
2151
|
|
|
2018
|
-
|
|
2152
|
+
if (type === HMSPeerUpdate.PEER_LEFT) {
|
|
2153
|
+
this.sendPeerUpdateWhenPeerLeaves(data, peer, type);
|
|
2154
|
+
} else {
|
|
2155
|
+
getHmsPeersCache()?.updatePeerCache(data.peer.peerID, data.peer, type);
|
|
2156
|
+
this.sendPeerUpdate(peer, type);
|
|
2157
|
+
}
|
|
2158
|
+
};
|
|
2019
2159
|
|
|
2160
|
+
private sendPeerUpdate = (peer: any, type: any) => {
|
|
2020
2161
|
if (this.onPeerDelegate) {
|
|
2021
2162
|
logger?.verbose('#Listener ON_PEER_LISTENER_CALL', {
|
|
2022
2163
|
peer,
|
|
@@ -2024,6 +2165,32 @@ export class HMSSDK {
|
|
|
2024
2165
|
});
|
|
2025
2166
|
this.onPeerDelegate({ peer, type });
|
|
2026
2167
|
}
|
|
2168
|
+
}
|
|
2169
|
+
|
|
2170
|
+
private sendPeerUpdateWhenPeerLeaves = (data: any, peer: any, type: any) => {
|
|
2171
|
+
this.sendPeerUpdate(peer, type);
|
|
2172
|
+
|
|
2173
|
+
getHmsPeersCache()?.updatePeerCache(data.peer.peerID, data.peer, type);
|
|
2174
|
+
}
|
|
2175
|
+
|
|
2176
|
+
onPeerListUpdatedListener = (data: any) => {
|
|
2177
|
+
if (data.id !== this.id) {
|
|
2178
|
+
return;
|
|
2179
|
+
}
|
|
2180
|
+
const addedPeers = HMSEncoder.encodeHmsPeers(data.addedPeers);
|
|
2181
|
+
const removedPeers = HMSEncoder.encodeHmsPeers(data.removedPeers);
|
|
2182
|
+
|
|
2183
|
+
if (this.onPeerListUpdatedDelegate) {
|
|
2184
|
+
logger?.verbose('#Listener ON_PEER_LIST_UPDATED_LISTENER_CALL', {
|
|
2185
|
+
totalAddedPeers: addedPeers.length,
|
|
2186
|
+
totalRemovedPeers: removedPeers.length,
|
|
2187
|
+
});
|
|
2188
|
+
|
|
2189
|
+
this.onPeerListUpdatedDelegate({
|
|
2190
|
+
addedPeers,
|
|
2191
|
+
removedPeers,
|
|
2192
|
+
});
|
|
2193
|
+
}
|
|
2027
2194
|
};
|
|
2028
2195
|
|
|
2029
2196
|
onTrackListener = (data: any) => {
|
|
@@ -2324,18 +2491,26 @@ export class HMSSDK {
|
|
|
2324
2491
|
}
|
|
2325
2492
|
};
|
|
2326
2493
|
|
|
2494
|
+
onPIPModeChangedListener = (data: { isInPictureInPictureMode: boolean }) => {
|
|
2495
|
+
if (this.onPIPModeChangedDelegate) {
|
|
2496
|
+
logger?.verbose('#Listener onPIPModeChanged_CALL', data);
|
|
2497
|
+
|
|
2498
|
+
this.onPIPModeChangedDelegate(data);
|
|
2499
|
+
}
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2327
2502
|
async isPipModeSupported(): Promise<undefined | boolean> {
|
|
2328
2503
|
return HMSManager.handlePipActions('isPipModeSupported', { id: this.id });
|
|
2329
2504
|
}
|
|
2330
2505
|
|
|
2331
|
-
async
|
|
2332
|
-
return HMSManager.handlePipActions('
|
|
2506
|
+
async enterPipMode(data?: HMSPIPConfig): Promise<undefined | boolean> {
|
|
2507
|
+
return HMSManager.handlePipActions('enterPipMode', {
|
|
2333
2508
|
...data,
|
|
2334
2509
|
id: this.id,
|
|
2335
2510
|
});
|
|
2336
2511
|
}
|
|
2337
2512
|
|
|
2338
|
-
async setPipParams(data?:
|
|
2513
|
+
async setPipParams(data?: HMSPIPConfig): Promise<undefined | boolean> {
|
|
2339
2514
|
return HMSManager.handlePipActions('setPictureInPictureParams', {
|
|
2340
2515
|
...data,
|
|
2341
2516
|
id: this.id,
|
|
@@ -26,4 +26,5 @@ export enum HMSUpdateListenerActions {
|
|
|
26
26
|
ON_AUDIO_DEVICE_CHANGED = 'ON_AUDIO_DEVICE_CHANGED',
|
|
27
27
|
ON_SESSION_STORE_AVAILABLE = 'ON_SESSION_STORE_AVAILABLE',
|
|
28
28
|
ON_SESSION_STORE_CHANGED = 'ON_SESSION_STORE_CHANGED',
|
|
29
|
+
ON_PEER_LIST_UPDATED = 'ON_PEER_LIST_UPDATED',
|
|
29
30
|
}
|
package/src/classes/HmsView.tsx
CHANGED
|
@@ -6,9 +6,10 @@ import {
|
|
|
6
6
|
UIManager,
|
|
7
7
|
Platform,
|
|
8
8
|
} from 'react-native';
|
|
9
|
-
import type { ViewStyle } from 'react-native';
|
|
9
|
+
import type { NativeSyntheticEvent, ViewStyle } from 'react-native';
|
|
10
10
|
import { HMSConstants } from './HMSConstants';
|
|
11
11
|
import { HMSVideoViewMode } from './HMSVideoViewMode';
|
|
12
|
+
import { setHmsViewsResolutionsState } from '../hooks/hmsviews';
|
|
12
13
|
|
|
13
14
|
interface HmsViewProps {
|
|
14
15
|
data: {
|
|
@@ -64,7 +65,20 @@ export const HmsViewComponent = React.forwardRef<any, HmsComponentProps>(
|
|
|
64
65
|
* This method is passed to `onChange` prop of `HmsView` Native Component.
|
|
65
66
|
* It is invoked when `HmsView` emits 'topChange' event.
|
|
66
67
|
*/
|
|
67
|
-
const onChange = (
|
|
68
|
+
const onChange = ({
|
|
69
|
+
nativeEvent,
|
|
70
|
+
}: NativeSyntheticEvent<{
|
|
71
|
+
data: { height: number; width: number };
|
|
72
|
+
event: 'ON_RESOLUTION_CHANGE_EVENT';
|
|
73
|
+
}>) => {
|
|
74
|
+
const { event, data } = nativeEvent;
|
|
75
|
+
|
|
76
|
+
setApplyStyles_ANDROID(true);
|
|
77
|
+
|
|
78
|
+
if (event === 'ON_RESOLUTION_CHANGE_EVENT') {
|
|
79
|
+
setHmsViewsResolutionsState(trackId, data);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
68
82
|
|
|
69
83
|
/**
|
|
70
84
|
* This method is passed to `onDataReturned` prop of `HmsView` Native Component.
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
setHMSHLSPlayerCue,
|
|
7
7
|
setHMSHLSPlayerPlaybackError,
|
|
8
8
|
setHMSHLSPlayerPlaybackState,
|
|
9
|
+
setHMSHLSPlayerResolution,
|
|
9
10
|
setHMSHLSPlayerStats,
|
|
10
11
|
setHMSHLSPlayerStatsError,
|
|
11
12
|
} from './hooks';
|
|
@@ -198,13 +199,18 @@ const _HMSHLSPlayer: React.ForwardRefRenderFunction<
|
|
|
198
199
|
event === HMSHLSPlayerPlaybackEventTypes.ON_PLAYBACK_FAILURE_EVENT
|
|
199
200
|
) {
|
|
200
201
|
setHMSHLSPlayerPlaybackError(data.error);
|
|
202
|
+
} else if (
|
|
203
|
+
event === HMSHLSPlayerPlaybackEventTypes.ON_PLAYBACK_RESOLUTION_CHANGE_EVENT
|
|
204
|
+
) {
|
|
205
|
+
setHMSHLSPlayerResolution({...data});
|
|
206
|
+
|
|
207
|
+
const aspectRatio = data.width / data.height;
|
|
208
|
+
|
|
209
|
+
if (typeof aspectRatio === 'number' && !isNaN(aspectRatio)) {
|
|
210
|
+
setAspectRatio(aspectRatio);
|
|
211
|
+
}
|
|
201
212
|
} else {
|
|
202
213
|
setHMSHLSPlayerPlaybackState(data.state);
|
|
203
|
-
if (data.state === 'onVideoSizeChanged') {
|
|
204
|
-
if (typeof data.aspectRatio === 'number') {
|
|
205
|
-
setAspectRatio(data.aspectRatio);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
214
|
}
|
|
209
215
|
};
|
|
210
216
|
|
|
@@ -17,6 +17,10 @@ export const useHMSHLSPlayerPlaybackState = () => {
|
|
|
17
17
|
return useHMSStore((state) => state.playbackState);
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
export const useHMSHLSPlayerResolution = () => {
|
|
21
|
+
return useHMSStore((state) => state.resolution);
|
|
22
|
+
};
|
|
23
|
+
|
|
20
24
|
export const useHMSHLSPlayerStats = () => {
|
|
21
25
|
return useHMSHLSPlayerStatsStore(
|
|
22
26
|
(state) => ({
|
|
@@ -89,6 +93,9 @@ export const useHMSHLSPlayerCue = (
|
|
|
89
93
|
export const setHMSHLSPlayerPlaybackState =
|
|
90
94
|
useHMSStore.getState().setPlaybackState;
|
|
91
95
|
|
|
96
|
+
export const setHMSHLSPlayerResolution =
|
|
97
|
+
useHMSStore.getState().setResolution;
|
|
98
|
+
|
|
92
99
|
export const setHMSHLSPlayerCue = useHMSStore.getState().setCue;
|
|
93
100
|
|
|
94
101
|
export const setHMSHLSPlayerPlaybackError =
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TrackId } from '../stores/types';
|
|
2
|
+
import { useHMSStore } from '../stores/hms-store';
|
|
3
|
+
|
|
4
|
+
// use latest state (with component rerender)
|
|
5
|
+
|
|
6
|
+
export const useHmsViewsResolutionsState = (trackId?: TrackId) => {
|
|
7
|
+
return useHMSStore((state) => trackId ? state.hmsviewsResolutions[trackId] : undefined);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// state setters
|
|
11
|
+
|
|
12
|
+
export const setHmsViewsResolutionsState =
|
|
13
|
+
useHMSStore.getState().setHmsviewsResolutions;
|
package/src/index.ts
CHANGED
|
@@ -88,6 +88,7 @@ export type {
|
|
|
88
88
|
HmsViewComponent as HMSView,
|
|
89
89
|
HmsComponentProps as HMSViewProps,
|
|
90
90
|
} from './classes/HmsView';
|
|
91
|
+
export type { HMSPIPConfig } from './classes/HMSPIPConfig';
|
|
91
92
|
|
|
92
93
|
import { HMSSDK as HmsManager } from './classes/HMSSDK';
|
|
93
94
|
|
|
@@ -99,6 +100,7 @@ export * from './components/HMSHLSPlayer';
|
|
|
99
100
|
|
|
100
101
|
// 100ms Hooks
|
|
101
102
|
export * from './hooks/useHMSPeerUpdates';
|
|
103
|
+
export { useHmsViewsResolutionsState } from './hooks/hmsviews';
|
|
102
104
|
|
|
103
105
|
// 100ms types
|
|
104
106
|
export * from './types';
|
package/src/stores/hms-store.ts
CHANGED
|
@@ -2,10 +2,12 @@ import { create } from 'zustand';
|
|
|
2
2
|
import { subscribeWithSelector } from 'zustand/middleware';
|
|
3
3
|
|
|
4
4
|
import { createHMSHLSPlayerPlaybackSlice } from './hls-player-playback-slice';
|
|
5
|
+
import { createHMSViewsSlice } from './hmsviews-slice';
|
|
5
6
|
import type { HMSStore } from './types';
|
|
6
7
|
|
|
7
8
|
export const useHMSStore = create<HMSStore>()(
|
|
8
9
|
subscribeWithSelector((...a) => ({
|
|
9
10
|
...createHMSHLSPlayerPlaybackSlice(...a),
|
|
11
|
+
...createHMSViewsSlice(...a)
|
|
10
12
|
}))
|
|
11
13
|
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { StateCreator } from 'zustand';
|
|
2
|
+
|
|
3
|
+
import type { HMSViewsSlice, HMSStore } from './types';
|
|
4
|
+
|
|
5
|
+
export const createHMSViewsSlice: StateCreator<
|
|
6
|
+
HMSStore,
|
|
7
|
+
[],
|
|
8
|
+
[],
|
|
9
|
+
HMSViewsSlice
|
|
10
|
+
> = (set) => ({
|
|
11
|
+
hmsviewsResolutions: {},
|
|
12
|
+
setHmsviewsResolutions: (trackId, resolution) => {
|
|
13
|
+
set((state) => ({
|
|
14
|
+
hmsviewsResolutions: {
|
|
15
|
+
...state.hmsviewsResolutions,
|
|
16
|
+
[trackId]: resolution,
|
|
17
|
+
},
|
|
18
|
+
}));
|
|
19
|
+
},
|
|
20
|
+
});
|
package/src/stores/types.ts
CHANGED
|
@@ -4,13 +4,28 @@ import type {
|
|
|
4
4
|
HMSHLSPlayerPlaybackState,
|
|
5
5
|
HMSHLSPlayerPlaybackCueEventData,
|
|
6
6
|
HMSHLSPlayerPlaybackFailureEventData,
|
|
7
|
+
HMSHLSPlayerPlaybackResolutionChangeEventData,
|
|
7
8
|
HMSHLSPlayerStatsErrorEventData,
|
|
8
9
|
HMSHLSPlayerStatsUpdateEventData,
|
|
9
10
|
} from '../types';
|
|
10
11
|
|
|
11
|
-
export type HMSStore = HMSHLSPlayerPlaybackSlice;
|
|
12
|
+
export type HMSStore = HMSHLSPlayerPlaybackSlice & HMSViewsSlice;
|
|
12
13
|
export type HMSHLSPlayerStatsStore = HMSHLSPlayerStatsSlice;
|
|
13
14
|
|
|
15
|
+
// HMSViews Slice
|
|
16
|
+
|
|
17
|
+
export type TrackId = string;
|
|
18
|
+
|
|
19
|
+
export type Resolution = {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export interface HMSViewsSlice {
|
|
25
|
+
hmsviewsResolutions: Record<TrackId, Resolution | undefined>;
|
|
26
|
+
setHmsviewsResolutions(trackId: TrackId, resolution: Resolution): void;
|
|
27
|
+
};
|
|
28
|
+
|
|
14
29
|
// HLS Player Playback Slice
|
|
15
30
|
|
|
16
31
|
export interface HMSHLSPlayerPlaybackCue
|
|
@@ -25,12 +40,16 @@ export type HMSHLSPlayerPlaybackError =
|
|
|
25
40
|
| HMSHLSPlayerPlaybackFailureEventData['error']
|
|
26
41
|
| undefined;
|
|
27
42
|
|
|
43
|
+
export type HMSHLSPlayerResolution = HMSHLSPlayerPlaybackResolutionChangeEventData | undefined;
|
|
44
|
+
|
|
28
45
|
export interface HMSHLSPlayerPlaybackSlice {
|
|
29
46
|
cue: HMSHLSPlayerCue;
|
|
30
47
|
playbackState: HMSHLSPlayerPlaybackState;
|
|
48
|
+
resolution: HMSHLSPlayerResolution;
|
|
31
49
|
error: HMSHLSPlayerPlaybackError;
|
|
32
50
|
setCue(cue: HMSHLSPlayerPlaybackCue): void;
|
|
33
51
|
setPlaybackState(playbackState: HMSHLSPlayerPlaybackState): void;
|
|
52
|
+
setResolution(resolution: HMSHLSPlayerResolution): void;
|
|
34
53
|
setPlaybackError(error: HMSHLSPlayerPlaybackError): void;
|
|
35
54
|
}
|
|
36
55
|
|
package/src/types.ts
CHANGED
|
@@ -10,6 +10,7 @@ export enum HMSHLSPlayerPlaybackEventTypes {
|
|
|
10
10
|
ON_PLAYBACK_CUE_EVENT = 'ON_PLAYBACK_CUE_EVENT',
|
|
11
11
|
ON_PLAYBACK_FAILURE_EVENT = 'ON_PLAYBACK_FAILURE_EVENT',
|
|
12
12
|
ON_PLAYBACK_STATE_CHANGE_EVENT = 'ON_PLAYBACK_STATE_CHANGE_EVENT',
|
|
13
|
+
ON_PLAYBACK_RESOLUTION_CHANGE_EVENT = 'ON_PLAYBACK_RESOLUTION_CHANGE_EVENT',
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export type HMSHLSPlayerPlaybackCueEventData = {
|
|
@@ -34,12 +35,15 @@ export enum HMSHLSPlayerPlaybackState {
|
|
|
34
35
|
PLAYING = 'playing',
|
|
35
36
|
STOPPED = 'stopped',
|
|
36
37
|
UNKNOWN = 'unknown',
|
|
37
|
-
onVideoSizeChanged = 'onVideoSizeChanged',
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export type HMSHLSPlayerPlaybackStateChangeEventData = {
|
|
41
41
|
state: HMSHLSPlayerPlaybackState;
|
|
42
|
-
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export type HMSHLSPlayerPlaybackResolutionChangeEventData = {
|
|
45
|
+
width: number;
|
|
46
|
+
height: number;
|
|
43
47
|
};
|
|
44
48
|
|
|
45
49
|
type HMSHLSPlayerPlaybackCueEvent = HMSHLSPlayerEvent<
|
|
@@ -57,10 +61,16 @@ type HMSHLSPlayerPlaybackStateChangeEvent = HMSHLSPlayerEvent<
|
|
|
57
61
|
HMSHLSPlayerPlaybackStateChangeEventData
|
|
58
62
|
>;
|
|
59
63
|
|
|
64
|
+
type HMSHLSPLayerPlaybackResolutionChangeEvent = HMSHLSPlayerEvent<
|
|
65
|
+
HMSHLSPlayerPlaybackEventTypes.ON_PLAYBACK_RESOLUTION_CHANGE_EVENT,
|
|
66
|
+
HMSHLSPlayerPlaybackResolutionChangeEventData
|
|
67
|
+
>;
|
|
68
|
+
|
|
60
69
|
export type HMSHLSPlayerPlaybackEvent =
|
|
61
70
|
| HMSHLSPlayerPlaybackCueEvent
|
|
62
71
|
| HMSHLSPlayerPlaybackFailureEvent
|
|
63
|
-
| HMSHLSPlayerPlaybackStateChangeEvent
|
|
72
|
+
| HMSHLSPlayerPlaybackStateChangeEvent
|
|
73
|
+
| HMSHLSPLayerPlaybackResolutionChangeEvent;
|
|
64
74
|
|
|
65
75
|
// #endregion HMS HLSPlayer Playback Events
|
|
66
76
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|