@100mslive/react-native-hms 1.7.1 → 1.8.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/.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/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/6.7.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- 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/local.properties +1 -0
- package/android/src/main/java/com/reactnativehmssdk/HMSAudioshareActivity.kt +1 -0
- package/android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt +40 -18
- 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 +34 -18
- package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +363 -159
- package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +367 -151
- 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/HMSDecoder.swift +5 -7
- package/ios/HMSHLSPlayerManager.swift +18 -2
- package/ios/HMSManager.m +227 -70
- package/ios/HMSManager.swift +2 -2
- package/ios/HMSRNSDK.swift +67 -126
- package/ios/HMSView.swift +17 -3
- package/lib/commonjs/classes/HMSEncoder.js +15 -6
- package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
- package/lib/commonjs/classes/HMSHelper.js +1 -1
- package/lib/commonjs/classes/HMSHelper.js.map +1 -1
- package/lib/commonjs/classes/HMSLocalAudioTrack.js +2 -2
- package/lib/commonjs/classes/HMSLocalAudioTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSLocalPeer.js.map +1 -1
- package/lib/commonjs/classes/HMSLocalVideoTrack.js +2 -2
- package/lib/commonjs/classes/HMSLocalVideoTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSLogger.js +4 -4
- package/lib/commonjs/classes/HMSLogger.js.map +1 -1
- package/lib/commonjs/classes/HMSMessage.js.map +1 -1
- package/lib/commonjs/classes/HMSNativeEventEmitter.js +6 -6
- package/lib/commonjs/classes/HMSNativeEventEmitter.js.map +1 -1
- package/lib/commonjs/classes/HMSPeer.js +2 -15
- package/lib/commonjs/classes/HMSPeer.js.map +1 -1
- package/lib/commonjs/classes/HMSRemoteAudioTrack.js +2 -2
- package/lib/commonjs/classes/HMSRemoteAudioTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSRemotePeer.js.map +1 -1
- package/lib/commonjs/classes/HMSRemoteVideoTrack.js +5 -5
- package/lib/commonjs/classes/HMSRemoteVideoTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSSDK.js +126 -112
- package/lib/commonjs/classes/HMSSDK.js.map +1 -1
- package/lib/commonjs/classes/HMSSessionStore.js +3 -3
- package/lib/commonjs/classes/HMSSessionStore.js.map +1 -1
- package/lib/commonjs/classes/HmsView.js +0 -3
- package/lib/commonjs/classes/HmsView.js.map +1 -1
- package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.js +10 -5
- package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.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 +0 -12
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.js +1 -0
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/classes/HMSEncoder.js +15 -6
- package/lib/module/classes/HMSEncoder.js.map +1 -1
- package/lib/module/classes/HMSHelper.js +1 -1
- package/lib/module/classes/HMSHelper.js.map +1 -1
- package/lib/module/classes/HMSLocalAudioTrack.js +2 -2
- package/lib/module/classes/HMSLocalAudioTrack.js.map +1 -1
- package/lib/module/classes/HMSLocalPeer.js.map +1 -1
- package/lib/module/classes/HMSLocalVideoTrack.js +2 -2
- package/lib/module/classes/HMSLocalVideoTrack.js.map +1 -1
- package/lib/module/classes/HMSLogger.js +4 -4
- package/lib/module/classes/HMSLogger.js.map +1 -1
- package/lib/module/classes/HMSMessage.js.map +1 -1
- package/lib/module/classes/HMSNativeEventEmitter.js +6 -6
- package/lib/module/classes/HMSNativeEventEmitter.js.map +1 -1
- package/lib/module/classes/HMSPeer.js +2 -15
- package/lib/module/classes/HMSPeer.js.map +1 -1
- package/lib/module/classes/HMSRemoteAudioTrack.js +2 -2
- package/lib/module/classes/HMSRemoteAudioTrack.js.map +1 -1
- package/lib/module/classes/HMSRemotePeer.js.map +1 -1
- package/lib/module/classes/HMSRemoteVideoTrack.js +5 -5
- package/lib/module/classes/HMSRemoteVideoTrack.js.map +1 -1
- package/lib/module/classes/HMSSDK.js +126 -112
- package/lib/module/classes/HMSSDK.js.map +1 -1
- package/lib/module/classes/HMSSessionStore.js +3 -3
- package/lib/module/classes/HMSSessionStore.js.map +1 -1
- package/lib/module/classes/HmsView.js +0 -3
- package/lib/module/classes/HmsView.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/hooks/useHMSPeerUpdates.js +2 -2
- package/lib/module/hooks/useHMSPeerUpdates.js.map +1 -1
- package/lib/module/index.js +0 -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/HMSLocalPeer.d.ts +1 -0
- package/lib/typescript/classes/HMSMessage.d.ts +2 -3
- package/lib/typescript/classes/HMSPeer.d.ts +2 -3
- package/lib/typescript/classes/HMSRemotePeer.d.ts +1 -0
- package/lib/typescript/classes/HMSSDK.d.ts +29 -18
- package/lib/typescript/index.d.ts +1 -2
- package/lib/typescript/types.d.ts +3 -1
- package/package.json +2 -2
- package/sdk-versions.json +2 -2
- package/src/classes/HMSEncoder.ts +12 -0
- package/src/classes/HMSLocalPeer.ts +1 -0
- package/src/classes/HMSMessage.ts +2 -3
- package/src/classes/HMSPeer.ts +3 -26
- package/src/classes/HMSRemotePeer.ts +1 -0
- package/src/classes/HMSSDK.tsx +54 -33
- package/src/classes/HmsView.tsx +0 -4
- package/src/components/HMSHLSPlayer/HMSHLSPlayer.tsx +15 -13
- package/src/index.ts +4 -2
- package/src/types.ts +2 -0
- package/lib/commonjs/classes/HMSMessageType.js +0 -13
- package/lib/commonjs/classes/HMSMessageType.js.map +0 -1
- package/lib/module/classes/HMSMessageType.js +0 -6
- package/lib/module/classes/HMSMessageType.js.map +0 -1
- package/lib/typescript/classes/HMSMessageType.d.ts +0 -4
- package/src/classes/HMSMessageType.ts +0 -4
|
@@ -39,6 +39,7 @@ import { HMSRemoteVideoStats } from './HMSRemoteVideoStats';
|
|
|
39
39
|
import { HMSLayer } from './HMSLayer';
|
|
40
40
|
import { HMSSimulcastLayerDefinition } from './HMSSimulcastLayerDefinition';
|
|
41
41
|
import { HMSQualityLimitationReasons } from './HMSQualityLimitationReasons';
|
|
42
|
+
import { HMSTrackType } from './HMSTrackType';
|
|
42
43
|
|
|
43
44
|
interface InitialData {
|
|
44
45
|
roles: Record<string, HMSRole>;
|
|
@@ -93,6 +94,7 @@ export class HMSEncoder {
|
|
|
93
94
|
static encodeHmsPeer(peer: any) {
|
|
94
95
|
const encodedObj = {
|
|
95
96
|
peerID: peer?.peerID,
|
|
97
|
+
name: peer?.name,
|
|
96
98
|
};
|
|
97
99
|
|
|
98
100
|
return new HMSPeer(encodedObj);
|
|
@@ -153,6 +155,7 @@ export class HMSEncoder {
|
|
|
153
155
|
static encodeHmsLocalPeer(peer: any, id: string) {
|
|
154
156
|
const encodedObj = {
|
|
155
157
|
peerID: peer?.peerID,
|
|
158
|
+
name: peer?.name,
|
|
156
159
|
localAudioTrackData: peer?.localAudioTrackData?.trackId
|
|
157
160
|
? {
|
|
158
161
|
id: id,
|
|
@@ -266,6 +269,7 @@ export class HMSEncoder {
|
|
|
266
269
|
static encodeHmsRemotePeer(peer: any, id: string) {
|
|
267
270
|
const encodedObj = {
|
|
268
271
|
peerID: peer?.peerID,
|
|
272
|
+
name: peer?.name,
|
|
269
273
|
remoteAudioTrackData: peer?.remoteAudioTrackData?.trackId
|
|
270
274
|
? {
|
|
271
275
|
id: id,
|
|
@@ -323,6 +327,14 @@ export class HMSEncoder {
|
|
|
323
327
|
});
|
|
324
328
|
}
|
|
325
329
|
|
|
330
|
+
static encodeHmsPreviewForRoleTracks(previewTracks: any[], id: string) {
|
|
331
|
+
return previewTracks?.map((track) => {
|
|
332
|
+
return track.type === HMSTrackType.VIDEO
|
|
333
|
+
? this.encodeHmsLocalVideoTrack(track, id)
|
|
334
|
+
: this.encodeHmsLocalAudioTrack(track, id);
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
|
|
326
338
|
static encodeHmsRoles(roles: any[]) {
|
|
327
339
|
const encodedRoles: HMSRole[] = [];
|
|
328
340
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { HMSMessageRecipient } from './HMSMessageRecipient';
|
|
2
|
-
import type { HMSMessageType } from './HMSMessageType';
|
|
3
2
|
import type { HMSPeer } from './HMSPeer';
|
|
4
3
|
|
|
5
4
|
export class HMSMessage {
|
|
6
5
|
public message: string;
|
|
7
6
|
public messageId: string;
|
|
8
|
-
public type:
|
|
7
|
+
public type: string;
|
|
9
8
|
public time: Date;
|
|
10
9
|
public sender?: HMSPeer;
|
|
11
10
|
public recipient: HMSMessageRecipient;
|
|
@@ -13,7 +12,7 @@ export class HMSMessage {
|
|
|
13
12
|
constructor(params: {
|
|
14
13
|
message: string;
|
|
15
14
|
messageId: string;
|
|
16
|
-
type:
|
|
15
|
+
type: string;
|
|
17
16
|
time: Date;
|
|
18
17
|
sender?: HMSPeer;
|
|
19
18
|
recipient: HMSMessageRecipient;
|
package/src/classes/HMSPeer.ts
CHANGED
|
@@ -8,19 +8,12 @@ import { HMSConstants } from './HMSConstants';
|
|
|
8
8
|
|
|
9
9
|
export class HMSPeer {
|
|
10
10
|
peerID: string;
|
|
11
|
-
|
|
11
|
+
name: string;
|
|
12
12
|
private _isLocal: boolean | undefined;
|
|
13
13
|
private _customerUserID: string | undefined;
|
|
14
14
|
private _metadata: string | undefined;
|
|
15
15
|
private _role: HMSRole | undefined;
|
|
16
16
|
|
|
17
|
-
private _updateName(value: string) {
|
|
18
|
-
// If `_name` is outdated, update it
|
|
19
|
-
if (this._name !== value) {
|
|
20
|
-
this._name = value;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
17
|
private _updateIsLocal(value: boolean) {
|
|
25
18
|
// If `_isLocal` is outdated, update it
|
|
26
19
|
if (this._isLocal !== value) {
|
|
@@ -49,25 +42,9 @@ export class HMSPeer {
|
|
|
49
42
|
}
|
|
50
43
|
}
|
|
51
44
|
|
|
52
|
-
constructor(params: { peerID: string }) {
|
|
45
|
+
constructor(params: { peerID: string; name: string }) {
|
|
53
46
|
this.peerID = params.peerID;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
get name(): string {
|
|
57
|
-
const hmsPeersCache = getHmsPeersCache();
|
|
58
|
-
|
|
59
|
-
const nameValue = hmsPeersCache
|
|
60
|
-
? hmsPeersCache.getProperty(this.peerID, 'name')
|
|
61
|
-
: getPeerPropertyFromNative(
|
|
62
|
-
HMSConstants.DEFAULT_SDK_ID,
|
|
63
|
-
this.peerID,
|
|
64
|
-
'name'
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
if (nameValue) {
|
|
68
|
-
this._updateName(nameValue);
|
|
69
|
-
}
|
|
70
|
-
return nameValue ?? this._name;
|
|
47
|
+
this.name = params.name;
|
|
71
48
|
}
|
|
72
49
|
|
|
73
50
|
get isLocal(): boolean | undefined {
|
package/src/classes/HMSSDK.tsx
CHANGED
|
@@ -26,7 +26,6 @@ import type { HMSAudioDevice } from './HMSAudioDevice';
|
|
|
26
26
|
import type { HMSAudioMode } from './HMSAudioMode';
|
|
27
27
|
import type { HMSAudioMixingMode } from './HMSAudioMixingMode';
|
|
28
28
|
import type { HMSLogSettings } from './HMSLogSettings';
|
|
29
|
-
import { HMSMessageType } from './HMSMessageType';
|
|
30
29
|
import { HMSPIPListenerActions } from './HMSPIPListenerActions';
|
|
31
30
|
import HMSNativeEventListener from './HMSNativeEventListener';
|
|
32
31
|
import type { HMSNativeEventSubscription } from './HMSNativeEventListener';
|
|
@@ -208,30 +207,6 @@ export class HMSSDK {
|
|
|
208
207
|
HMSManager.preview({ ...config, id: this.id });
|
|
209
208
|
};
|
|
210
209
|
|
|
211
|
-
/**
|
|
212
|
-
* - previewForRole can be used when there is role change request for current localPeer and we want
|
|
213
|
-
* to show the localPeer how the tracks look before publishing them to room.
|
|
214
|
-
*
|
|
215
|
-
* - It requires a role of type [HMSRole]{@link HMSRole} for which we want to preview the tracks.
|
|
216
|
-
*
|
|
217
|
-
* checkout {@link https://www.100ms.live/docs/react-native} for more info
|
|
218
|
-
*
|
|
219
|
-
* @param {HMSRole}
|
|
220
|
-
* @memberof HMSSDK
|
|
221
|
-
*/
|
|
222
|
-
previewForRole = async (role: HMSRole) => {
|
|
223
|
-
logger?.verbose('#Function previewForRole', {
|
|
224
|
-
role,
|
|
225
|
-
id: this.id,
|
|
226
|
-
});
|
|
227
|
-
if (Platform.OS === 'ios') {
|
|
228
|
-
return await HMSManager.previewForRole({ role: role?.name, id: this.id });
|
|
229
|
-
} else {
|
|
230
|
-
console.log('API currently not available for android');
|
|
231
|
-
return 'API currently not available for android';
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
|
|
235
210
|
/**
|
|
236
211
|
* - HmsView is react component that takes trackId and starts showing that track on a tile.
|
|
237
212
|
* - The appearance of tile is completely customizable with style prop.
|
|
@@ -298,13 +273,11 @@ export class HMSSDK {
|
|
|
298
273
|
*
|
|
299
274
|
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/chat} for more info
|
|
300
275
|
*
|
|
301
|
-
* @param {message: string} and @param {type: string}
|
|
302
276
|
* @memberof HMSSDK
|
|
277
|
+
* @param message the message that is to be sent
|
|
278
|
+
* @param type the default type is set to CHAT. You can pass a custom type here for sending events like Emoji Reactions, Notifications, etc
|
|
303
279
|
*/
|
|
304
|
-
sendBroadcastMessage = async (
|
|
305
|
-
message: string,
|
|
306
|
-
type: HMSMessageType = HMSMessageType.CHAT
|
|
307
|
-
) => {
|
|
280
|
+
sendBroadcastMessage = async (message: string, type: string = 'chat') => {
|
|
308
281
|
logger?.verbose('#Function sendBroadcastMessage', {
|
|
309
282
|
message,
|
|
310
283
|
type: type || null,
|
|
@@ -331,7 +304,7 @@ export class HMSSDK {
|
|
|
331
304
|
sendGroupMessage = async (
|
|
332
305
|
message: string,
|
|
333
306
|
roles: HMSRole[],
|
|
334
|
-
type:
|
|
307
|
+
type: string = 'chat'
|
|
335
308
|
) => {
|
|
336
309
|
logger?.verbose('#Function sendGroupMessage', {
|
|
337
310
|
message,
|
|
@@ -361,7 +334,7 @@ export class HMSSDK {
|
|
|
361
334
|
sendDirectMessage = async (
|
|
362
335
|
message: string,
|
|
363
336
|
peer: HMSPeer,
|
|
364
|
-
type:
|
|
337
|
+
type: string = 'chat'
|
|
365
338
|
) => {
|
|
366
339
|
logger?.verbose('#Function sendDirectMessage', {
|
|
367
340
|
message,
|
|
@@ -659,6 +632,54 @@ export class HMSSDK {
|
|
|
659
632
|
return await HMSManager.changeName(data);
|
|
660
633
|
};
|
|
661
634
|
|
|
635
|
+
/**
|
|
636
|
+
* -Preview for a specific Role before changing it.
|
|
637
|
+
*
|
|
638
|
+
* 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.
|
|
639
|
+
*
|
|
640
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/peer/change-role} for more info
|
|
641
|
+
*
|
|
642
|
+
* @param {role: string}
|
|
643
|
+
* @memberof HMSSDK
|
|
644
|
+
*/
|
|
645
|
+
previewForRole = async (role: string) => {
|
|
646
|
+
logger?.verbose('#Function previewForRole', {
|
|
647
|
+
role,
|
|
648
|
+
id: this.id,
|
|
649
|
+
});
|
|
650
|
+
const data = await HMSManager.previewForRole({
|
|
651
|
+
role,
|
|
652
|
+
id: this.id,
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
const previewTracks = HMSEncoder.encodeHmsPreviewForRoleTracks(
|
|
656
|
+
data.tracks,
|
|
657
|
+
this.id
|
|
658
|
+
);
|
|
659
|
+
|
|
660
|
+
return previewTracks;
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* Cancel the Previewing for Role invocation.
|
|
665
|
+
*
|
|
666
|
+
* If a [previewForRole] call was performed previously then calling this method clears the tracks created anticipating a Change of Role
|
|
667
|
+
*
|
|
668
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/peer/change-role} for more info
|
|
669
|
+
*
|
|
670
|
+
* @memberof HMSSDK
|
|
671
|
+
*/
|
|
672
|
+
cancelPreview = async () => {
|
|
673
|
+
logger?.verbose('#Function cancelPreview', {
|
|
674
|
+
id: this.id,
|
|
675
|
+
});
|
|
676
|
+
const data: { data: string } = await HMSManager.cancelPreview({
|
|
677
|
+
id: this.id,
|
|
678
|
+
});
|
|
679
|
+
|
|
680
|
+
return data;
|
|
681
|
+
};
|
|
682
|
+
|
|
662
683
|
/**
|
|
663
684
|
* - Calling this function will accept the most recent roleChange request made by anyone in the room
|
|
664
685
|
*
|
|
@@ -1003,8 +1024,8 @@ export class HMSSDK {
|
|
|
1003
1024
|
*
|
|
1004
1025
|
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/audio-output-routing#switch-audio-focus-to-another-device} for more info
|
|
1005
1026
|
*
|
|
1006
|
-
* @param {HMSAudioDevice}
|
|
1007
1027
|
* @memberof HMSSDK
|
|
1028
|
+
* @param audioDevice
|
|
1008
1029
|
*/
|
|
1009
1030
|
switchAudioOutput = (audioDevice: HMSAudioDevice) => {
|
|
1010
1031
|
logger?.verbose('#Function switchAudioOutput', {
|
package/src/classes/HmsView.tsx
CHANGED
|
@@ -91,10 +91,6 @@ export const HmsViewComponent = React.forwardRef<any, HmsComponentProps>(
|
|
|
91
91
|
const capture = async () => {
|
|
92
92
|
const viewManagerConfig = UIManager.getViewManagerConfig('HMSView');
|
|
93
93
|
|
|
94
|
-
if (!viewManagerConfig.Commands.capture) {
|
|
95
|
-
return Promise.reject('Capture command not available on HMSView');
|
|
96
|
-
}
|
|
97
|
-
|
|
98
94
|
let requestId = _nextRequestId++;
|
|
99
95
|
let requestMap = _requestMap;
|
|
100
96
|
|
|
@@ -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
|
@@ -73,7 +73,6 @@ export * from './classes/HMSAudioMixerSource';
|
|
|
73
73
|
export * from './classes/HMSTrackSettingsInitState';
|
|
74
74
|
export * from './classes/HMSLogSettings';
|
|
75
75
|
export * from './classes/HMSLogAlarmManager';
|
|
76
|
-
export * from './classes/HMSMessageType';
|
|
77
76
|
export * from './classes/HMSPIPListenerActions';
|
|
78
77
|
export * from './classes/HMSLayer';
|
|
79
78
|
export * from './classes/HMSSimulcastLayerDefinition';
|
|
@@ -85,7 +84,10 @@ export type {
|
|
|
85
84
|
HMSSessionStore,
|
|
86
85
|
HMSSessionStoreValue,
|
|
87
86
|
} from './classes/HMSSessionStore';
|
|
88
|
-
export type {
|
|
87
|
+
export type {
|
|
88
|
+
HmsViewComponent as HMSView,
|
|
89
|
+
HmsComponentProps as HMSViewProps,
|
|
90
|
+
} from './classes/HmsView';
|
|
89
91
|
|
|
90
92
|
import { HMSSDK as HmsManager } from './classes/HMSSDK';
|
|
91
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<
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.HMSMessageType = void 0;
|
|
7
|
-
let HMSMessageType = /*#__PURE__*/function (HMSMessageType) {
|
|
8
|
-
HMSMessageType["CHAT"] = "chat";
|
|
9
|
-
HMSMessageType["METADATA"] = "metadata";
|
|
10
|
-
return HMSMessageType;
|
|
11
|
-
}({});
|
|
12
|
-
exports.HMSMessageType = HMSMessageType;
|
|
13
|
-
//# sourceMappingURL=HMSMessageType.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["HMSMessageType","exports"],"sources":["HMSMessageType.ts"],"sourcesContent":["export enum HMSMessageType {\n CHAT = 'chat',\n METADATA = 'metadata',\n}\n"],"mappings":";;;;;;IAAYA,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAAAC,OAAA,CAAAD,cAAA,GAAAA,cAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["HMSMessageType"],"sources":["HMSMessageType.ts"],"sourcesContent":["export enum HMSMessageType {\n CHAT = 'chat',\n METADATA = 'metadata',\n}\n"],"mappings":"AAAA,WAAYA,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA"}
|