@applooma/rtc-react-native 0.1.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/LICENSE +21 -0
- package/THIRD-PARTY-LICENSES +6 -0
- package/dist/index.d.mts +125 -0
- package/dist/index.d.ts +125 -0
- package/dist/index.js +30107 -0
- package/dist/index.mjs +30077 -0
- package/package.json +68 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AppLooma LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* AppLooma RTC React Native SDK
|
|
6
|
+
* © AppLooma LLC
|
|
7
|
+
*
|
|
8
|
+
* Call initAppLooma() once at app startup (before joining any channel):
|
|
9
|
+
*
|
|
10
|
+
* import { initAppLooma, AppEngine } from '@applooma/rtc-react-native';
|
|
11
|
+
* initAppLooma();
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
type AppRole = 'host' | 'cohost' | 'audience';
|
|
15
|
+
type AppConnectionState = 'connecting' | 'connected' | 'reconnecting' | 'disconnected';
|
|
16
|
+
interface AppEngineConfig {
|
|
17
|
+
/** Your AppLooma RTC App ID from applooma.dev/dashboard */
|
|
18
|
+
appId: string;
|
|
19
|
+
}
|
|
20
|
+
interface AppJoinOptions {
|
|
21
|
+
role?: AppRole;
|
|
22
|
+
camera?: boolean;
|
|
23
|
+
microphone?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** Must be called once at app startup, before creating an engine. */
|
|
26
|
+
declare function initAppLooma(): void;
|
|
27
|
+
declare class AppRemoteUser {
|
|
28
|
+
private p;
|
|
29
|
+
get uid(): string;
|
|
30
|
+
get displayName(): string | undefined;
|
|
31
|
+
get metadata(): string | undefined;
|
|
32
|
+
get isSpeaking(): boolean;
|
|
33
|
+
get hasVideo(): boolean;
|
|
34
|
+
}
|
|
35
|
+
interface AppEventMap {
|
|
36
|
+
'user-joined': (user: AppRemoteUser) => void;
|
|
37
|
+
'user-left': (user: AppRemoteUser) => void;
|
|
38
|
+
/** A remote user's camera or microphone became available to render. */
|
|
39
|
+
'track-subscribed': (user: AppRemoteUser) => void;
|
|
40
|
+
'track-unsubscribed': (user: AppRemoteUser) => void;
|
|
41
|
+
'connection-state-changed': (state: AppConnectionState) => void;
|
|
42
|
+
'data-received': (data: Uint8Array, from?: AppRemoteUser) => void;
|
|
43
|
+
'gift-received': (gift: AppGiftEvent) => void;
|
|
44
|
+
'active-speakers-changed': (uids: string[]) => void;
|
|
45
|
+
}
|
|
46
|
+
/** A virtual gift broadcast to the room (sent via your server's POST /v1/gifts/send). */
|
|
47
|
+
interface AppGiftEvent {
|
|
48
|
+
txId: string;
|
|
49
|
+
gift: {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
imageUrl: string;
|
|
53
|
+
coinPrice: number;
|
|
54
|
+
};
|
|
55
|
+
sender: string;
|
|
56
|
+
receiver: string;
|
|
57
|
+
quantity: number;
|
|
58
|
+
sentAt: string;
|
|
59
|
+
}
|
|
60
|
+
declare class AppEngine {
|
|
61
|
+
readonly config: AppEngineConfig;
|
|
62
|
+
private room;
|
|
63
|
+
private listeners;
|
|
64
|
+
private users;
|
|
65
|
+
private joined;
|
|
66
|
+
private constructor();
|
|
67
|
+
static create(config: AppEngineConfig): AppEngine;
|
|
68
|
+
joinChannel(token: string, wsUrl: string, options?: AppJoinOptions): Promise<void>;
|
|
69
|
+
leaveChannel(): Promise<void>;
|
|
70
|
+
/** Emits joined/subscribed events for everyone already present at join time. */
|
|
71
|
+
private seedExistingParticipants;
|
|
72
|
+
/**
|
|
73
|
+
* Release the engine. After this the instance cannot be reused.
|
|
74
|
+
*/
|
|
75
|
+
destroy(): Promise<void>;
|
|
76
|
+
enableCamera(on?: boolean): Promise<void>;
|
|
77
|
+
enableMicrophone(on?: boolean): Promise<void>;
|
|
78
|
+
sendData(data: Uint8Array | string, reliable?: boolean): Promise<void>;
|
|
79
|
+
get connectionState(): AppConnectionState;
|
|
80
|
+
get localUid(): string;
|
|
81
|
+
get channelName(): string;
|
|
82
|
+
get remoteUsers(): AppRemoteUser[];
|
|
83
|
+
on<K extends keyof AppEventMap>(event: K, cb: AppEventMap[K]): this;
|
|
84
|
+
off<K extends keyof AppEventMap>(event: K, cb: AppEventMap[K]): this;
|
|
85
|
+
private emit;
|
|
86
|
+
private userFor;
|
|
87
|
+
private wireEvents;
|
|
88
|
+
}
|
|
89
|
+
declare function useAppEngine(config: AppEngineConfig): {
|
|
90
|
+
engine: AppEngine;
|
|
91
|
+
connectionState: AppConnectionState;
|
|
92
|
+
remoteUsers: AppRemoteUser[];
|
|
93
|
+
join: (token: string, wsUrl: string, options?: AppJoinOptions) => Promise<void>;
|
|
94
|
+
leave: () => Promise<void>;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Renders a remote user's camera, or the local preview when `local` is set.
|
|
98
|
+
*
|
|
99
|
+
* The underlying component needs a full track reference — participant,
|
|
100
|
+
* publication and source. The previous version passed `publication: undefined`,
|
|
101
|
+
* which threw a TypeError on every render and made video impossible on this
|
|
102
|
+
* platform.
|
|
103
|
+
*/
|
|
104
|
+
declare function AppVideoView({ user, engine, local, style, mirror, }: {
|
|
105
|
+
/** Remote user to render. Ignored when `local` is set. */
|
|
106
|
+
user?: AppRemoteUser;
|
|
107
|
+
/** Required when rendering the local preview. */
|
|
108
|
+
engine?: AppEngine;
|
|
109
|
+
local?: boolean;
|
|
110
|
+
style?: StyleProp<ViewStyle>;
|
|
111
|
+
mirror?: boolean;
|
|
112
|
+
}): React.JSX.Element | null;
|
|
113
|
+
/**
|
|
114
|
+
* Manages the iOS audio session for a call. Call it once in a component that
|
|
115
|
+
* lives for the duration of the call. No effect on Android.
|
|
116
|
+
*/
|
|
117
|
+
/**
|
|
118
|
+
* Configures the iOS audio session for a call: routing, the speaker, and
|
|
119
|
+
* interruptions from incoming phone calls. Call it in the component that lives
|
|
120
|
+
* for the duration of the call. It does nothing on Android, so it is safe to
|
|
121
|
+
* call unconditionally.
|
|
122
|
+
*/
|
|
123
|
+
declare function useAppAudioSession(engine: AppEngine): void;
|
|
124
|
+
|
|
125
|
+
export { type AppConnectionState, AppEngine, type AppEngineConfig, type AppEventMap, type AppGiftEvent, type AppJoinOptions, AppRemoteUser, type AppRole, AppVideoView, AppEngine as default, initAppLooma, useAppAudioSession, useAppEngine };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* AppLooma RTC React Native SDK
|
|
6
|
+
* © AppLooma LLC
|
|
7
|
+
*
|
|
8
|
+
* Call initAppLooma() once at app startup (before joining any channel):
|
|
9
|
+
*
|
|
10
|
+
* import { initAppLooma, AppEngine } from '@applooma/rtc-react-native';
|
|
11
|
+
* initAppLooma();
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
type AppRole = 'host' | 'cohost' | 'audience';
|
|
15
|
+
type AppConnectionState = 'connecting' | 'connected' | 'reconnecting' | 'disconnected';
|
|
16
|
+
interface AppEngineConfig {
|
|
17
|
+
/** Your AppLooma RTC App ID from applooma.dev/dashboard */
|
|
18
|
+
appId: string;
|
|
19
|
+
}
|
|
20
|
+
interface AppJoinOptions {
|
|
21
|
+
role?: AppRole;
|
|
22
|
+
camera?: boolean;
|
|
23
|
+
microphone?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** Must be called once at app startup, before creating an engine. */
|
|
26
|
+
declare function initAppLooma(): void;
|
|
27
|
+
declare class AppRemoteUser {
|
|
28
|
+
private p;
|
|
29
|
+
get uid(): string;
|
|
30
|
+
get displayName(): string | undefined;
|
|
31
|
+
get metadata(): string | undefined;
|
|
32
|
+
get isSpeaking(): boolean;
|
|
33
|
+
get hasVideo(): boolean;
|
|
34
|
+
}
|
|
35
|
+
interface AppEventMap {
|
|
36
|
+
'user-joined': (user: AppRemoteUser) => void;
|
|
37
|
+
'user-left': (user: AppRemoteUser) => void;
|
|
38
|
+
/** A remote user's camera or microphone became available to render. */
|
|
39
|
+
'track-subscribed': (user: AppRemoteUser) => void;
|
|
40
|
+
'track-unsubscribed': (user: AppRemoteUser) => void;
|
|
41
|
+
'connection-state-changed': (state: AppConnectionState) => void;
|
|
42
|
+
'data-received': (data: Uint8Array, from?: AppRemoteUser) => void;
|
|
43
|
+
'gift-received': (gift: AppGiftEvent) => void;
|
|
44
|
+
'active-speakers-changed': (uids: string[]) => void;
|
|
45
|
+
}
|
|
46
|
+
/** A virtual gift broadcast to the room (sent via your server's POST /v1/gifts/send). */
|
|
47
|
+
interface AppGiftEvent {
|
|
48
|
+
txId: string;
|
|
49
|
+
gift: {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
imageUrl: string;
|
|
53
|
+
coinPrice: number;
|
|
54
|
+
};
|
|
55
|
+
sender: string;
|
|
56
|
+
receiver: string;
|
|
57
|
+
quantity: number;
|
|
58
|
+
sentAt: string;
|
|
59
|
+
}
|
|
60
|
+
declare class AppEngine {
|
|
61
|
+
readonly config: AppEngineConfig;
|
|
62
|
+
private room;
|
|
63
|
+
private listeners;
|
|
64
|
+
private users;
|
|
65
|
+
private joined;
|
|
66
|
+
private constructor();
|
|
67
|
+
static create(config: AppEngineConfig): AppEngine;
|
|
68
|
+
joinChannel(token: string, wsUrl: string, options?: AppJoinOptions): Promise<void>;
|
|
69
|
+
leaveChannel(): Promise<void>;
|
|
70
|
+
/** Emits joined/subscribed events for everyone already present at join time. */
|
|
71
|
+
private seedExistingParticipants;
|
|
72
|
+
/**
|
|
73
|
+
* Release the engine. After this the instance cannot be reused.
|
|
74
|
+
*/
|
|
75
|
+
destroy(): Promise<void>;
|
|
76
|
+
enableCamera(on?: boolean): Promise<void>;
|
|
77
|
+
enableMicrophone(on?: boolean): Promise<void>;
|
|
78
|
+
sendData(data: Uint8Array | string, reliable?: boolean): Promise<void>;
|
|
79
|
+
get connectionState(): AppConnectionState;
|
|
80
|
+
get localUid(): string;
|
|
81
|
+
get channelName(): string;
|
|
82
|
+
get remoteUsers(): AppRemoteUser[];
|
|
83
|
+
on<K extends keyof AppEventMap>(event: K, cb: AppEventMap[K]): this;
|
|
84
|
+
off<K extends keyof AppEventMap>(event: K, cb: AppEventMap[K]): this;
|
|
85
|
+
private emit;
|
|
86
|
+
private userFor;
|
|
87
|
+
private wireEvents;
|
|
88
|
+
}
|
|
89
|
+
declare function useAppEngine(config: AppEngineConfig): {
|
|
90
|
+
engine: AppEngine;
|
|
91
|
+
connectionState: AppConnectionState;
|
|
92
|
+
remoteUsers: AppRemoteUser[];
|
|
93
|
+
join: (token: string, wsUrl: string, options?: AppJoinOptions) => Promise<void>;
|
|
94
|
+
leave: () => Promise<void>;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Renders a remote user's camera, or the local preview when `local` is set.
|
|
98
|
+
*
|
|
99
|
+
* The underlying component needs a full track reference — participant,
|
|
100
|
+
* publication and source. The previous version passed `publication: undefined`,
|
|
101
|
+
* which threw a TypeError on every render and made video impossible on this
|
|
102
|
+
* platform.
|
|
103
|
+
*/
|
|
104
|
+
declare function AppVideoView({ user, engine, local, style, mirror, }: {
|
|
105
|
+
/** Remote user to render. Ignored when `local` is set. */
|
|
106
|
+
user?: AppRemoteUser;
|
|
107
|
+
/** Required when rendering the local preview. */
|
|
108
|
+
engine?: AppEngine;
|
|
109
|
+
local?: boolean;
|
|
110
|
+
style?: StyleProp<ViewStyle>;
|
|
111
|
+
mirror?: boolean;
|
|
112
|
+
}): React.JSX.Element | null;
|
|
113
|
+
/**
|
|
114
|
+
* Manages the iOS audio session for a call. Call it once in a component that
|
|
115
|
+
* lives for the duration of the call. No effect on Android.
|
|
116
|
+
*/
|
|
117
|
+
/**
|
|
118
|
+
* Configures the iOS audio session for a call: routing, the speaker, and
|
|
119
|
+
* interruptions from incoming phone calls. Call it in the component that lives
|
|
120
|
+
* for the duration of the call. It does nothing on Android, so it is safe to
|
|
121
|
+
* call unconditionally.
|
|
122
|
+
*/
|
|
123
|
+
declare function useAppAudioSession(engine: AppEngine): void;
|
|
124
|
+
|
|
125
|
+
export { type AppConnectionState, AppEngine, type AppEngineConfig, type AppEventMap, type AppGiftEvent, type AppJoinOptions, AppRemoteUser, type AppRole, AppVideoView, AppEngine as default, initAppLooma, useAppAudioSession, useAppEngine };
|