@100mslive/react-native-hms 1.5.0 → 1.6.1
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/src/main/java/com/reactnativehmssdk/HMSAudioshareActivity.kt +44 -44
- package/android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt +12 -12
- package/android/src/main/java/com/reactnativehmssdk/HMSHelper.kt +35 -35
- package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +52 -24
- package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +245 -62
- package/android/src/main/java/com/reactnativehmssdk/HMSSDKViewManager.kt +4 -3
- package/android/src/main/java/com/reactnativehmssdk/HMSView.kt +40 -33
- package/android/src/main/java/com/reactnativehmssdk/HmsScreenshareActivity.kt +41 -41
- package/android/src/main/java/com/reactnativehmssdk/PipActionReceiver.kt +2 -2
- package/ios/HMSConstants.swift +3 -1
- package/ios/HMSDecoder.swift +1 -1
- package/ios/HMSHelper.swift +44 -7
- package/ios/HMSManager.m +8 -0
- package/ios/HMSManager.swift +35 -1
- package/ios/HMSRNSDK.swift +268 -38
- package/lib/commonjs/classes/HMSAudioMixerSource.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioTrackSettings.js +14 -0
- package/lib/commonjs/classes/HMSAudioTrackSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSEncoder.js +2 -1
- package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
- package/lib/commonjs/classes/HMSIOSAudioMode.js +13 -0
- package/lib/commonjs/classes/HMSIOSAudioMode.js.map +1 -0
- package/lib/commonjs/classes/HMSLocalAudioTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSLocalVideoTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSLogger.js.map +1 -1
- package/lib/commonjs/classes/HMSNativeEventEmitter.js.map +1 -1
- package/lib/commonjs/classes/HMSPeer.js.map +1 -1
- package/lib/commonjs/classes/HMSPeersCache.js.map +1 -1
- package/lib/commonjs/classes/HMSRemoteAudioTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSRemoteVideoTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSRoom.js.map +1 -1
- package/lib/commonjs/classes/HMSRoomCache.js.map +1 -1
- package/lib/commonjs/classes/HMSSDK.js +50 -0
- package/lib/commonjs/classes/HMSSDK.js.map +1 -1
- package/lib/commonjs/classes/HMSSessionStore.js +173 -0
- package/lib/commonjs/classes/HMSSessionStore.js.map +1 -0
- package/lib/commonjs/classes/HMSUpdateListenerActions.js +8 -0
- package/lib/commonjs/classes/HMSUpdateListenerActions.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoTrackSettings.js +5 -0
- package/lib/commonjs/classes/HMSVideoTrackSettings.js.map +1 -1
- package/lib/commonjs/classes/HmsView.js +19 -29
- package/lib/commonjs/classes/HmsView.js.map +1 -1
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/emitter/EventEmitter.js +162 -0
- package/lib/commonjs/utils/emitter/EventEmitter.js.map +1 -0
- package/lib/commonjs/utils/emitter/_EmitterSubscription.js +46 -0
- package/lib/commonjs/utils/emitter/_EmitterSubscription.js.map +1 -0
- package/lib/commonjs/utils/emitter/_EventSubscription.js +36 -0
- package/lib/commonjs/utils/emitter/_EventSubscription.js.map +1 -0
- package/lib/commonjs/utils/emitter/_EventSubscriptionVendor.js +90 -0
- package/lib/commonjs/utils/emitter/_EventSubscriptionVendor.js.map +1 -0
- package/lib/commonjs/utils/index.js +17 -0
- package/lib/commonjs/utils/index.js.map +1 -0
- package/lib/module/classes/HMSAudioMixerSource.js.map +1 -1
- package/lib/module/classes/HMSAudioTrackSettings.js +14 -0
- package/lib/module/classes/HMSAudioTrackSettings.js.map +1 -1
- package/lib/module/classes/HMSEncoder.js +2 -1
- package/lib/module/classes/HMSEncoder.js.map +1 -1
- package/lib/module/classes/HMSIOSAudioMode.js +6 -0
- package/lib/module/classes/HMSIOSAudioMode.js.map +1 -0
- package/lib/module/classes/HMSLocalAudioTrack.js.map +1 -1
- package/lib/module/classes/HMSLocalVideoTrack.js.map +1 -1
- package/lib/module/classes/HMSLogger.js.map +1 -1
- package/lib/module/classes/HMSNativeEventEmitter.js.map +1 -1
- package/lib/module/classes/HMSPeer.js.map +1 -1
- package/lib/module/classes/HMSPeersCache.js.map +1 -1
- package/lib/module/classes/HMSRemoteAudioTrack.js.map +1 -1
- package/lib/module/classes/HMSRemoteVideoTrack.js.map +1 -1
- package/lib/module/classes/HMSRoom.js.map +1 -1
- package/lib/module/classes/HMSRoomCache.js.map +1 -1
- package/lib/module/classes/HMSSDK.js +50 -0
- package/lib/module/classes/HMSSDK.js.map +1 -1
- package/lib/module/classes/HMSSessionStore.js +166 -0
- package/lib/module/classes/HMSSessionStore.js.map +1 -0
- package/lib/module/classes/HMSUpdateListenerActions.js +8 -0
- package/lib/module/classes/HMSUpdateListenerActions.js.map +1 -1
- package/lib/module/classes/HMSVideoTrackSettings.js +5 -0
- package/lib/module/classes/HMSVideoTrackSettings.js.map +1 -1
- package/lib/module/classes/HmsView.js +21 -31
- package/lib/module/classes/HmsView.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/emitter/EventEmitter.js +151 -0
- package/lib/module/utils/emitter/EventEmitter.js.map +1 -0
- package/lib/module/utils/emitter/_EmitterSubscription.js +39 -0
- package/lib/module/utils/emitter/_EmitterSubscription.js.map +1 -0
- package/lib/module/utils/emitter/_EventSubscription.js +29 -0
- package/lib/module/utils/emitter/_EventSubscription.js.map +1 -0
- package/lib/module/utils/emitter/_EventSubscriptionVendor.js +83 -0
- package/lib/module/utils/emitter/_EventSubscriptionVendor.js.map +1 -0
- package/lib/module/utils/index.js +2 -0
- package/lib/module/utils/index.js.map +1 -0
- package/lib/typescript/classes/HMSAudioTrackSettings.d.ts +14 -0
- package/lib/typescript/classes/HMSIOSAudioMode.d.ts +4 -0
- package/lib/typescript/classes/HMSSDK.d.ts +16 -0
- package/lib/typescript/classes/HMSSessionStore.d.ts +63 -0
- package/lib/typescript/classes/HMSUpdateListenerActions.d.ts +9 -1
- package/lib/typescript/classes/HMSVideoTrackSettings.d.ts +5 -0
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/utils/emitter/EventEmitter.d.ts +91 -0
- package/lib/typescript/utils/emitter/_EmitterSubscription.d.ts +29 -0
- package/lib/typescript/utils/emitter/_EventSubscription.d.ts +19 -0
- package/lib/typescript/utils/emitter/_EventSubscriptionVendor.d.ts +44 -0
- package/lib/typescript/utils/index.d.ts +1 -0
- package/package.json +21 -2
- package/sdk-versions.json +2 -2
- package/src/classes/HMSAudioTrackSettings.ts +16 -0
- package/src/classes/HMSEncoder.ts +1 -0
- package/src/classes/HMSIOSAudioMode.ts +4 -0
- package/src/classes/HMSSDK.tsx +70 -4
- package/src/classes/HMSSessionStore.ts +209 -0
- package/src/classes/HMSUpdateListenerActions.ts +8 -0
- package/src/classes/HMSVideoTrackSettings.ts +5 -0
- package/src/classes/HmsView.tsx +21 -32
- package/src/index.ts +5 -0
- package/src/utils/emitter/EventEmitter.ts +160 -0
- package/src/utils/emitter/_EmitterSubscription.ts +44 -0
- package/src/utils/emitter/_EventSubscription.ts +28 -0
- package/src/utils/emitter/_EventSubscriptionVendor.ts +89 -0
- package/src/utils/index.ts +1 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { EventSubscriptionVendor } from './_EventSubscriptionVendor';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* EventSubscription represents a subscription to a particular event. It can
|
|
5
|
+
* remove its own subscription.
|
|
6
|
+
*/
|
|
7
|
+
export class EventSubscription {
|
|
8
|
+
// @ts-ignore this value is assigned after creating instance of class
|
|
9
|
+
eventType: string;
|
|
10
|
+
// @ts-ignore this value is assigned after creating instance of class
|
|
11
|
+
key: number;
|
|
12
|
+
subscriber: EventSubscriptionVendor;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {EventSubscriptionVendor} subscriber the subscriber that controls
|
|
16
|
+
* this subscription.
|
|
17
|
+
*/
|
|
18
|
+
constructor(subscriber: EventSubscriptionVendor) {
|
|
19
|
+
this.subscriber = subscriber;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Removes this subscription from the subscriber that controls it.
|
|
24
|
+
*/
|
|
25
|
+
remove() {
|
|
26
|
+
this.subscriber.removeSubscription(this);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { EventSubscription } from './_EventSubscription';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* EventSubscriptionVendor stores a set of EventSubscriptions that are
|
|
5
|
+
* subscribed to a particular event type.
|
|
6
|
+
*/
|
|
7
|
+
export class EventSubscriptionVendor {
|
|
8
|
+
_subscriptionsForType: Record<string, EventSubscription[] | null | undefined>;
|
|
9
|
+
_currentSubscription: EventSubscription | null | undefined;
|
|
10
|
+
|
|
11
|
+
constructor() {
|
|
12
|
+
this._subscriptionsForType = {};
|
|
13
|
+
this._currentSubscription = null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Adds a subscription keyed by an event type.
|
|
18
|
+
*
|
|
19
|
+
* @param {string} eventType
|
|
20
|
+
* @param {EventSubscription} subscription
|
|
21
|
+
*/
|
|
22
|
+
addSubscription(
|
|
23
|
+
eventType: string,
|
|
24
|
+
subscription: EventSubscription
|
|
25
|
+
): EventSubscription {
|
|
26
|
+
if (subscription.subscriber !== this) {
|
|
27
|
+
console.warn('The subscriber of the subscription is incorrectly set.'); // TODO: throw error or use logger?
|
|
28
|
+
}
|
|
29
|
+
if (!this._subscriptionsForType[eventType]) {
|
|
30
|
+
this._subscriptionsForType[eventType] = [];
|
|
31
|
+
}
|
|
32
|
+
const eventSubscriptions = this._subscriptionsForType[
|
|
33
|
+
eventType
|
|
34
|
+
] as EventSubscription[];
|
|
35
|
+
const key = eventSubscriptions.length;
|
|
36
|
+
eventSubscriptions.push(subscription);
|
|
37
|
+
subscription.eventType = eventType;
|
|
38
|
+
subscription.key = key;
|
|
39
|
+
return subscription;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Removes a bulk set of the subscriptions.
|
|
44
|
+
*
|
|
45
|
+
* @param {?string} eventType - Optional name of the event type whose
|
|
46
|
+
* registered supscriptions to remove, if null or undefined remove all subscriptions.
|
|
47
|
+
*/
|
|
48
|
+
removeAllSubscriptions(eventType: string | undefined | null) {
|
|
49
|
+
if (eventType === undefined || eventType === null) {
|
|
50
|
+
this._subscriptionsForType = {};
|
|
51
|
+
} else {
|
|
52
|
+
delete this._subscriptionsForType[eventType];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Removes a specific subscription. Instead of calling this function, call
|
|
58
|
+
* `subscription.remove()` directly.
|
|
59
|
+
*
|
|
60
|
+
* @param {object} subscription
|
|
61
|
+
*/
|
|
62
|
+
removeSubscription(subscription: EventSubscription) {
|
|
63
|
+
const eventType = subscription.eventType;
|
|
64
|
+
const key = subscription.key;
|
|
65
|
+
|
|
66
|
+
const subscriptionsForType = this._subscriptionsForType[eventType];
|
|
67
|
+
if (subscriptionsForType) {
|
|
68
|
+
delete subscriptionsForType[key];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Returns the array of subscriptions that are currently registered for the
|
|
74
|
+
* given event type.
|
|
75
|
+
*
|
|
76
|
+
* Note: This array can be potentially sparse as subscriptions are deleted
|
|
77
|
+
* from it when they are removed.
|
|
78
|
+
*
|
|
79
|
+
* TODO: This returns a nullable array. wat?
|
|
80
|
+
*
|
|
81
|
+
* @param {string} eventType
|
|
82
|
+
* @returns {?array}
|
|
83
|
+
*/
|
|
84
|
+
getSubscriptionsForType(
|
|
85
|
+
eventType: string
|
|
86
|
+
): EventSubscription[] | null | undefined {
|
|
87
|
+
return this._subscriptionsForType[eventType];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './emitter/EventEmitter';
|