@100mslive/react-native-hms 1.10.8 → 1.10.9
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/README.md +6 -5
- package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +19 -2
- package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +34 -3
- package/android/src/main/java/com/reactnativehmssdk/PipActionReceiver.kt +3 -1
- package/ios/HMSRNSDK.swift +13 -8
- package/lib/commonjs/classes/HMSAudioDevice.js +9 -0
- package/lib/commonjs/classes/HMSAudioDevice.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioMixingMode.js +11 -0
- package/lib/commonjs/classes/HMSAudioMixingMode.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioTrack.js +9 -0
- package/lib/commonjs/classes/HMSAudioTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSCameraFacing.js +9 -0
- package/lib/commonjs/classes/HMSCameraFacing.js.map +1 -1
- package/lib/commonjs/classes/HMSConfig.js +27 -0
- package/lib/commonjs/classes/HMSConfig.js.map +1 -1
- package/lib/commonjs/classes/HMSException.js +18 -0
- package/lib/commonjs/classes/HMSException.js.map +1 -1
- package/lib/commonjs/classes/HMSHLSTimedMetadata.js.map +1 -1
- package/lib/commonjs/classes/HMSIOSAudioMode.js +15 -0
- package/lib/commonjs/classes/HMSIOSAudioMode.js.map +1 -1
- package/lib/commonjs/classes/HMSLogAlarmManager.js +12 -0
- package/lib/commonjs/classes/HMSLogAlarmManager.js.map +1 -1
- package/lib/commonjs/classes/HMSLogLevel.js +12 -0
- package/lib/commonjs/classes/HMSLogLevel.js.map +1 -1
- package/lib/commonjs/classes/HMSLogSettings.js +14 -0
- package/lib/commonjs/classes/HMSLogSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSNetworkQuality.js +11 -0
- package/lib/commonjs/classes/HMSNetworkQuality.js.map +1 -1
- package/lib/commonjs/classes/HMSNoiseCancellationPlugin.js +40 -10
- package/lib/commonjs/classes/HMSNoiseCancellationPlugin.js.map +1 -1
- package/lib/commonjs/classes/HMSPIPConfig.js.map +1 -1
- package/lib/commonjs/classes/HMSPIPListenerActions.js +9 -0
- package/lib/commonjs/classes/HMSPIPListenerActions.js.map +1 -1
- package/lib/commonjs/classes/HMSPeer.js +148 -0
- package/lib/commonjs/classes/HMSPeer.js.map +1 -1
- package/lib/commonjs/classes/HMSPeerType.js +12 -1
- package/lib/commonjs/classes/HMSPeerType.js.map +1 -1
- package/lib/commonjs/classes/HMSRTMPConfig.js +14 -0
- package/lib/commonjs/classes/HMSRTMPConfig.js.map +1 -1
- package/lib/commonjs/classes/HMSRole.js +17 -0
- package/lib/commonjs/classes/HMSRole.js.map +1 -1
- package/lib/commonjs/classes/HMSRtmpVideoResolution.js +13 -0
- package/lib/commonjs/classes/HMSRtmpVideoResolution.js.map +1 -1
- package/lib/commonjs/classes/HMSSDK.js +1126 -248
- package/lib/commonjs/classes/HMSSDK.js.map +1 -1
- package/lib/commonjs/classes/HMSSessionStore.js +14 -15
- package/lib/commonjs/classes/HMSSessionStore.js.map +1 -1
- package/lib/commonjs/classes/HMSTrack.js +13 -0
- package/lib/commonjs/classes/HMSTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackSettings.js +10 -0
- package/lib/commonjs/classes/HMSTrackSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackSettingsInitState.js +9 -0
- package/lib/commonjs/classes/HMSTrackSettingsInitState.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackSource.js +10 -0
- package/lib/commonjs/classes/HMSTrackSource.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackType.js +7 -0
- package/lib/commonjs/classes/HMSTrackType.js.map +1 -1
- package/lib/commonjs/classes/HMSUpdateListenerActions.js +42 -3
- package/lib/commonjs/classes/HMSUpdateListenerActions.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoTrack.js +17 -0
- package/lib/commonjs/classes/HMSVideoTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoTrackSettings.js +12 -2
- package/lib/commonjs/classes/HMSVideoTrackSettings.js.map +1 -1
- package/lib/commonjs/classes/HmsView.js +42 -0
- package/lib/commonjs/classes/HmsView.js.map +1 -1
- package/lib/module/classes/HMSAudioDevice.js +9 -0
- package/lib/module/classes/HMSAudioDevice.js.map +1 -1
- package/lib/module/classes/HMSAudioMixingMode.js +11 -0
- package/lib/module/classes/HMSAudioMixingMode.js.map +1 -1
- package/lib/module/classes/HMSAudioTrack.js +9 -0
- package/lib/module/classes/HMSAudioTrack.js.map +1 -1
- package/lib/module/classes/HMSCameraFacing.js +9 -0
- package/lib/module/classes/HMSCameraFacing.js.map +1 -1
- package/lib/module/classes/HMSConfig.js +27 -0
- package/lib/module/classes/HMSConfig.js.map +1 -1
- package/lib/module/classes/HMSException.js +18 -0
- package/lib/module/classes/HMSException.js.map +1 -1
- package/lib/module/classes/HMSHLSTimedMetadata.js.map +1 -1
- package/lib/module/classes/HMSIOSAudioMode.js +15 -0
- package/lib/module/classes/HMSIOSAudioMode.js.map +1 -1
- package/lib/module/classes/HMSLogAlarmManager.js +12 -0
- package/lib/module/classes/HMSLogAlarmManager.js.map +1 -1
- package/lib/module/classes/HMSLogLevel.js +12 -0
- package/lib/module/classes/HMSLogLevel.js.map +1 -1
- package/lib/module/classes/HMSLogSettings.js +14 -0
- package/lib/module/classes/HMSLogSettings.js.map +1 -1
- package/lib/module/classes/HMSNetworkQuality.js +11 -0
- package/lib/module/classes/HMSNetworkQuality.js.map +1 -1
- package/lib/module/classes/HMSNoiseCancellationPlugin.js +40 -10
- package/lib/module/classes/HMSNoiseCancellationPlugin.js.map +1 -1
- package/lib/module/classes/HMSPIPConfig.js.map +1 -1
- package/lib/module/classes/HMSPIPListenerActions.js +9 -0
- package/lib/module/classes/HMSPIPListenerActions.js.map +1 -1
- package/lib/module/classes/HMSPeer.js +149 -0
- package/lib/module/classes/HMSPeer.js.map +1 -1
- package/lib/module/classes/HMSPeerType.js +12 -1
- package/lib/module/classes/HMSPeerType.js.map +1 -1
- package/lib/module/classes/HMSRTMPConfig.js +14 -0
- package/lib/module/classes/HMSRTMPConfig.js.map +1 -1
- package/lib/module/classes/HMSRole.js +17 -0
- package/lib/module/classes/HMSRole.js.map +1 -1
- package/lib/module/classes/HMSRtmpVideoResolution.js +13 -0
- package/lib/module/classes/HMSRtmpVideoResolution.js.map +1 -1
- package/lib/module/classes/HMSSDK.js +1126 -248
- package/lib/module/classes/HMSSDK.js.map +1 -1
- package/lib/module/classes/HMSSessionStore.js +14 -15
- package/lib/module/classes/HMSSessionStore.js.map +1 -1
- package/lib/module/classes/HMSTrack.js +13 -0
- package/lib/module/classes/HMSTrack.js.map +1 -1
- package/lib/module/classes/HMSTrackSettings.js +10 -0
- package/lib/module/classes/HMSTrackSettings.js.map +1 -1
- package/lib/module/classes/HMSTrackSettingsInitState.js +9 -0
- package/lib/module/classes/HMSTrackSettingsInitState.js.map +1 -1
- package/lib/module/classes/HMSTrackSource.js +10 -0
- package/lib/module/classes/HMSTrackSource.js.map +1 -1
- package/lib/module/classes/HMSTrackType.js +7 -0
- package/lib/module/classes/HMSTrackType.js.map +1 -1
- package/lib/module/classes/HMSUpdateListenerActions.js +42 -3
- package/lib/module/classes/HMSUpdateListenerActions.js.map +1 -1
- package/lib/module/classes/HMSVideoTrack.js +17 -0
- package/lib/module/classes/HMSVideoTrack.js.map +1 -1
- package/lib/module/classes/HMSVideoTrackSettings.js +12 -2
- package/lib/module/classes/HMSVideoTrackSettings.js.map +1 -1
- package/lib/module/classes/HmsView.js +43 -0
- package/lib/module/classes/HmsView.js.map +1 -1
- package/lib/typescript/classes/HMSAudioDevice.d.ts +14 -0
- package/lib/typescript/classes/HMSAudioMixingMode.d.ts +11 -0
- package/lib/typescript/classes/HMSAudioTrack.d.ts +9 -0
- package/lib/typescript/classes/HMSCameraFacing.d.ts +11 -0
- package/lib/typescript/classes/HMSConfig.d.ts +27 -0
- package/lib/typescript/classes/HMSException.d.ts +18 -0
- package/lib/typescript/classes/HMSHLSTimedMetadata.d.ts +12 -0
- package/lib/typescript/classes/HMSIOSAudioMode.d.ts +15 -0
- package/lib/typescript/classes/HMSLogAlarmManager.d.ts +12 -0
- package/lib/typescript/classes/HMSLogLevel.d.ts +12 -0
- package/lib/typescript/classes/HMSLogSettings.d.ts +14 -0
- package/lib/typescript/classes/HMSNetworkQuality.d.ts +11 -0
- package/lib/typescript/classes/HMSNoiseCancellationPlugin.d.ts +36 -6
- package/lib/typescript/classes/HMSPIPConfig.d.ts +37 -0
- package/lib/typescript/classes/HMSPIPListenerActions.d.ts +17 -0
- package/lib/typescript/classes/HMSPeer.d.ts +137 -0
- package/lib/typescript/classes/HMSPeerType.d.ts +11 -0
- package/lib/typescript/classes/HMSRTMPConfig.d.ts +14 -0
- package/lib/typescript/classes/HMSRole.d.ts +17 -0
- package/lib/typescript/classes/HMSRtmpVideoResolution.d.ts +13 -0
- package/lib/typescript/classes/HMSSDK.d.ts +1080 -235
- package/lib/typescript/classes/HMSSessionStore.d.ts +14 -15
- package/lib/typescript/classes/HMSTrack.d.ts +13 -0
- package/lib/typescript/classes/HMSTrackSettings.d.ts +10 -0
- package/lib/typescript/classes/HMSTrackSettingsInitState.d.ts +11 -0
- package/lib/typescript/classes/HMSTrackSource.d.ts +10 -0
- package/lib/typescript/classes/HMSTrackType.d.ts +7 -0
- package/lib/typescript/classes/HMSUpdateListenerActions.d.ts +290 -4
- package/lib/typescript/classes/HMSVideoTrack.d.ts +17 -0
- package/lib/typescript/classes/HMSVideoTrackSettings.d.ts +12 -2
- package/lib/typescript/classes/HmsView.d.ts +16 -0
- package/package.json +1 -1
- package/sdk-versions.json +2 -2
- package/src/classes/HMSAudioDevice.ts +18 -0
- package/src/classes/HMSAudioMixingMode.ts +11 -0
- package/src/classes/HMSAudioTrack.ts +9 -0
- package/src/classes/HMSCameraFacing.ts +11 -0
- package/src/classes/HMSConfig.ts +27 -0
- package/src/classes/HMSException.ts +18 -0
- package/src/classes/HMSHLSTimedMetadata.ts +12 -0
- package/src/classes/HMSIOSAudioMode.ts +15 -0
- package/src/classes/HMSLogAlarmManager.ts +12 -0
- package/src/classes/HMSLogLevel.ts +12 -0
- package/src/classes/HMSLogSettings.ts +14 -0
- package/src/classes/HMSNetworkQuality.ts +11 -0
- package/src/classes/HMSNoiseCancellationPlugin.ts +41 -10
- package/src/classes/HMSPIPConfig.ts +25 -8
- package/src/classes/HMSPIPListenerActions.ts +18 -0
- package/src/classes/HMSPeer.ts +137 -0
- package/src/classes/HMSPeerType.ts +13 -2
- package/src/classes/HMSRTMPConfig.ts +14 -0
- package/src/classes/HMSRole.ts +17 -0
- package/src/classes/HMSRtmpVideoResolution.ts +13 -0
- package/src/classes/HMSSDK.tsx +1182 -277
- package/src/classes/HMSSessionStore.ts +14 -15
- package/src/classes/HMSTrack.ts +13 -0
- package/src/classes/HMSTrackSettings.ts +10 -0
- package/src/classes/HMSTrackSettingsInitState.ts +11 -0
- package/src/classes/HMSTrackSource.ts +10 -0
- package/src/classes/HMSTrackType.ts +7 -0
- package/src/classes/HMSUpdateListenerActions.ts +312 -3
- package/src/classes/HMSVideoTrack.ts +17 -0
- package/src/classes/HMSVideoTrackSettings.ts +12 -2
- package/src/classes/HmsView.tsx +39 -0
|
@@ -4,6 +4,23 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
4
4
|
import { getHmsPeersCache, getPeerPropertyFromNative } from './HMSPeersCache';
|
|
5
5
|
import { HMSConstants } from './HMSConstants';
|
|
6
6
|
import { HMSPeerType } from './HMSPeerType';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents a peer in the HMS ecosystem.
|
|
10
|
+
*
|
|
11
|
+
* This class encapsulates the properties and state of a peer within a session, including their ID, name, role, and various status flags.
|
|
12
|
+
*
|
|
13
|
+
* @export
|
|
14
|
+
* @class HMSPeer
|
|
15
|
+
* @property {string} peerID - The unique identifier for the peer.
|
|
16
|
+
* @property {string | undefined} _name - The name of the peer. Private access.
|
|
17
|
+
* @property {boolean | undefined} _isLocal - Flag indicating whether the peer is the local user. Private access.
|
|
18
|
+
* @property {string | undefined} _customerUserID - An optional custom user ID set by the application. Private access.
|
|
19
|
+
* @property {string | undefined} _metadata - Optional metadata associated with the peer. Private access.
|
|
20
|
+
* @property {HMSRole | undefined} _role - The role assigned to the peer within the session. Private access.
|
|
21
|
+
* @property {boolean} _isHandRaised - Flag indicating whether the peer has raised their hand. Defaults to false. Private access.
|
|
22
|
+
* @property {HMSPeerType} _type - The type of the peer, e.g., regular, screen share. Defaults to `HMSPeerType.REGULAR`. Private access.
|
|
23
|
+
*/
|
|
7
24
|
export class HMSPeer {
|
|
8
25
|
_updateName(value) {
|
|
9
26
|
// If `_isLocal` is outdated, update it
|
|
@@ -59,6 +76,17 @@ export class HMSPeer {
|
|
|
59
76
|
this.peerID = params.peerID;
|
|
60
77
|
this._name = params.name;
|
|
61
78
|
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Gets the name of the peer.
|
|
82
|
+
*
|
|
83
|
+
* This getter method retrieves the name of the peer. If the name has already been set locally, it returns that value.
|
|
84
|
+
* Otherwise, it attempts to retrieve the name from the HMS peers cache. If the cache does not contain the name,
|
|
85
|
+
* it falls back to fetching the name directly from the native layer using the peer's ID.
|
|
86
|
+
* Once a value is retrieved, it updates the local `_name` property to ensure consistency.
|
|
87
|
+
*
|
|
88
|
+
* @returns {string | undefined} The name of the peer if available, otherwise `undefined`.
|
|
89
|
+
*/
|
|
62
90
|
get name() {
|
|
63
91
|
if (this._name) {
|
|
64
92
|
return this._name;
|
|
@@ -70,6 +98,16 @@ export class HMSPeer {
|
|
|
70
98
|
}
|
|
71
99
|
return value ?? this._name;
|
|
72
100
|
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Determines if the peer is the local user.
|
|
104
|
+
*
|
|
105
|
+
* This getter method checks if the peer is the local user by first attempting to retrieve the 'isLocal' property value from the HMS peers cache.
|
|
106
|
+
* If the value is not found in the cache, it falls back to fetching the property directly from the native layer using the peer's ID.
|
|
107
|
+
* Once a value is retrieved, it updates the local `_isLocal` property to ensure the value is current.
|
|
108
|
+
*
|
|
109
|
+
* @returns {boolean | undefined} True if the peer is the local user, false otherwise. Returns `undefined` if the information is not available.
|
|
110
|
+
*/
|
|
73
111
|
get isLocal() {
|
|
74
112
|
const hmsPeersCache = getHmsPeersCache();
|
|
75
113
|
const value = hmsPeersCache ? hmsPeersCache.getProperty(this.peerID, 'isLocal') : getPeerPropertyFromNative(HMSConstants.DEFAULT_SDK_ID, this.peerID, 'isLocal');
|
|
@@ -78,6 +116,19 @@ export class HMSPeer {
|
|
|
78
116
|
}
|
|
79
117
|
return value ?? this._isLocal;
|
|
80
118
|
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Checks if the peer has raised their hand.
|
|
122
|
+
*
|
|
123
|
+
* This getter method determines whether the peer has their hand raised in the session. It first attempts to retrieve the 'isHandRaised' property value
|
|
124
|
+
* from the HMS peers cache. If the value is not found in the cache, it falls back to fetching the property directly from the native layer using the peer's ID.
|
|
125
|
+
* Once a value is retrieved, it updates the local `_isHandRaised` property to ensure the value is current and consistent.
|
|
126
|
+
*
|
|
127
|
+
* @returns {boolean} True if the peer has their hand raised, false otherwise. Defaults to false if the information is not available.
|
|
128
|
+
*
|
|
129
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/peer/large-room
|
|
130
|
+
*
|
|
131
|
+
*/
|
|
81
132
|
get isHandRaised() {
|
|
82
133
|
const hmsPeersCache = getHmsPeersCache();
|
|
83
134
|
const value = hmsPeersCache ? hmsPeersCache.getProperty(this.peerID, 'isHandRaised') : getPeerPropertyFromNative(HMSConstants.DEFAULT_SDK_ID, this.peerID, 'isHandRaised');
|
|
@@ -86,6 +137,19 @@ export class HMSPeer {
|
|
|
86
137
|
}
|
|
87
138
|
return value ?? this._isHandRaised;
|
|
88
139
|
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Retrieves the network quality of the peer.
|
|
143
|
+
*
|
|
144
|
+
* This getter method attempts to obtain the network quality of the peer, which is an indicator of the current network conditions affecting the peer's connection.
|
|
145
|
+
* It first tries to get this information from the HMS peers cache. If the information is not available in the cache,
|
|
146
|
+
* it falls back to fetching the network quality directly from the native layer using the peer's ID.
|
|
147
|
+
* The network quality is represented by the `HMSNetworkQuality` type, which may include values such as 'good', 'poor', etc., depending on the implementation.
|
|
148
|
+
*
|
|
149
|
+
* @returns {HMSNetworkQuality | undefined} The network quality of the peer if available, otherwise `undefined`.
|
|
150
|
+
*
|
|
151
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/measure-network-quality-and-performance/network-quality
|
|
152
|
+
*/
|
|
89
153
|
get networkQuality() {
|
|
90
154
|
const hmsPeersCache = getHmsPeersCache();
|
|
91
155
|
if (hmsPeersCache) {
|
|
@@ -93,6 +157,17 @@ export class HMSPeer {
|
|
|
93
157
|
}
|
|
94
158
|
return getPeerPropertyFromNative(HMSConstants.DEFAULT_SDK_ID, this.peerID, 'networkQuality');
|
|
95
159
|
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Retrieves the custom user ID of the peer.
|
|
163
|
+
*
|
|
164
|
+
* This getter method attempts to obtain the custom user ID of the peer, which is an optional identifier that can be set by the application.
|
|
165
|
+
* It first tries to get this information from the HMS peers cache. If the information is not available in the cache,
|
|
166
|
+
* it falls back to fetching the custom user ID directly from the native layer using the peer's ID.
|
|
167
|
+
* Once a value is retrieved, it updates the local `_customerUserID` property to ensure the value is current and consistent.
|
|
168
|
+
*
|
|
169
|
+
* @returns {string | undefined} The custom user ID of the peer if available, otherwise `undefined`.
|
|
170
|
+
*/
|
|
96
171
|
get customerUserID() {
|
|
97
172
|
const hmsPeersCache = getHmsPeersCache();
|
|
98
173
|
const value = hmsPeersCache ? hmsPeersCache.getProperty(this.peerID, 'customerUserID') : getPeerPropertyFromNative(HMSConstants.DEFAULT_SDK_ID, this.peerID, 'customerUserID');
|
|
@@ -101,6 +176,19 @@ export class HMSPeer {
|
|
|
101
176
|
}
|
|
102
177
|
return value ?? this._customerUserID;
|
|
103
178
|
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Retrieves the metadata associated with the peer.
|
|
182
|
+
*
|
|
183
|
+
* This getter method attempts to obtain the metadata of the peer, which can include any additional information set by the application.
|
|
184
|
+
* It first tries to get this information from the HMS peers cache. If the information is not available in the cache,
|
|
185
|
+
* it falls back to fetching the metadata directly from the native layer using the peer's ID.
|
|
186
|
+
* Once a value is retrieved, it updates the local `_metadata` property to ensure the value is current and consistent.
|
|
187
|
+
*
|
|
188
|
+
* @returns {string | undefined} The metadata of the peer if available, otherwise `undefined`.
|
|
189
|
+
*
|
|
190
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/peer/change-metadata
|
|
191
|
+
*/
|
|
104
192
|
get metadata() {
|
|
105
193
|
const hmsPeersCache = getHmsPeersCache();
|
|
106
194
|
const value = hmsPeersCache ? hmsPeersCache.getProperty(this.peerID, 'metadata') : getPeerPropertyFromNative(HMSConstants.DEFAULT_SDK_ID, this.peerID, 'metadata');
|
|
@@ -109,6 +197,19 @@ export class HMSPeer {
|
|
|
109
197
|
}
|
|
110
198
|
return value ?? this._metadata;
|
|
111
199
|
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Retrieves the role of the peer.
|
|
203
|
+
*
|
|
204
|
+
* This getter method attempts to obtain the role assigned to the peer within the session. The role can define permissions and capabilities
|
|
205
|
+
* within the session context. It first tries to get this information from the HMS peers cache. If the role information is not available in the cache,
|
|
206
|
+
* it falls back to fetching the role directly from the native layer using the peer's ID. Once a value is retrieved, it updates the local `_role`
|
|
207
|
+
* property to ensure the value is current and consistent.
|
|
208
|
+
*
|
|
209
|
+
* @returns {HMSRole | undefined} The role of the peer if available, otherwise `undefined`.
|
|
210
|
+
*
|
|
211
|
+
* @see https://www.100ms.live/docs/get-started/v2/get-started/concepts/templates-and-roles
|
|
212
|
+
*/
|
|
112
213
|
get role() {
|
|
113
214
|
const hmsPeersCache = getHmsPeersCache();
|
|
114
215
|
const value = hmsPeersCache ? hmsPeersCache.getProperty(this.peerID, 'role') : getPeerPropertyFromNative(HMSConstants.DEFAULT_SDK_ID, this.peerID, 'role');
|
|
@@ -117,6 +218,16 @@ export class HMSPeer {
|
|
|
117
218
|
}
|
|
118
219
|
return value ?? this._role;
|
|
119
220
|
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Retrieves the audio track associated with the peer.
|
|
224
|
+
*
|
|
225
|
+
* This getter method attempts to obtain the audio track of the peer. It first tries to get this information from the HMS peers cache.
|
|
226
|
+
* If the audio track information is not available in the cache, it falls back to fetching the audio track directly from the native layer using the peer's ID.
|
|
227
|
+
* This allows for real-time access to the peer's audio track, which can be used for various audio-related functionalities within the application.
|
|
228
|
+
*
|
|
229
|
+
* @returns {HMSAudioTrack | undefined} The audio track of the peer if available, otherwise `undefined`.
|
|
230
|
+
*/
|
|
120
231
|
get audioTrack() {
|
|
121
232
|
const hmsPeersCache = getHmsPeersCache();
|
|
122
233
|
if (hmsPeersCache) {
|
|
@@ -124,6 +235,17 @@ export class HMSPeer {
|
|
|
124
235
|
}
|
|
125
236
|
return getPeerPropertyFromNative(HMSConstants.DEFAULT_SDK_ID, this.peerID, 'audioTrack');
|
|
126
237
|
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Retrieves the video track associated with the peer.
|
|
241
|
+
*
|
|
242
|
+
* This getter method attempts to obtain the video track of the peer. It first tries to get this information from the HMS peers cache.
|
|
243
|
+
* If the video track information is not available in the cache, it falls back to fetching the video track directly from the native layer using the peer's ID.
|
|
244
|
+
* This allows for real-time access to the peer's video track, which can be used for various video-related functionalities within the application.
|
|
245
|
+
*
|
|
246
|
+
* @returns {HMSVideoTrack | undefined} The video track of the peer if available, otherwise `undefined`.
|
|
247
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/set-up-video-conferencing/render-video/overview
|
|
248
|
+
*/
|
|
127
249
|
get videoTrack() {
|
|
128
250
|
const hmsPeersCache = getHmsPeersCache();
|
|
129
251
|
if (hmsPeersCache) {
|
|
@@ -131,6 +253,19 @@ export class HMSPeer {
|
|
|
131
253
|
}
|
|
132
254
|
return getPeerPropertyFromNative(HMSConstants.DEFAULT_SDK_ID, this.peerID, 'videoTrack');
|
|
133
255
|
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Retrieves the auxiliary tracks associated with the peer.
|
|
259
|
+
*
|
|
260
|
+
* This getter method attempts to obtain the auxiliary tracks of the peer, which can include tracks like screen shares or additional media streams.
|
|
261
|
+
* It first tries to get this information from the HMS peers cache. If the auxiliary track information is not available in the cache,
|
|
262
|
+
* it falls back to fetching the auxiliary tracks directly from the native layer using the peer's ID.
|
|
263
|
+
* This allows for real-time access to the peer's auxiliary tracks, which can be used for various functionalities within the application,
|
|
264
|
+
* such as displaying a screen share or additional video feeds.
|
|
265
|
+
*
|
|
266
|
+
* @returns {HMSTrack[] | undefined} The auxiliary tracks of the peer if available, otherwise `undefined`.
|
|
267
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/set-up-video-conferencing/screenshare
|
|
268
|
+
*/
|
|
134
269
|
get auxiliaryTracks() {
|
|
135
270
|
const hmsPeersCache = getHmsPeersCache();
|
|
136
271
|
if (hmsPeersCache) {
|
|
@@ -138,6 +273,20 @@ export class HMSPeer {
|
|
|
138
273
|
}
|
|
139
274
|
return getPeerPropertyFromNative(HMSConstants.DEFAULT_SDK_ID, this.peerID, 'auxiliaryTracks');
|
|
140
275
|
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Retrieves the type of the peer.
|
|
279
|
+
*
|
|
280
|
+
* This getter method attempts to obtain the type of the peer, which can indicate whether the peer is a regular participant,
|
|
281
|
+
* a screen share, or another type defined within the `HMSPeerType` enum. It first tries to get this information from the HMS peers cache.
|
|
282
|
+
* If the type information is not available in the cache, it falls back to fetching the type directly from the native layer using the peer's ID.
|
|
283
|
+
* This ensures that the application has real-time access to the peer's type, which can be crucial for handling different peer types differently,
|
|
284
|
+
* such as displaying a screen share in a distinct manner. Once a value is retrieved, it updates the local `_type` property to ensure the value is current.
|
|
285
|
+
*
|
|
286
|
+
* @returns {HMSPeerType} The type of the peer, defaulting to the value stored in `_type` if the information is not available.
|
|
287
|
+
*
|
|
288
|
+
* @see https://www.100ms.live/docs/server-side/v2/how-to-guides/Session%20Initiation%20Protocol%20(SIP)/SIP-Interconnect
|
|
289
|
+
*/
|
|
141
290
|
get type() {
|
|
142
291
|
const hmsPeersCache = getHmsPeersCache();
|
|
143
292
|
const value = hmsPeersCache ? hmsPeersCache.getProperty(this.peerID, 'type') : getPeerPropertyFromNative(HMSConstants.DEFAULT_SDK_ID, this.peerID, 'type');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getHmsPeersCache","getPeerPropertyFromNative","HMSConstants","HMSPeerType","HMSPeer","_updateName","value","_name","_updateIsLocal","_isLocal","_updateIsHandRaised","_isHandRaised","_updateCustomerUserID","_customerUserID","_updateMetadata","_metadata","_updateRole","_role","_updateType","_type","constructor","params","_defineProperty","REGULAR","peerID","name","hmsPeersCache","getProperty","DEFAULT_SDK_ID","isLocal","isHandRaised","networkQuality","customerUserID","metadata","role","audioTrack","videoTrack","auxiliaryTracks","type"],"sources":["HMSPeer.ts"],"sourcesContent":["import type { HMSAudioTrack } from './HMSAudioTrack';\nimport type { HMSNetworkQuality } from './HMSNetworkQuality';\nimport type { HMSRole } from './HMSRole';\nimport type { HMSTrack } from './HMSTrack';\nimport type { HMSVideoTrack } from './HMSVideoTrack';\nimport { getHmsPeersCache, getPeerPropertyFromNative } from './HMSPeersCache';\nimport { HMSConstants } from './HMSConstants';\nimport { HMSPeerType } from './HMSPeerType';\n\nexport class HMSPeer {\n peerID: string;\n private _name: string | undefined;\n private _isLocal: boolean | undefined;\n private _customerUserID: string | undefined;\n private _metadata: string | undefined;\n private _role: HMSRole | undefined;\n private _isHandRaised: boolean = false;\n private _type: HMSPeerType = HMSPeerType.REGULAR;\n\n private _updateName(value: string) {\n // If `_isLocal` is outdated, update it\n if (this._name !== value) {\n this._name = value;\n }\n }\n\n private _updateIsLocal(value: boolean) {\n // If `_isLocal` is outdated, update it\n if (this._isLocal !== value) {\n this._isLocal = value;\n }\n }\n\n private _updateIsHandRaised(value: boolean) {\n // If `_isHandRaised` is outdated, update it\n if (this._isHandRaised !== value) {\n this._isHandRaised = value;\n }\n }\n\n private _updateCustomerUserID(value: string) {\n // If `_customerUserID` is outdated, update it\n if (this._customerUserID !== value) {\n this._customerUserID = value;\n }\n }\n\n private _updateMetadata(value: string) {\n // If `_metadata` is outdated, update it\n if (this._metadata !== value) {\n this._metadata = value;\n }\n }\n\n private _updateRole(value: HMSRole) {\n // If `_role` is outdated, update it\n if (this._role !== value) {\n this._role = value;\n }\n }\n\n private _updateType(value: HMSPeerType) {\n // If `_type` is outdated, update it\n if (this._type !== value) {\n this._type = value;\n }\n }\n\n constructor(params: { peerID: string; name: string }) {\n this.peerID = params.peerID;\n this._name = params.name;\n }\n\n get name(): string | undefined {\n if (this._name) {\n return this._name;\n }\n const hmsPeersCache = getHmsPeersCache();\n\n const value = hmsPeersCache\n ? hmsPeersCache.getProperty(this.peerID, 'name')\n : getPeerPropertyFromNative(\n HMSConstants.DEFAULT_SDK_ID,\n this.peerID,\n 'name'\n );\n\n if (typeof value === 'string') {\n this._updateName(value);\n }\n return value ?? this._name;\n }\n\n get isLocal(): boolean | undefined {\n const hmsPeersCache = getHmsPeersCache();\n\n const value = hmsPeersCache\n ? hmsPeersCache.getProperty(this.peerID, 'isLocal')\n : getPeerPropertyFromNative(\n HMSConstants.DEFAULT_SDK_ID,\n this.peerID,\n 'isLocal'\n );\n\n if (typeof value === 'boolean') {\n this._updateIsLocal(value);\n }\n return value ?? this._isLocal;\n }\n\n get isHandRaised(): boolean {\n const hmsPeersCache = getHmsPeersCache();\n\n const value = hmsPeersCache\n ? hmsPeersCache.getProperty(this.peerID, 'isHandRaised')\n : getPeerPropertyFromNative(\n HMSConstants.DEFAULT_SDK_ID,\n this.peerID,\n 'isHandRaised'\n );\n\n if (typeof value === 'boolean') {\n this._updateIsHandRaised(value);\n }\n return value ?? this._isHandRaised;\n }\n\n get networkQuality(): HMSNetworkQuality | undefined {\n const hmsPeersCache = getHmsPeersCache();\n\n if (hmsPeersCache) {\n return hmsPeersCache.getProperty(this.peerID, 'networkQuality');\n }\n\n return getPeerPropertyFromNative(\n HMSConstants.DEFAULT_SDK_ID,\n this.peerID,\n 'networkQuality'\n );\n }\n\n get customerUserID(): string | undefined {\n const hmsPeersCache = getHmsPeersCache();\n\n const value = hmsPeersCache\n ? hmsPeersCache.getProperty(this.peerID, 'customerUserID')\n : getPeerPropertyFromNative(\n HMSConstants.DEFAULT_SDK_ID,\n this.peerID,\n 'customerUserID'\n );\n\n if (value) {\n this._updateCustomerUserID(value);\n }\n return value ?? this._customerUserID;\n }\n\n get metadata(): string | undefined {\n const hmsPeersCache = getHmsPeersCache();\n\n const value = hmsPeersCache\n ? hmsPeersCache.getProperty(this.peerID, 'metadata')\n : getPeerPropertyFromNative(\n HMSConstants.DEFAULT_SDK_ID,\n this.peerID,\n 'metadata'\n );\n\n if (value) {\n this._updateMetadata(value);\n }\n return value ?? this._metadata;\n }\n\n get role(): HMSRole | undefined {\n const hmsPeersCache = getHmsPeersCache();\n\n const value = hmsPeersCache\n ? hmsPeersCache.getProperty(this.peerID, 'role')\n : getPeerPropertyFromNative(\n HMSConstants.DEFAULT_SDK_ID,\n this.peerID,\n 'role'\n );\n\n if (value) {\n this._updateRole(value);\n }\n return value ?? this._role;\n }\n\n get audioTrack(): HMSAudioTrack | undefined {\n const hmsPeersCache = getHmsPeersCache();\n\n if (hmsPeersCache) {\n return hmsPeersCache.getProperty(this.peerID, 'audioTrack');\n }\n\n return getPeerPropertyFromNative(\n HMSConstants.DEFAULT_SDK_ID,\n this.peerID,\n 'audioTrack'\n );\n }\n\n get videoTrack(): HMSVideoTrack | undefined {\n const hmsPeersCache = getHmsPeersCache();\n\n if (hmsPeersCache) {\n return hmsPeersCache.getProperty(this.peerID, 'videoTrack');\n }\n\n return getPeerPropertyFromNative(\n HMSConstants.DEFAULT_SDK_ID,\n this.peerID,\n 'videoTrack'\n );\n }\n\n get auxiliaryTracks(): HMSTrack[] | undefined {\n const hmsPeersCache = getHmsPeersCache();\n\n if (hmsPeersCache) {\n return hmsPeersCache.getProperty(this.peerID, 'auxiliaryTracks');\n }\n\n return getPeerPropertyFromNative(\n HMSConstants.DEFAULT_SDK_ID,\n this.peerID,\n 'auxiliaryTracks'\n );\n }\n\n get type(): HMSPeerType {\n const hmsPeersCache = getHmsPeersCache();\n\n const value = hmsPeersCache\n ? hmsPeersCache.getProperty(this.peerID, 'type')\n : getPeerPropertyFromNative(\n HMSConstants.DEFAULT_SDK_ID,\n this.peerID,\n 'type'\n );\n\n if (value) {\n this._updateType(value);\n }\n return value ?? this._type;\n }\n}\n"],"mappings":";;;AAKA,SAASA,gBAAgB,EAAEC,yBAAyB,QAAQ,iBAAiB;AAC7E,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,WAAW,QAAQ,eAAe;AAE3C,OAAO,MAAMC,OAAO,CAAC;EAUXC,WAAWA,CAACC,KAAa,EAAE;IACjC;IACA,IAAI,IAAI,CAACC,KAAK,KAAKD,KAAK,EAAE;MACxB,IAAI,CAACC,KAAK,GAAGD,KAAK;IACpB;EACF;EAEQE,cAAcA,CAACF,KAAc,EAAE;IACrC;IACA,IAAI,IAAI,CAACG,QAAQ,KAAKH,KAAK,EAAE;MAC3B,IAAI,CAACG,QAAQ,GAAGH,KAAK;IACvB;EACF;EAEQI,mBAAmBA,CAACJ,KAAc,EAAE;IAC1C;IACA,IAAI,IAAI,CAACK,aAAa,KAAKL,KAAK,EAAE;MAChC,IAAI,CAACK,aAAa,GAAGL,KAAK;IAC5B;EACF;EAEQ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+
{"version":3,"names":["getHmsPeersCache","getPeerPropertyFromNative","HMSConstants","HMSPeerType","HMSPeer","_updateName","value","_name","_updateIsLocal","_isLocal","_updateIsHandRaised","_isHandRaised","_updateCustomerUserID","_customerUserID","_updateMetadata","_metadata","_updateRole","_role","_updateType","_type","constructor","params","_defineProperty","REGULAR","peerID","name","hmsPeersCache","getProperty","DEFAULT_SDK_ID","isLocal","isHandRaised","networkQuality","customerUserID","metadata","role","audioTrack","videoTrack","auxiliaryTracks","type"],"sources":["HMSPeer.ts"],"sourcesContent":["import type { HMSAudioTrack } from './HMSAudioTrack';\nimport type { HMSNetworkQuality } from './HMSNetworkQuality';\nimport type { HMSRole } from './HMSRole';\nimport type { HMSTrack } from './HMSTrack';\nimport type { HMSVideoTrack } from './HMSVideoTrack';\nimport { getHmsPeersCache, getPeerPropertyFromNative } from './HMSPeersCache';\nimport { HMSConstants } from './HMSConstants';\nimport { HMSPeerType } from './HMSPeerType';\n\n/**\n * Represents a peer in the HMS ecosystem.\n *\n * This class encapsulates the properties and state of a peer within a session, including their ID, name, role, and various status flags.\n *\n * @export\n * @class HMSPeer\n * @property {string} peerID - The unique identifier for the peer.\n * @property {string | undefined} _name - The name of the peer. Private access.\n * @property {boolean | undefined} _isLocal - Flag indicating whether the peer is the local user. Private access.\n * @property {string | undefined} _customerUserID - An optional custom user ID set by the application. Private access.\n * @property {string | undefined} _metadata - Optional metadata associated with the peer. Private access.\n * @property {HMSRole | undefined} _role - The role assigned to the peer within the session. Private access.\n * @property {boolean} _isHandRaised - Flag indicating whether the peer has raised their hand. Defaults to false. Private access.\n * @property {HMSPeerType} _type - The type of the peer, e.g., regular, screen share. Defaults to `HMSPeerType.REGULAR`. Private access.\n */\nexport class HMSPeer {\n peerID: string;\n private _name: string | undefined;\n private _isLocal: boolean | undefined;\n private _customerUserID: string | undefined;\n private _metadata: string | undefined;\n private _role: HMSRole | undefined;\n private _isHandRaised: boolean = false;\n private _type: HMSPeerType = HMSPeerType.REGULAR;\n\n private _updateName(value: string) {\n // If `_isLocal` is outdated, update it\n if (this._name !== value) {\n this._name = value;\n }\n }\n\n private _updateIsLocal(value: boolean) {\n // If `_isLocal` is outdated, update it\n if (this._isLocal !== value) {\n this._isLocal = value;\n }\n }\n\n private _updateIsHandRaised(value: boolean) {\n // If `_isHandRaised` is outdated, update it\n if (this._isHandRaised !== value) {\n this._isHandRaised = value;\n }\n }\n\n private _updateCustomerUserID(value: string) {\n // If `_customerUserID` is outdated, update it\n if (this._customerUserID !== value) {\n this._customerUserID = value;\n }\n }\n\n private _updateMetadata(value: string) {\n // If `_metadata` is outdated, update it\n if (this._metadata !== value) {\n this._metadata = value;\n }\n }\n\n private _updateRole(value: HMSRole) {\n // If `_role` is outdated, update it\n if (this._role !== value) {\n this._role = value;\n }\n }\n\n private _updateType(value: HMSPeerType) {\n // If `_type` is outdated, update it\n if (this._type !== value) {\n this._type = value;\n }\n }\n\n constructor(params: { peerID: string; name: string }) {\n this.peerID = params.peerID;\n this._name = params.name;\n }\n\n /**\n * Gets the name of the peer.\n *\n * This getter method retrieves the name of the peer. If the name has already been set locally, it returns that value.\n * Otherwise, it attempts to retrieve the name from the HMS peers cache. If the cache does not contain the name,\n * it falls back to fetching the name directly from the native layer using the peer's ID.\n * Once a value is retrieved, it updates the local `_name` property to ensure consistency.\n *\n * @returns {string | undefined} The name of the peer if available, otherwise `undefined`.\n */\n get name(): string | undefined {\n if (this._name) {\n return this._name;\n }\n const hmsPeersCache = getHmsPeersCache();\n\n const value = hmsPeersCache\n ? hmsPeersCache.getProperty(this.peerID, 'name')\n : getPeerPropertyFromNative(\n HMSConstants.DEFAULT_SDK_ID,\n this.peerID,\n 'name'\n );\n\n if (typeof value === 'string') {\n this._updateName(value);\n }\n return value ?? this._name;\n }\n\n /**\n * Determines if the peer is the local user.\n *\n * This getter method checks if the peer is the local user by first attempting to retrieve the 'isLocal' property value from the HMS peers cache.\n * If the value is not found in the cache, it falls back to fetching the property directly from the native layer using the peer's ID.\n * Once a value is retrieved, it updates the local `_isLocal` property to ensure the value is current.\n *\n * @returns {boolean | undefined} True if the peer is the local user, false otherwise. Returns `undefined` if the information is not available.\n */\n get isLocal(): boolean | undefined {\n const hmsPeersCache = getHmsPeersCache();\n\n const value = hmsPeersCache\n ? hmsPeersCache.getProperty(this.peerID, 'isLocal')\n : getPeerPropertyFromNative(\n HMSConstants.DEFAULT_SDK_ID,\n this.peerID,\n 'isLocal'\n );\n\n if (typeof value === 'boolean') {\n this._updateIsLocal(value);\n }\n return value ?? this._isLocal;\n }\n\n /**\n * Checks if the peer has raised their hand.\n *\n * This getter method determines whether the peer has their hand raised in the session. It first attempts to retrieve the 'isHandRaised' property value\n * from the HMS peers cache. If the value is not found in the cache, it falls back to fetching the property directly from the native layer using the peer's ID.\n * Once a value is retrieved, it updates the local `_isHandRaised` property to ensure the value is current and consistent.\n *\n * @returns {boolean} True if the peer has their hand raised, false otherwise. Defaults to false if the information is not available.\n *\n * @see https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/peer/large-room\n *\n */\n get isHandRaised(): boolean {\n const hmsPeersCache = getHmsPeersCache();\n\n const value = hmsPeersCache\n ? hmsPeersCache.getProperty(this.peerID, 'isHandRaised')\n : getPeerPropertyFromNative(\n HMSConstants.DEFAULT_SDK_ID,\n this.peerID,\n 'isHandRaised'\n );\n\n if (typeof value === 'boolean') {\n this._updateIsHandRaised(value);\n }\n return value ?? this._isHandRaised;\n }\n\n /**\n * Retrieves the network quality of the peer.\n *\n * This getter method attempts to obtain the network quality of the peer, which is an indicator of the current network conditions affecting the peer's connection.\n * It first tries to get this information from the HMS peers cache. If the information is not available in the cache,\n * it falls back to fetching the network quality directly from the native layer using the peer's ID.\n * The network quality is represented by the `HMSNetworkQuality` type, which may include values such as 'good', 'poor', etc., depending on the implementation.\n *\n * @returns {HMSNetworkQuality | undefined} The network quality of the peer if available, otherwise `undefined`.\n *\n * @see https://www.100ms.live/docs/react-native/v2/how-to-guides/measure-network-quality-and-performance/network-quality\n */\n get networkQuality(): HMSNetworkQuality | undefined {\n const hmsPeersCache = getHmsPeersCache();\n\n if (hmsPeersCache) {\n return hmsPeersCache.getProperty(this.peerID, 'networkQuality');\n }\n\n return getPeerPropertyFromNative(\n HMSConstants.DEFAULT_SDK_ID,\n this.peerID,\n 'networkQuality'\n );\n }\n\n /**\n * Retrieves the custom user ID of the peer.\n *\n * This getter method attempts to obtain the custom user ID of the peer, which is an optional identifier that can be set by the application.\n * It first tries to get this information from the HMS peers cache. If the information is not available in the cache,\n * it falls back to fetching the custom user ID directly from the native layer using the peer's ID.\n * Once a value is retrieved, it updates the local `_customerUserID` property to ensure the value is current and consistent.\n *\n * @returns {string | undefined} The custom user ID of the peer if available, otherwise `undefined`.\n */\n get customerUserID(): string | undefined {\n const hmsPeersCache = getHmsPeersCache();\n\n const value = hmsPeersCache\n ? hmsPeersCache.getProperty(this.peerID, 'customerUserID')\n : getPeerPropertyFromNative(\n HMSConstants.DEFAULT_SDK_ID,\n this.peerID,\n 'customerUserID'\n );\n\n if (value) {\n this._updateCustomerUserID(value);\n }\n return value ?? this._customerUserID;\n }\n\n /**\n * Retrieves the metadata associated with the peer.\n *\n * This getter method attempts to obtain the metadata of the peer, which can include any additional information set by the application.\n * It first tries to get this information from the HMS peers cache. If the information is not available in the cache,\n * it falls back to fetching the metadata directly from the native layer using the peer's ID.\n * Once a value is retrieved, it updates the local `_metadata` property to ensure the value is current and consistent.\n *\n * @returns {string | undefined} The metadata of the peer if available, otherwise `undefined`.\n *\n * @see https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/peer/change-metadata\n */\n get metadata(): string | undefined {\n const hmsPeersCache = getHmsPeersCache();\n\n const value = hmsPeersCache\n ? hmsPeersCache.getProperty(this.peerID, 'metadata')\n : getPeerPropertyFromNative(\n HMSConstants.DEFAULT_SDK_ID,\n this.peerID,\n 'metadata'\n );\n\n if (value) {\n this._updateMetadata(value);\n }\n return value ?? this._metadata;\n }\n\n /**\n * Retrieves the role of the peer.\n *\n * This getter method attempts to obtain the role assigned to the peer within the session. The role can define permissions and capabilities\n * within the session context. It first tries to get this information from the HMS peers cache. If the role information is not available in the cache,\n * it falls back to fetching the role directly from the native layer using the peer's ID. Once a value is retrieved, it updates the local `_role`\n * property to ensure the value is current and consistent.\n *\n * @returns {HMSRole | undefined} The role of the peer if available, otherwise `undefined`.\n *\n * @see https://www.100ms.live/docs/get-started/v2/get-started/concepts/templates-and-roles\n */\n get role(): HMSRole | undefined {\n const hmsPeersCache = getHmsPeersCache();\n\n const value = hmsPeersCache\n ? hmsPeersCache.getProperty(this.peerID, 'role')\n : getPeerPropertyFromNative(\n HMSConstants.DEFAULT_SDK_ID,\n this.peerID,\n 'role'\n );\n\n if (value) {\n this._updateRole(value);\n }\n return value ?? this._role;\n }\n\n /**\n * Retrieves the audio track associated with the peer.\n *\n * This getter method attempts to obtain the audio track of the peer. It first tries to get this information from the HMS peers cache.\n * If the audio track information is not available in the cache, it falls back to fetching the audio track directly from the native layer using the peer's ID.\n * This allows for real-time access to the peer's audio track, which can be used for various audio-related functionalities within the application.\n *\n * @returns {HMSAudioTrack | undefined} The audio track of the peer if available, otherwise `undefined`.\n */\n get audioTrack(): HMSAudioTrack | undefined {\n const hmsPeersCache = getHmsPeersCache();\n\n if (hmsPeersCache) {\n return hmsPeersCache.getProperty(this.peerID, 'audioTrack');\n }\n\n return getPeerPropertyFromNative(\n HMSConstants.DEFAULT_SDK_ID,\n this.peerID,\n 'audioTrack'\n );\n }\n\n /**\n * Retrieves the video track associated with the peer.\n *\n * This getter method attempts to obtain the video track of the peer. It first tries to get this information from the HMS peers cache.\n * If the video track information is not available in the cache, it falls back to fetching the video track directly from the native layer using the peer's ID.\n * This allows for real-time access to the peer's video track, which can be used for various video-related functionalities within the application.\n *\n * @returns {HMSVideoTrack | undefined} The video track of the peer if available, otherwise `undefined`.\n * @see https://www.100ms.live/docs/react-native/v2/how-to-guides/set-up-video-conferencing/render-video/overview\n */\n get videoTrack(): HMSVideoTrack | undefined {\n const hmsPeersCache = getHmsPeersCache();\n\n if (hmsPeersCache) {\n return hmsPeersCache.getProperty(this.peerID, 'videoTrack');\n }\n\n return getPeerPropertyFromNative(\n HMSConstants.DEFAULT_SDK_ID,\n this.peerID,\n 'videoTrack'\n );\n }\n\n /**\n * Retrieves the auxiliary tracks associated with the peer.\n *\n * This getter method attempts to obtain the auxiliary tracks of the peer, which can include tracks like screen shares or additional media streams.\n * It first tries to get this information from the HMS peers cache. If the auxiliary track information is not available in the cache,\n * it falls back to fetching the auxiliary tracks directly from the native layer using the peer's ID.\n * This allows for real-time access to the peer's auxiliary tracks, which can be used for various functionalities within the application,\n * such as displaying a screen share or additional video feeds.\n *\n * @returns {HMSTrack[] | undefined} The auxiliary tracks of the peer if available, otherwise `undefined`.\n * @see https://www.100ms.live/docs/react-native/v2/how-to-guides/set-up-video-conferencing/screenshare\n */\n get auxiliaryTracks(): HMSTrack[] | undefined {\n const hmsPeersCache = getHmsPeersCache();\n\n if (hmsPeersCache) {\n return hmsPeersCache.getProperty(this.peerID, 'auxiliaryTracks');\n }\n\n return getPeerPropertyFromNative(\n HMSConstants.DEFAULT_SDK_ID,\n this.peerID,\n 'auxiliaryTracks'\n );\n }\n\n /**\n * Retrieves the type of the peer.\n *\n * This getter method attempts to obtain the type of the peer, which can indicate whether the peer is a regular participant,\n * a screen share, or another type defined within the `HMSPeerType` enum. It first tries to get this information from the HMS peers cache.\n * If the type information is not available in the cache, it falls back to fetching the type directly from the native layer using the peer's ID.\n * This ensures that the application has real-time access to the peer's type, which can be crucial for handling different peer types differently,\n * such as displaying a screen share in a distinct manner. Once a value is retrieved, it updates the local `_type` property to ensure the value is current.\n *\n * @returns {HMSPeerType} The type of the peer, defaulting to the value stored in `_type` if the information is not available.\n *\n * @see https://www.100ms.live/docs/server-side/v2/how-to-guides/Session%20Initiation%20Protocol%20(SIP)/SIP-Interconnect\n */\n get type(): HMSPeerType {\n const hmsPeersCache = getHmsPeersCache();\n\n const value = hmsPeersCache\n ? hmsPeersCache.getProperty(this.peerID, 'type')\n : getPeerPropertyFromNative(\n HMSConstants.DEFAULT_SDK_ID,\n this.peerID,\n 'type'\n );\n\n if (value) {\n this._updateType(value);\n }\n return value ?? this._type;\n }\n}\n"],"mappings":";;;AAKA,SAASA,gBAAgB,EAAEC,yBAAyB,QAAQ,iBAAiB;AAC7E,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,WAAW,QAAQ,eAAe;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,OAAO,CAAC;EAUXC,WAAWA,CAACC,KAAa,EAAE;IACjC;IACA,IAAI,IAAI,CAACC,KAAK,KAAKD,KAAK,EAAE;MACxB,IAAI,CAACC,KAAK,GAAGD,KAAK;IACpB;EACF;EAEQE,cAAcA,CAACF,KAAc,EAAE;IACrC;IACA,IAAI,IAAI,CAACG,QAAQ,KAAKH,KAAK,EAAE;MAC3B,IAAI,CAACG,QAAQ,GAAGH,KAAK;IACvB;EACF;EAEQI,mBAAmBA,CAACJ,KAAc,EAAE;IAC1C;IACA,IAAI,IAAI,CAACK,aAAa,KAAKL,KAAK,EAAE;MAChC,IAAI,CAACK,aAAa,GAAGL,KAAK;IAC5B;EACF;EAEQM,qBAAqBA,CAACN,KAAa,EAAE;IAC3C;IACA,IAAI,IAAI,CAACO,eAAe,KAAKP,KAAK,EAAE;MAClC,IAAI,CAACO,eAAe,GAAGP,KAAK;IAC9B;EACF;EAEQQ,eAAeA,CAACR,KAAa,EAAE;IACrC;IACA,IAAI,IAAI,CAACS,SAAS,KAAKT,KAAK,EAAE;MAC5B,IAAI,CAACS,SAAS,GAAGT,KAAK;IACxB;EACF;EAEQU,WAAWA,CAACV,KAAc,EAAE;IAClC;IACA,IAAI,IAAI,CAACW,KAAK,KAAKX,KAAK,EAAE;MACxB,IAAI,CAACW,KAAK,GAAGX,KAAK;IACpB;EACF;EAEQY,WAAWA,C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,MAAM,EACX,MACF,CAAC;IAEL,IAAIlB,KAAK,EAAE;MACT,IAAI,CAACY,WAAW,CAACZ,KAAK,CAAC;IACzB;IACA,OAAOA,KAAK,IAAI,IAAI,CAACa,KAAK;EAC5B;AACF","ignoreList":[]}
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum for HMSPeerType.
|
|
3
|
+
*
|
|
4
|
+
* Defines the types of peers within the HMS (100ms) system. This enumeration is used to distinguish between different
|
|
5
|
+
* kinds of peers, such as SIP (Session Initiation Protocol) peers and regular peers. Each peer type has specific
|
|
6
|
+
* characteristics and roles within the video conferencing or communication context.
|
|
7
|
+
*
|
|
8
|
+
* @enum {string}
|
|
9
|
+
*
|
|
10
|
+
* @see https://www.100ms.live/docs/server-side/v2/how-to-guides/Session%20Initiation%20Protocol%20(SIP)/SIP-Interconnect
|
|
11
|
+
*/
|
|
1
12
|
export let HMSPeerType = /*#__PURE__*/function (HMSPeerType) {
|
|
2
13
|
HMSPeerType["SIP"] = "SIP";
|
|
3
14
|
HMSPeerType["REGULAR"] = "REGULAR";
|
|
4
15
|
return HMSPeerType;
|
|
5
|
-
}({});
|
|
16
|
+
}({}); // Represents a regular peer, such as a standard user in a video call.
|
|
6
17
|
export const HMSPeerTypeOrdinals = new Map([['0', HMSPeerType.SIP], ['1', HMSPeerType.REGULAR]]);
|
|
7
18
|
//# sourceMappingURL=HMSPeerType.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HMSPeerType","HMSPeerTypeOrdinals","Map","SIP","REGULAR"],"sources":["HMSPeerType.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"names":["HMSPeerType","HMSPeerTypeOrdinals","Map","SIP","REGULAR"],"sources":["HMSPeerType.ts"],"sourcesContent":["/**\n * Enum for HMSPeerType.\n *\n * Defines the types of peers within the HMS (100ms) system. This enumeration is used to distinguish between different\n * kinds of peers, such as SIP (Session Initiation Protocol) peers and regular peers. Each peer type has specific\n * characteristics and roles within the video conferencing or communication context.\n *\n * @enum {string}\n *\n * @see https://www.100ms.live/docs/server-side/v2/how-to-guides/Session%20Initiation%20Protocol%20(SIP)/SIP-Interconnect\n */\nexport enum HMSPeerType {\n SIP = 'SIP', // Represents a SIP peer, typically used for integrating with traditional telephony systems.\n REGULAR = 'REGULAR', // Represents a regular peer, such as a standard user in a video call.\n}\n\nexport const HMSPeerTypeOrdinals = new Map([\n ['0', HMSPeerType.SIP],\n ['1', HMSPeerType.REGULAR],\n]);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAYA,WAAW,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA,OAEA;AAGvB,OAAO,MAAMC,mBAAmB,GAAG,IAAIC,GAAG,CAAC,CACzC,CAAC,GAAG,EAAEF,WAAW,CAACG,GAAG,CAAC,EACtB,CAAC,GAAG,EAAEH,WAAW,CAACI,OAAO,CAAC,CAC3B,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
3
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
|
+
/**
|
|
5
|
+
* Configuration class for RTMP streaming in the HMS (100ms) system.
|
|
6
|
+
*
|
|
7
|
+
* This class encapsulates the settings required to configure RTMP (Real-Time Messaging Protocol) streaming for a meeting.
|
|
8
|
+
* It includes options for the meeting URL, RTMP URLs for streaming, whether recording should be enabled, and the video resolution for the stream.
|
|
9
|
+
*
|
|
10
|
+
* @param {Object} params - The constructor parameters.
|
|
11
|
+
* @param {string} [params.meetingURL] - The URL of the meeting to be streamed. Optional.
|
|
12
|
+
* @param {Array<string>} [params.rtmpURLs] - An array of RTMP URLs to which the meeting will be streamed. Optional.
|
|
13
|
+
* @param {boolean} params.record - Flag indicating whether the stream should be recorded.
|
|
14
|
+
* @param {HMSRtmpVideoResolution} [params.resolution] - The resolution of the video to be streamed. Optional.
|
|
15
|
+
*
|
|
16
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/record-and-live-stream/recording
|
|
17
|
+
*/
|
|
4
18
|
export class HMSRTMPConfig {
|
|
5
19
|
constructor(params) {
|
|
6
20
|
_defineProperty(this, "meetingURL", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HMSRTMPConfig","constructor","params","_defineProperty","meetingURL","rtmpURLs","record","resolution"],"sources":["HMSRTMPConfig.ts"],"sourcesContent":["import type { HMSRtmpVideoResolution } from './HMSRtmpVideoResolution';\n\nexport class HMSRTMPConfig {\n meetingURL?: string;\n rtmpURLs?: Array<string>;\n record: boolean;\n resolution?: HMSRtmpVideoResolution;\n\n constructor(params: {\n meetingURL?: string;\n rtmpURLs?: Array<string>;\n record: boolean;\n resolution?: HMSRtmpVideoResolution;\n }) {\n this.meetingURL = params.meetingURL;\n this.rtmpURLs = params.rtmpURLs;\n this.record = params.record;\n this.resolution = params.resolution;\n }\n}\n"],"mappings":";;;AAEA,OAAO,MAAMA,aAAa,CAAC;EAMzBC,WAAWA,CAACC,MAKX,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACD,IAAI,CAACC,UAAU,GAAGF,MAAM,CAACE,UAAU;IACnC,IAAI,CAACC,QAAQ,GAAGH,MAAM,CAACG,QAAQ;IAC/B,IAAI,CAACC,MAAM,GAAGJ,MAAM,CAACI,MAAM;IAC3B,IAAI,CAACC,UAAU,GAAGL,MAAM,CAACK,UAAU;EACrC;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["HMSRTMPConfig","constructor","params","_defineProperty","meetingURL","rtmpURLs","record","resolution"],"sources":["HMSRTMPConfig.ts"],"sourcesContent":["import type { HMSRtmpVideoResolution } from './HMSRtmpVideoResolution';\n\n/**\n * Configuration class for RTMP streaming in the HMS (100ms) system.\n *\n * This class encapsulates the settings required to configure RTMP (Real-Time Messaging Protocol) streaming for a meeting.\n * It includes options for the meeting URL, RTMP URLs for streaming, whether recording should be enabled, and the video resolution for the stream.\n *\n * @param {Object} params - The constructor parameters.\n * @param {string} [params.meetingURL] - The URL of the meeting to be streamed. Optional.\n * @param {Array<string>} [params.rtmpURLs] - An array of RTMP URLs to which the meeting will be streamed. Optional.\n * @param {boolean} params.record - Flag indicating whether the stream should be recorded.\n * @param {HMSRtmpVideoResolution} [params.resolution] - The resolution of the video to be streamed. Optional.\n *\n * @see https://www.100ms.live/docs/react-native/v2/how-to-guides/record-and-live-stream/recording\n */\nexport class HMSRTMPConfig {\n meetingURL?: string;\n rtmpURLs?: Array<string>;\n record: boolean;\n resolution?: HMSRtmpVideoResolution;\n\n constructor(params: {\n meetingURL?: string;\n rtmpURLs?: Array<string>;\n record: boolean;\n resolution?: HMSRtmpVideoResolution;\n }) {\n this.meetingURL = params.meetingURL;\n this.rtmpURLs = params.rtmpURLs;\n this.record = params.record;\n this.resolution = params.resolution;\n }\n}\n"],"mappings":";;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,aAAa,CAAC;EAMzBC,WAAWA,CAACC,MAKX,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACD,IAAI,CAACC,UAAU,GAAGF,MAAM,CAACE,UAAU;IACnC,IAAI,CAACC,QAAQ,GAAGH,MAAM,CAACG,QAAQ;IAC/B,IAAI,CAACC,MAAM,GAAGJ,MAAM,CAACI,MAAM;IAC3B,IAAI,CAACC,UAAU,GAAGL,MAAM,CAACK,UAAU;EACrC;AACF","ignoreList":[]}
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
3
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
|
+
/**
|
|
5
|
+
* Represents a role within the HMS ecosystem.
|
|
6
|
+
*
|
|
7
|
+
* A role defines the capabilities and permissions a user has in a session, such as publishing or subscribing to streams,
|
|
8
|
+
* and the priority of the user in the session. This class encapsulates the properties of a role, including its name,
|
|
9
|
+
* publishing settings, subscribing settings, permissions, and priority.
|
|
10
|
+
*
|
|
11
|
+
* @class HMSRole
|
|
12
|
+
* @property {string} [name] - The name of the role.
|
|
13
|
+
* @property {HMSPublishSettings} [publishSettings] - Settings related to publishing streams for this role.
|
|
14
|
+
* @property {HMSSubscribeSettings} [subscribeSettings] - Settings related to subscribing to streams for this role.
|
|
15
|
+
* @property {HMSPermissions} [permissions] - Permissions granted to this role.
|
|
16
|
+
* @property {number} [priority] - The priority of the role, determining its precedence in the session.
|
|
17
|
+
*
|
|
18
|
+
* @see https://www.100ms.live/docs/get-started/v2/get-started/concepts/templates-and-roles
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
4
21
|
export class HMSRole {
|
|
5
22
|
constructor(params) {
|
|
6
23
|
_defineProperty(this, "name", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HMSRole","constructor","params","_defineProperty","name","priority","permissions","publishSettings","subscribeSettings"],"sources":["HMSRole.ts"],"sourcesContent":["import type { HMSPermissions } from './HMSPermissions';\nimport type { HMSPublishSettings } from './HMSPublishSettings';\nimport type { HMSSubscribeSettings } from './HMSSubscribeSettings';\n\nexport class HMSRole {\n name?: string;\n publishSettings?: HMSPublishSettings;\n subscribeSettings?: HMSSubscribeSettings;\n permissions?: HMSPermissions;\n priority?: number;\n\n constructor(params?: {\n name?: string;\n priority?: number;\n permissions?: HMSPermissions;\n publishSettings?: HMSPublishSettings;\n subscribeSettings?: HMSSubscribeSettings;\n }) {\n if (params) {\n this.name = params.name;\n this.priority = params.priority;\n this.permissions = params.permissions;\n this.publishSettings = params.publishSettings;\n this.subscribeSettings = params.subscribeSettings;\n }\n }\n}\n"],"mappings":";;;AAIA,OAAO,MAAMA,OAAO,CAAC;EAOnBC,WAAWA,CAACC,MAMX,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACD,IAAID,MAAM,EAAE;MACV,IAAI,CAACE,IAAI,GAAGF,MAAM,CAACE,IAAI;MACvB,IAAI,CAACC,QAAQ,GAAGH,MAAM,CAACG,QAAQ;MAC/B,IAAI,CAACC,WAAW,GAAGJ,MAAM,CAACI,WAAW;MACrC,IAAI,CAACC,eAAe,GAAGL,MAAM,CAACK,eAAe;MAC7C,IAAI,CAACC,iBAAiB,GAAGN,MAAM,CAACM,iBAAiB;IACnD;EACF;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["HMSRole","constructor","params","_defineProperty","name","priority","permissions","publishSettings","subscribeSettings"],"sources":["HMSRole.ts"],"sourcesContent":["import type { HMSPermissions } from './HMSPermissions';\nimport type { HMSPublishSettings } from './HMSPublishSettings';\nimport type { HMSSubscribeSettings } from './HMSSubscribeSettings';\n\n/**\n * Represents a role within the HMS ecosystem.\n *\n * A role defines the capabilities and permissions a user has in a session, such as publishing or subscribing to streams,\n * and the priority of the user in the session. This class encapsulates the properties of a role, including its name,\n * publishing settings, subscribing settings, permissions, and priority.\n *\n * @class HMSRole\n * @property {string} [name] - The name of the role.\n * @property {HMSPublishSettings} [publishSettings] - Settings related to publishing streams for this role.\n * @property {HMSSubscribeSettings} [subscribeSettings] - Settings related to subscribing to streams for this role.\n * @property {HMSPermissions} [permissions] - Permissions granted to this role.\n * @property {number} [priority] - The priority of the role, determining its precedence in the session.\n *\n * @see https://www.100ms.live/docs/get-started/v2/get-started/concepts/templates-and-roles\n *\n */\nexport class HMSRole {\n name?: string;\n publishSettings?: HMSPublishSettings;\n subscribeSettings?: HMSSubscribeSettings;\n permissions?: HMSPermissions;\n priority?: number;\n\n constructor(params?: {\n name?: string;\n priority?: number;\n permissions?: HMSPermissions;\n publishSettings?: HMSPublishSettings;\n subscribeSettings?: HMSSubscribeSettings;\n }) {\n if (params) {\n this.name = params.name;\n this.priority = params.priority;\n this.permissions = params.permissions;\n this.publishSettings = params.publishSettings;\n this.subscribeSettings = params.subscribeSettings;\n }\n }\n}\n"],"mappings":";;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,OAAO,CAAC;EAOnBC,WAAWA,CAACC,MAMX,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACD,IAAID,MAAM,EAAE;MACV,IAAI,CAACE,IAAI,GAAGF,MAAM,CAACE,IAAI;MACvB,IAAI,CAACC,QAAQ,GAAGH,MAAM,CAACG,QAAQ;MAC/B,IAAI,CAACC,WAAW,GAAGJ,MAAM,CAACI,WAAW;MACrC,IAAI,CAACC,eAAe,GAAGL,MAAM,CAACK,eAAe;MAC7C,IAAI,CAACC,iBAAiB,GAAGN,MAAM,CAACM,iBAAiB;IACnD;EACF;AACF","ignoreList":[]}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
3
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
|
+
/**
|
|
5
|
+
* Represents the video resolution for RTMP streaming in the HMS (100ms) system.
|
|
6
|
+
*
|
|
7
|
+
* This class encapsulates the dimensions (height and width) of the video resolution to be used for RTMP streaming.
|
|
8
|
+
* It allows for specifying the video quality by defining the resolution, which is crucial for optimizing the streaming experience
|
|
9
|
+
* based on the bandwidth available and the requirements of the streaming platform.
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} params - The constructor parameters.
|
|
12
|
+
* @param {number} params.height - The height of the video resolution.
|
|
13
|
+
* @param {number} params.width - The width of the video resolution.
|
|
14
|
+
*
|
|
15
|
+
* @see https://www.100ms.live/docs/react-native/v2/how-to-guides/record-and-live-stream/recording
|
|
16
|
+
*/
|
|
4
17
|
export class HMSRtmpVideoResolution {
|
|
5
18
|
constructor(params) {
|
|
6
19
|
_defineProperty(this, "height", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HMSRtmpVideoResolution","constructor","params","_defineProperty","height","width"],"sources":["HMSRtmpVideoResolution.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"names":["HMSRtmpVideoResolution","constructor","params","_defineProperty","height","width"],"sources":["HMSRtmpVideoResolution.ts"],"sourcesContent":["/**\n * Represents the video resolution for RTMP streaming in the HMS (100ms) system.\n *\n * This class encapsulates the dimensions (height and width) of the video resolution to be used for RTMP streaming.\n * It allows for specifying the video quality by defining the resolution, which is crucial for optimizing the streaming experience\n * based on the bandwidth available and the requirements of the streaming platform.\n *\n * @param {Object} params - The constructor parameters.\n * @param {number} params.height - The height of the video resolution.\n * @param {number} params.width - The width of the video resolution.\n *\n * @see https://www.100ms.live/docs/react-native/v2/how-to-guides/record-and-live-stream/recording\n */\nexport class HMSRtmpVideoResolution {\n height: number;\n width: number;\n\n constructor(params: { height: number; width: number }) {\n this.height = params.height;\n this.width = params.width;\n }\n}\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,sBAAsB,CAAC;EAIlCC,WAAWA,CAACC,MAAyC,EAAE;IAAAC,eAAA;IAAAA,eAAA;IACrD,IAAI,CAACC,MAAM,GAAGF,MAAM,CAACE,MAAM;IAC3B,IAAI,CAACC,KAAK,GAAGH,MAAM,CAACG,KAAK;EAC3B;AACF","ignoreList":[]}
|