@100mslive/react-native-hms 1.7.2 → 1.9.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 -0
- package/android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt +43 -15
- package/android/src/main/java/com/reactnativehmssdk/HMSHLSPlayer.kt +113 -68
- package/android/src/main/java/com/reactnativehmssdk/HMSHLSPlayerManager.kt +17 -4
- package/android/src/main/java/com/reactnativehmssdk/HMSHelper.kt +75 -21
- package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +483 -184
- package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +587 -177
- package/android/src/main/java/com/reactnativehmssdk/HMSSDKViewManager.kt +26 -7
- package/android/src/main/java/com/reactnativehmssdk/HMSView.kt +32 -12
- package/android/src/main/java/com/reactnativehmssdk/HmsScreenshareActivity.kt +1 -0
- package/android/src/main/java/com/reactnativehmssdk/PipActionReceiver.kt +10 -6
- package/android/src/main/res/layout/player_view.xml +3 -2
- package/ios/HMSConstants.swift +1 -0
- package/ios/HMSDecoder.swift +18 -7
- package/ios/HMSHLSPlayerManager.swift +18 -2
- package/ios/HMSHelper.swift +33 -4
- package/ios/HMSManager.m +256 -73
- package/ios/HMSManager.swift +47 -3
- package/ios/HMSRNSDK.swift +224 -140
- package/ios/HMSView.swift +17 -3
- 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/HMSEncoder.js +6 -0
- package/lib/commonjs/classes/HMSEncoder.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/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 +192 -32
- 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 +3 -4
- package/lib/commonjs/classes/HmsView.js.map +1 -1
- package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.js +13 -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 +5 -10
- package/lib/commonjs/components/HMSHLSPlayer/hooks.js.map +1 -1
- package/lib/commonjs/hooks/useHMSPeerUpdates.js +2 -2
- package/lib/commonjs/hooks/useHMSPeerUpdates.js.map +1 -1
- package/lib/commonjs/index.js +1 -2
- package/lib/commonjs/index.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 +1 -2
- package/lib/commonjs/stores/hms-store.js.map +1 -1
- package/lib/commonjs/types.js +4 -6
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/classes/HMSEncoder.js +6 -0
- package/lib/module/classes/HMSEncoder.js.map +1 -1
- 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 +193 -33
- 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/components/HMSHLSPlayer/HMSHLSPlayer.js +11 -6
- package/lib/module/components/HMSHLSPlayer/HMSHLSPlayer.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +1 -0
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/classes/HMSEncoder.d.ts +1 -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 +69 -13
- package/lib/typescript/classes/HMSUpdateListenerActions.d.ts +2 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/types.d.ts +3 -1
- package/package.json +1 -1
- package/sdk-versions.json +2 -2
- package/src/classes/HMSEncoder.ts +9 -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 +235 -28
- package/src/classes/HMSUpdateListenerActions.ts +1 -0
- package/src/components/HMSHLSPlayer/HMSHLSPlayer.tsx +15 -13
- package/src/index.ts +4 -1
- package/src/types.ts +2 -0
- 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
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* options for creating `HMSPeerListIterator` instance
|
|
3
|
+
*
|
|
4
|
+
* ```
|
|
5
|
+
* const peerListIterator = hmsInstance.getPeerListIterator({
|
|
6
|
+
* limit: 10,
|
|
7
|
+
* byRoleName: 'viewer-realtime',
|
|
8
|
+
* });
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export interface HMSPeerListIteratorOptions {
|
|
12
|
+
/**
|
|
13
|
+
* filter by role of the peers
|
|
14
|
+
*/
|
|
15
|
+
byRoleName?: string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* `peerID`s of the peers you want to fetch with iterator.
|
|
19
|
+
*/
|
|
20
|
+
byPeerIds?: string[];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* number of peers fetched by the iterator in `next` method call. Default value is `10`
|
|
24
|
+
*/
|
|
25
|
+
limit?: number;
|
|
26
|
+
}
|
|
@@ -5,6 +5,7 @@ export enum HMSPeerUpdate {
|
|
|
5
5
|
ROLE_CHANGED = 'ROLE_CHANGED',
|
|
6
6
|
NAME_CHANGED = 'NAME_CHANGED',
|
|
7
7
|
NETWORK_QUALITY_UPDATED = 'NETWORK_QUALITY_UPDATED',
|
|
8
|
+
HAND_RAISED_CHANGED = 'HAND_RAISED_CHANGED',
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export const HMSPeerUpdateOrdinals = new Map([
|
|
@@ -14,4 +15,5 @@ export const HMSPeerUpdateOrdinals = new Map([
|
|
|
14
15
|
['5', HMSPeerUpdate.NAME_CHANGED],
|
|
15
16
|
['6', HMSPeerUpdate.METADATA_CHANGED],
|
|
16
17
|
['7', HMSPeerUpdate.NETWORK_QUALITY_UPDATED],
|
|
18
|
+
['8', HMSPeerUpdate.HAND_RAISED_CHANGED],
|
|
17
19
|
]);
|
|
@@ -39,6 +39,7 @@ export type HMSPeerCacheProps = {
|
|
|
39
39
|
audioTrack?: HMSAudioTrack | undefined;
|
|
40
40
|
videoTrack?: HMSVideoTrack | undefined;
|
|
41
41
|
auxiliaryTracks?: HMSTrack[] | undefined;
|
|
42
|
+
isHandRaised?: boolean | undefined;
|
|
42
43
|
};
|
|
43
44
|
|
|
44
45
|
export class HMSPeersCache {
|
|
@@ -206,6 +207,10 @@ export class HMSPeersCache {
|
|
|
206
207
|
updatedObj.name = data.name;
|
|
207
208
|
break;
|
|
208
209
|
}
|
|
210
|
+
case HMSPeerUpdate.HAND_RAISED_CHANGED: {
|
|
211
|
+
updatedObj.isHandRaised = data.isHandRaised;
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
209
214
|
default: {
|
|
210
215
|
updatedObj = { ...updatedObj, ...data };
|
|
211
216
|
break;
|
|
@@ -256,6 +261,8 @@ export function getPeerPropertyFromNative<T extends keyof HMSPeerCacheProps>(
|
|
|
256
261
|
: undefined;
|
|
257
262
|
} else if (property === 'name') {
|
|
258
263
|
value = data?.[property];
|
|
264
|
+
} else if (property === 'isHandRaised') {
|
|
265
|
+
value = data ? data[property] : false;
|
|
259
266
|
} else {
|
|
260
267
|
value = data ? data[property] : undefined;
|
|
261
268
|
}
|
package/src/classes/HMSSDK.tsx
CHANGED
|
@@ -41,13 +41,16 @@ 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';
|
|
46
48
|
|
|
47
49
|
type HmsViewProps = Omit<HmsComponentProps, 'id'>;
|
|
48
50
|
|
|
49
51
|
// TODO: Rename to HMSPIPConfig & to be moved to a separate file
|
|
50
52
|
interface PIPConfig {
|
|
53
|
+
autoEnterPipMode?: boolean;
|
|
51
54
|
aspectRatio?: [number, number];
|
|
52
55
|
endButton?: boolean;
|
|
53
56
|
audioButton?: boolean;
|
|
@@ -66,6 +69,7 @@ export class HMSSDK {
|
|
|
66
69
|
private onJoinDelegate?: any;
|
|
67
70
|
private onRoomDelegate?: any;
|
|
68
71
|
private onPeerDelegate?: any;
|
|
72
|
+
private onPeerListUpdatedDelegate?: any;
|
|
69
73
|
private onTrackDelegate?: any;
|
|
70
74
|
private onErrorDelegate?: any;
|
|
71
75
|
private onMessageDelegate?: any;
|
|
@@ -83,6 +87,7 @@ export class HMSSDK {
|
|
|
83
87
|
private onAudioDeviceChangedDelegate?: any;
|
|
84
88
|
private onSessionStoreAvailableDelegate?: any;
|
|
85
89
|
private onPIPRoomLeaveDelegate?: any;
|
|
90
|
+
private onPIPModeChangedDelegate?: any;
|
|
86
91
|
|
|
87
92
|
private emitterSubscriptions: Partial<
|
|
88
93
|
Record<
|
|
@@ -207,30 +212,6 @@ export class HMSSDK {
|
|
|
207
212
|
HMSManager.preview({ ...config, id: this.id });
|
|
208
213
|
};
|
|
209
214
|
|
|
210
|
-
/**
|
|
211
|
-
* - previewForRole can be used when there is role change request for current localPeer and we want
|
|
212
|
-
* to show the localPeer how the tracks look before publishing them to room.
|
|
213
|
-
*
|
|
214
|
-
* - It requires a role of type [HMSRole]{@link HMSRole} for which we want to preview the tracks.
|
|
215
|
-
*
|
|
216
|
-
* checkout {@link https://www.100ms.live/docs/react-native} for more info
|
|
217
|
-
*
|
|
218
|
-
* @param {HMSRole}
|
|
219
|
-
* @memberof HMSSDK
|
|
220
|
-
*/
|
|
221
|
-
previewForRole = async (role: HMSRole) => {
|
|
222
|
-
logger?.verbose('#Function previewForRole', {
|
|
223
|
-
role,
|
|
224
|
-
id: this.id,
|
|
225
|
-
});
|
|
226
|
-
if (Platform.OS === 'ios') {
|
|
227
|
-
return await HMSManager.previewForRole({ role: role?.name, id: this.id });
|
|
228
|
-
} else {
|
|
229
|
-
console.log('API currently not available for android');
|
|
230
|
-
return 'API currently not available for android';
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
|
-
|
|
234
215
|
/**
|
|
235
216
|
* - HmsView is react component that takes trackId and starts showing that track on a tile.
|
|
236
217
|
* - The appearance of tile is completely customizable with style prop.
|
|
@@ -656,6 +637,54 @@ export class HMSSDK {
|
|
|
656
637
|
return await HMSManager.changeName(data);
|
|
657
638
|
};
|
|
658
639
|
|
|
640
|
+
/**
|
|
641
|
+
* -Preview for a specific Role before changing it.
|
|
642
|
+
*
|
|
643
|
+
* By previewing before doing a Role Change, users can see their expected Audio & Video tracks which will be visible to other Peers in Room post changing the Role.
|
|
644
|
+
*
|
|
645
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/peer/change-role} for more info
|
|
646
|
+
*
|
|
647
|
+
* @param {role: string}
|
|
648
|
+
* @memberof HMSSDK
|
|
649
|
+
*/
|
|
650
|
+
previewForRole = async (role: string) => {
|
|
651
|
+
logger?.verbose('#Function previewForRole', {
|
|
652
|
+
role,
|
|
653
|
+
id: this.id,
|
|
654
|
+
});
|
|
655
|
+
const data = await HMSManager.previewForRole({
|
|
656
|
+
role,
|
|
657
|
+
id: this.id,
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
const previewTracks = HMSEncoder.encodeHmsPreviewForRoleTracks(
|
|
661
|
+
data.tracks,
|
|
662
|
+
this.id
|
|
663
|
+
);
|
|
664
|
+
|
|
665
|
+
return previewTracks;
|
|
666
|
+
};
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Cancel the Previewing for Role invocation.
|
|
670
|
+
*
|
|
671
|
+
* If a [previewForRole] call was performed previously then calling this method clears the tracks created anticipating a Change of Role
|
|
672
|
+
*
|
|
673
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/peer/change-role} for more info
|
|
674
|
+
*
|
|
675
|
+
* @memberof HMSSDK
|
|
676
|
+
*/
|
|
677
|
+
cancelPreview = async () => {
|
|
678
|
+
logger?.verbose('#Function cancelPreview', {
|
|
679
|
+
id: this.id,
|
|
680
|
+
});
|
|
681
|
+
const data: { data: string } = await HMSManager.cancelPreview({
|
|
682
|
+
id: this.id,
|
|
683
|
+
});
|
|
684
|
+
|
|
685
|
+
return data;
|
|
686
|
+
};
|
|
687
|
+
|
|
659
688
|
/**
|
|
660
689
|
* - Calling this function will accept the most recent roleChange request made by anyone in the room
|
|
661
690
|
*
|
|
@@ -1121,6 +1150,86 @@ export class HMSSDK {
|
|
|
1121
1150
|
return HMSEncoder.encodeHmsPeer({ peerID: peerId });
|
|
1122
1151
|
};
|
|
1123
1152
|
|
|
1153
|
+
/**
|
|
1154
|
+
* - This function is used to raise hand for the local peer
|
|
1155
|
+
* @memberof HMSSDK
|
|
1156
|
+
*/
|
|
1157
|
+
raiseLocalPeerHand = async () => {
|
|
1158
|
+
const data = {
|
|
1159
|
+
id: this.id,
|
|
1160
|
+
};
|
|
1161
|
+
logger?.verbose('#Function raiseLocalPeerHand', data);
|
|
1162
|
+
return HMSManager.raiseLocalPeerHand(data);
|
|
1163
|
+
};
|
|
1164
|
+
|
|
1165
|
+
/**
|
|
1166
|
+
* - This function is used to lower hand for the local peer
|
|
1167
|
+
* @memberof HMSSDK
|
|
1168
|
+
*/
|
|
1169
|
+
lowerLocalPeerHand = async () => {
|
|
1170
|
+
const data = {
|
|
1171
|
+
id: this.id,
|
|
1172
|
+
};
|
|
1173
|
+
logger?.verbose('#Function lowerLocalPeerHand', data);
|
|
1174
|
+
return HMSManager.lowerLocalPeerHand(data);
|
|
1175
|
+
};
|
|
1176
|
+
|
|
1177
|
+
/**
|
|
1178
|
+
* - This function is used to lower hand for the remote peer
|
|
1179
|
+
* @param peer
|
|
1180
|
+
*/
|
|
1181
|
+
lowerRemotePeerHand = async (peer: HMSPeer) => {
|
|
1182
|
+
const data = {
|
|
1183
|
+
peerId: peer.peerID,
|
|
1184
|
+
id: this.id,
|
|
1185
|
+
};
|
|
1186
|
+
logger?.verbose('#Function lowerRemotePeerHand', data);
|
|
1187
|
+
return HMSManager.lowerRemotePeerHand(data);
|
|
1188
|
+
};
|
|
1189
|
+
|
|
1190
|
+
/**
|
|
1191
|
+
* `getPeerListIterator` method returns an instance of `HMSPeerListIterator` class
|
|
1192
|
+
*
|
|
1193
|
+
* @param options options for configuring iterator
|
|
1194
|
+
* @returns instance of HMSPeerListIterator class
|
|
1195
|
+
*
|
|
1196
|
+
* Example usage:
|
|
1197
|
+
* ```
|
|
1198
|
+
* const peerListIterator = hmsInstance.getPeerListIterator();
|
|
1199
|
+
* ```
|
|
1200
|
+
* OR
|
|
1201
|
+
* ```
|
|
1202
|
+
* const peerListIterator = hmsInstance.getPeerListIterator({
|
|
1203
|
+
* limit: 10,
|
|
1204
|
+
* byRoleName: 'viewer-realtime',
|
|
1205
|
+
* });
|
|
1206
|
+
* ```
|
|
1207
|
+
*/
|
|
1208
|
+
getPeerListIterator = (
|
|
1209
|
+
options?: HMSPeerListIteratorOptions
|
|
1210
|
+
): HMSPeerListIterator => {
|
|
1211
|
+
logger?.verbose('#Function getPeerListIterator', {
|
|
1212
|
+
id: this.id,
|
|
1213
|
+
options,
|
|
1214
|
+
});
|
|
1215
|
+
|
|
1216
|
+
const uniqueId = Math.random().toString(16).slice(2);
|
|
1217
|
+
|
|
1218
|
+
const data: null | { sucess: boolean; uniqueId: string; totalCount: number; } =
|
|
1219
|
+
HMSManager.getPeerListIterator({
|
|
1220
|
+
id: this.id,
|
|
1221
|
+
...options,
|
|
1222
|
+
limit: options?.limit ?? 10,
|
|
1223
|
+
uniqueId,
|
|
1224
|
+
});
|
|
1225
|
+
|
|
1226
|
+
if (!data) {
|
|
1227
|
+
throw new Error('Unable to create PeerListIterator');
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
return new HMSPeerListIterator(data.uniqueId, data.totalCount);
|
|
1231
|
+
};
|
|
1232
|
+
|
|
1124
1233
|
/**
|
|
1125
1234
|
* - This is a prototype event listener that takes action and listens for updates related to that particular action
|
|
1126
1235
|
*
|
|
@@ -1205,6 +1314,28 @@ export class HMSSDK {
|
|
|
1205
1314
|
this.onPeerDelegate = callback;
|
|
1206
1315
|
break;
|
|
1207
1316
|
}
|
|
1317
|
+
case HMSUpdateListenerActions.ON_PEER_LIST_UPDATED: {
|
|
1318
|
+
// Checking if we already have ON_PEER_LIST_UPDATED subscription
|
|
1319
|
+
if (
|
|
1320
|
+
!this.emitterSubscriptions[
|
|
1321
|
+
HMSUpdateListenerActions.ON_PEER_LIST_UPDATED
|
|
1322
|
+
]
|
|
1323
|
+
) {
|
|
1324
|
+
// Adding ON_PEER_LIST_UPDATED native listener
|
|
1325
|
+
const peerListUpdatedSubscription =
|
|
1326
|
+
HMSNativeEventListener.addListener(
|
|
1327
|
+
this.id,
|
|
1328
|
+
HMSUpdateListenerActions.ON_PEER_LIST_UPDATED,
|
|
1329
|
+
this.onPeerListUpdatedListener
|
|
1330
|
+
);
|
|
1331
|
+
this.emitterSubscriptions[
|
|
1332
|
+
HMSUpdateListenerActions.ON_PEER_LIST_UPDATED
|
|
1333
|
+
] = peerListUpdatedSubscription;
|
|
1334
|
+
}
|
|
1335
|
+
// Adding App Delegate listener
|
|
1336
|
+
this.onPeerListUpdatedDelegate = callback;
|
|
1337
|
+
break;
|
|
1338
|
+
}
|
|
1208
1339
|
case HMSUpdateListenerActions.ON_TRACK_UPDATE: {
|
|
1209
1340
|
// Checking if we already have ON_TRACK_UPDATE subscription
|
|
1210
1341
|
if (
|
|
@@ -1530,6 +1661,25 @@ export class HMSSDK {
|
|
|
1530
1661
|
}
|
|
1531
1662
|
break;
|
|
1532
1663
|
}
|
|
1664
|
+
case HMSPIPListenerActions.ON_PIP_MODE_CHANGED: {
|
|
1665
|
+
if (Platform.OS === 'android') {
|
|
1666
|
+
// Checking if we already have ON_PIP_MODE_CHANGED subscription
|
|
1667
|
+
if (
|
|
1668
|
+
!this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_MODE_CHANGED]
|
|
1669
|
+
) {
|
|
1670
|
+
const pipModeChangedSubscription = HMSNativeEventListener.addListener(
|
|
1671
|
+
this.id,
|
|
1672
|
+
HMSPIPListenerActions.ON_PIP_MODE_CHANGED,
|
|
1673
|
+
this.onPIPModeChangedListener
|
|
1674
|
+
);
|
|
1675
|
+
this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_MODE_CHANGED] =
|
|
1676
|
+
pipModeChangedSubscription;
|
|
1677
|
+
}
|
|
1678
|
+
// Adding PIP mode changed Delegate listener
|
|
1679
|
+
this.onPIPModeChangedDelegate = callback;
|
|
1680
|
+
}
|
|
1681
|
+
break;
|
|
1682
|
+
}
|
|
1533
1683
|
default:
|
|
1534
1684
|
}
|
|
1535
1685
|
};
|
|
@@ -1869,6 +2019,22 @@ export class HMSSDK {
|
|
|
1869
2019
|
}
|
|
1870
2020
|
break;
|
|
1871
2021
|
}
|
|
2022
|
+
case HMSPIPListenerActions.ON_PIP_MODE_CHANGED: {
|
|
2023
|
+
if (Platform.OS === 'android') {
|
|
2024
|
+
const subscription =
|
|
2025
|
+
this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_MODE_CHANGED];
|
|
2026
|
+
// Removing ON_PIP_MODE_CHANGED native listener
|
|
2027
|
+
if (subscription) {
|
|
2028
|
+
subscription.remove();
|
|
2029
|
+
|
|
2030
|
+
this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_MODE_CHANGED] =
|
|
2031
|
+
undefined;
|
|
2032
|
+
}
|
|
2033
|
+
// Removing App Delegate listener
|
|
2034
|
+
this.onPIPModeChangedDelegate = null;
|
|
2035
|
+
}
|
|
2036
|
+
break;
|
|
2037
|
+
}
|
|
1872
2038
|
default:
|
|
1873
2039
|
}
|
|
1874
2040
|
};
|
|
@@ -1991,8 +2157,15 @@ export class HMSSDK {
|
|
|
1991
2157
|
const peer: HMSPeer = HMSEncoder.encodeHmsPeer(data.peer);
|
|
1992
2158
|
const type = HMSEncoder.encodeHmsPeerUpdate(data.type) || data.type;
|
|
1993
2159
|
|
|
1994
|
-
|
|
2160
|
+
if (type === HMSPeerUpdate.PEER_LEFT) {
|
|
2161
|
+
this.sendPeerUpdateWhenPeerLeaves(data, peer, type);
|
|
2162
|
+
} else {
|
|
2163
|
+
getHmsPeersCache()?.updatePeerCache(data.peer.peerID, data.peer, type);
|
|
2164
|
+
this.sendPeerUpdate(peer, type);
|
|
2165
|
+
}
|
|
2166
|
+
};
|
|
1995
2167
|
|
|
2168
|
+
private sendPeerUpdate = (peer: any, type: any) => {
|
|
1996
2169
|
if (this.onPeerDelegate) {
|
|
1997
2170
|
logger?.verbose('#Listener ON_PEER_LISTENER_CALL', {
|
|
1998
2171
|
peer,
|
|
@@ -2000,6 +2173,32 @@ export class HMSSDK {
|
|
|
2000
2173
|
});
|
|
2001
2174
|
this.onPeerDelegate({ peer, type });
|
|
2002
2175
|
}
|
|
2176
|
+
}
|
|
2177
|
+
|
|
2178
|
+
private sendPeerUpdateWhenPeerLeaves = (data: any, peer: any, type: any) => {
|
|
2179
|
+
this.sendPeerUpdate(peer, type);
|
|
2180
|
+
|
|
2181
|
+
getHmsPeersCache()?.updatePeerCache(data.peer.peerID, data.peer, type);
|
|
2182
|
+
}
|
|
2183
|
+
|
|
2184
|
+
onPeerListUpdatedListener = (data: any) => {
|
|
2185
|
+
if (data.id !== this.id) {
|
|
2186
|
+
return;
|
|
2187
|
+
}
|
|
2188
|
+
const addedPeers = HMSEncoder.encodeHmsPeers(data.addedPeers);
|
|
2189
|
+
const removedPeers = HMSEncoder.encodeHmsPeers(data.removedPeers);
|
|
2190
|
+
|
|
2191
|
+
if (this.onPeerListUpdatedDelegate) {
|
|
2192
|
+
logger?.verbose('#Listener ON_PEER_LIST_UPDATED_LISTENER_CALL', {
|
|
2193
|
+
totalAddedPeers: addedPeers.length,
|
|
2194
|
+
totalRemovedPeers: removedPeers.length,
|
|
2195
|
+
});
|
|
2196
|
+
|
|
2197
|
+
this.onPeerListUpdatedDelegate({
|
|
2198
|
+
addedPeers,
|
|
2199
|
+
removedPeers,
|
|
2200
|
+
});
|
|
2201
|
+
}
|
|
2003
2202
|
};
|
|
2004
2203
|
|
|
2005
2204
|
onTrackListener = (data: any) => {
|
|
@@ -2300,12 +2499,20 @@ export class HMSSDK {
|
|
|
2300
2499
|
}
|
|
2301
2500
|
};
|
|
2302
2501
|
|
|
2502
|
+
onPIPModeChangedListener = (data: { isInPictureInPictureMode: boolean }) => {
|
|
2503
|
+
if (this.onPIPModeChangedDelegate) {
|
|
2504
|
+
logger?.verbose('#Listener onPIPModeChanged_CALL', data);
|
|
2505
|
+
|
|
2506
|
+
this.onPIPModeChangedDelegate(data);
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2509
|
+
|
|
2303
2510
|
async isPipModeSupported(): Promise<undefined | boolean> {
|
|
2304
2511
|
return HMSManager.handlePipActions('isPipModeSupported', { id: this.id });
|
|
2305
2512
|
}
|
|
2306
2513
|
|
|
2307
|
-
async
|
|
2308
|
-
return HMSManager.handlePipActions('
|
|
2514
|
+
async enterPipMode(data?: PIPConfig): Promise<undefined | boolean> {
|
|
2515
|
+
return HMSManager.handlePipActions('enterPipMode', {
|
|
2309
2516
|
...data,
|
|
2310
2517
|
id: this.id,
|
|
2311
2518
|
});
|
|
@@ -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
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useImperativeHandle, useRef } from 'react';
|
|
1
|
+
import React, { useImperativeHandle, useRef, useState } from 'react';
|
|
2
2
|
import { View, StyleSheet, UIManager, findNodeHandle } from 'react-native';
|
|
3
3
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
4
4
|
|
|
@@ -50,18 +50,13 @@ const _HMSHLSPlayer: React.ForwardRefRenderFunction<
|
|
|
50
50
|
HMSHLSPlayerRefProperties,
|
|
51
51
|
HMSHLSPlayerProps
|
|
52
52
|
> = (
|
|
53
|
-
{
|
|
54
|
-
url = '',
|
|
55
|
-
style,
|
|
56
|
-
containerStyle,
|
|
57
|
-
aspectRatio = 9 / 16,
|
|
58
|
-
enableStats,
|
|
59
|
-
enableControls = false,
|
|
60
|
-
},
|
|
53
|
+
{ url = '', style, containerStyle, enableStats, enableControls = false },
|
|
61
54
|
ref
|
|
62
55
|
) => {
|
|
63
56
|
const hmsHlsPlayerRef = useRef<RCTHMSHLSPlayerRef | null>(null);
|
|
64
57
|
|
|
58
|
+
const [aspectRatio, setAspectRatio] = useState(16 / 9);
|
|
59
|
+
|
|
65
60
|
useImperativeHandle(
|
|
66
61
|
ref,
|
|
67
62
|
() => ({
|
|
@@ -205,6 +200,11 @@ const _HMSHLSPlayer: React.ForwardRefRenderFunction<
|
|
|
205
200
|
setHMSHLSPlayerPlaybackError(data.error);
|
|
206
201
|
} else {
|
|
207
202
|
setHMSHLSPlayerPlaybackState(data.state);
|
|
203
|
+
if (data.state === 'onVideoSizeChanged') {
|
|
204
|
+
if (typeof data.aspectRatio === 'number') {
|
|
205
|
+
setAspectRatio(data.aspectRatio);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
208
|
}
|
|
209
209
|
};
|
|
210
210
|
|
|
@@ -225,7 +225,10 @@ const _HMSHLSPlayer: React.ForwardRefRenderFunction<
|
|
|
225
225
|
<RCTHMSHLSPlayer
|
|
226
226
|
ref={hmsHlsPlayerRef}
|
|
227
227
|
url={url}
|
|
228
|
-
style={[
|
|
228
|
+
style={[
|
|
229
|
+
styles.player,
|
|
230
|
+
{ aspectRatio: aspectRatio, flex: aspectRatio < 1 ? 1 : undefined },
|
|
231
|
+
]}
|
|
229
232
|
enableStats={enableStats}
|
|
230
233
|
enableControls={enableControls}
|
|
231
234
|
onHmsHlsPlaybackEvent={handleHLSPlaybackEvent}
|
|
@@ -254,8 +257,7 @@ const styles = StyleSheet.create({
|
|
|
254
257
|
},
|
|
255
258
|
player: {
|
|
256
259
|
width: '100%',
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
aspectRatio: 9 / 16,
|
|
260
|
+
aspectRatio: 16 / 9,
|
|
261
|
+
flex: 1,
|
|
260
262
|
},
|
|
261
263
|
});
|
package/src/index.ts
CHANGED
|
@@ -84,7 +84,10 @@ export type {
|
|
|
84
84
|
HMSSessionStore,
|
|
85
85
|
HMSSessionStoreValue,
|
|
86
86
|
} from './classes/HMSSessionStore';
|
|
87
|
-
export type {
|
|
87
|
+
export type {
|
|
88
|
+
HmsViewComponent as HMSView,
|
|
89
|
+
HmsComponentProps as HMSViewProps,
|
|
90
|
+
} from './classes/HmsView';
|
|
88
91
|
|
|
89
92
|
import { HMSSDK as HmsManager } from './classes/HMSSDK';
|
|
90
93
|
|
package/src/types.ts
CHANGED
|
@@ -34,10 +34,12 @@ export enum HMSHLSPlayerPlaybackState {
|
|
|
34
34
|
PLAYING = 'playing',
|
|
35
35
|
STOPPED = 'stopped',
|
|
36
36
|
UNKNOWN = 'unknown',
|
|
37
|
+
onVideoSizeChanged = 'onVideoSizeChanged',
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
export type HMSHLSPlayerPlaybackStateChangeEventData = {
|
|
40
41
|
state: HMSHLSPlayerPlaybackState;
|
|
42
|
+
aspectRatio: number | undefined;
|
|
41
43
|
};
|
|
42
44
|
|
|
43
45
|
type HMSHLSPlayerPlaybackCueEvent = HMSHLSPlayerEvent<
|
|
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
|