@livekit/react-native 0.2.2

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.
Files changed (60) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +141 -0
  3. package/android/build.gradle +133 -0
  4. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  5. package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  6. package/android/gradle.properties +3 -0
  7. package/android/gradlew +185 -0
  8. package/android/gradlew.bat +89 -0
  9. package/android/local.properties +8 -0
  10. package/android/src/main/AndroidManifest.xml +13 -0
  11. package/android/src/main/java/com/livekit/reactnative/LivekitReactNativeModule.kt +50 -0
  12. package/android/src/main/java/com/livekit/reactnative/LivekitReactNativePackage.kt +17 -0
  13. package/android/src/main/java/com/livekit/reactnative/audio/AudioDeviceKind.java +40 -0
  14. package/android/src/main/java/com/livekit/reactnative/audio/AudioSwitchManager.java +140 -0
  15. package/ios/LivekitReactNative-Bridging-Header.h +2 -0
  16. package/ios/LivekitReactNative.h +11 -0
  17. package/ios/LivekitReactNative.m +111 -0
  18. package/ios/LivekitReactNative.xcodeproj/project.pbxproj +274 -0
  19. package/ios/LivekitReactNative.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -0
  20. package/ios/LivekitReactNative.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  21. package/ios/LivekitReactNative.xcodeproj/project.xcworkspace/xcuserdata/davidliu.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  22. package/ios/LivekitReactNative.xcodeproj/xcuserdata/davidliu.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  23. package/lib/commonjs/audio/AudioSession.js +80 -0
  24. package/lib/commonjs/audio/AudioSession.js.map +1 -0
  25. package/lib/commonjs/components/VideoView.js +165 -0
  26. package/lib/commonjs/components/VideoView.js.map +1 -0
  27. package/lib/commonjs/components/ViewPortDetector.js +109 -0
  28. package/lib/commonjs/components/ViewPortDetector.js.map +1 -0
  29. package/lib/commonjs/index.js +103 -0
  30. package/lib/commonjs/index.js.map +1 -0
  31. package/lib/commonjs/useParticipant.js +100 -0
  32. package/lib/commonjs/useParticipant.js.map +1 -0
  33. package/lib/commonjs/useRoom.js +137 -0
  34. package/lib/commonjs/useRoom.js.map +1 -0
  35. package/lib/module/audio/AudioSession.js +70 -0
  36. package/lib/module/audio/AudioSession.js.map +1 -0
  37. package/lib/module/components/VideoView.js +144 -0
  38. package/lib/module/components/VideoView.js.map +1 -0
  39. package/lib/module/components/ViewPortDetector.js +97 -0
  40. package/lib/module/components/ViewPortDetector.js.map +1 -0
  41. package/lib/module/index.js +45 -0
  42. package/lib/module/index.js.map +1 -0
  43. package/lib/module/useParticipant.js +91 -0
  44. package/lib/module/useParticipant.js.map +1 -0
  45. package/lib/module/useRoom.js +126 -0
  46. package/lib/module/useRoom.js.map +1 -0
  47. package/lib/typescript/audio/AudioSession.d.ts +88 -0
  48. package/lib/typescript/components/VideoView.d.ts +10 -0
  49. package/lib/typescript/components/ViewPortDetector.d.ts +26 -0
  50. package/lib/typescript/index.d.ts +12 -0
  51. package/lib/typescript/useParticipant.d.ts +13 -0
  52. package/lib/typescript/useRoom.d.ts +20 -0
  53. package/livekit-react-native.podspec +22 -0
  54. package/package.json +157 -0
  55. package/src/audio/AudioSession.ts +132 -0
  56. package/src/components/VideoView.tsx +143 -0
  57. package/src/components/ViewPortDetector.tsx +93 -0
  58. package/src/index.tsx +37 -0
  59. package/src/useParticipant.ts +144 -0
  60. package/src/useRoom.ts +163 -0
@@ -0,0 +1,274 @@
1
+ // !$*UTF8*$!
2
+ {
3
+ archiveVersion = 1;
4
+ classes = {
5
+ };
6
+ objectVersion = 46;
7
+ objects = {
8
+
9
+ /* Begin PBXCopyFilesBuildPhase section */
10
+ 58B511D91A9E6C8500147676 /* CopyFiles */ = {
11
+ isa = PBXCopyFilesBuildPhase;
12
+ buildActionMask = 2147483647;
13
+ dstPath = "include/$(PRODUCT_NAME)";
14
+ dstSubfolderSpec = 16;
15
+ files = (
16
+ );
17
+ runOnlyForDeploymentPostprocessing = 0;
18
+ };
19
+ /* End PBXCopyFilesBuildPhase section */
20
+
21
+ /* Begin PBXFileReference section */
22
+ 134814201AA4EA6300B7C361 /* libLivekitReactNative.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libLivekitReactNative.a; sourceTree = BUILT_PRODUCTS_DIR; };
23
+ B3E7B5891CC2AC0600A0062D /* LivekitReactNative.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LivekitReactNative.m; sourceTree = "<group>"; };
24
+ D7A6507C28C3C54500AC4DB2 /* LivekitReactNative.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LivekitReactNative.h; sourceTree = "<group>"; };
25
+ F4FF95D5245B92E700C19C63 /* LivekitReactNative-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "LivekitReactNative-Bridging-Header.h"; sourceTree = "<group>"; };
26
+ /* End PBXFileReference section */
27
+
28
+ /* Begin PBXFrameworksBuildPhase section */
29
+ 58B511D81A9E6C8500147676 /* Frameworks */ = {
30
+ isa = PBXFrameworksBuildPhase;
31
+ buildActionMask = 2147483647;
32
+ files = (
33
+ );
34
+ runOnlyForDeploymentPostprocessing = 0;
35
+ };
36
+ /* End PBXFrameworksBuildPhase section */
37
+
38
+ /* Begin PBXGroup section */
39
+ 134814211AA4EA7D00B7C361 /* Products */ = {
40
+ isa = PBXGroup;
41
+ children = (
42
+ 134814201AA4EA6300B7C361 /* libLivekitReactNative.a */,
43
+ );
44
+ name = Products;
45
+ sourceTree = "<group>";
46
+ };
47
+ 58B511D21A9E6C8500147676 = {
48
+ isa = PBXGroup;
49
+ children = (
50
+ B3E7B5891CC2AC0600A0062D /* LivekitReactNative.m */,
51
+ D7A6507C28C3C54500AC4DB2 /* LivekitReactNative.h */,
52
+ F4FF95D5245B92E700C19C63 /* LivekitReactNative-Bridging-Header.h */,
53
+ 134814211AA4EA7D00B7C361 /* Products */,
54
+ );
55
+ sourceTree = "<group>";
56
+ };
57
+ /* End PBXGroup section */
58
+
59
+ /* Begin PBXNativeTarget section */
60
+ 58B511DA1A9E6C8500147676 /* LivekitReactNative */ = {
61
+ isa = PBXNativeTarget;
62
+ buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "LivekitReactNative" */;
63
+ buildPhases = (
64
+ 58B511D71A9E6C8500147676 /* Sources */,
65
+ 58B511D81A9E6C8500147676 /* Frameworks */,
66
+ 58B511D91A9E6C8500147676 /* CopyFiles */,
67
+ );
68
+ buildRules = (
69
+ );
70
+ dependencies = (
71
+ );
72
+ name = LivekitReactNative;
73
+ productName = RCTDataManager;
74
+ productReference = 134814201AA4EA6300B7C361 /* libLivekitReactNative.a */;
75
+ productType = "com.apple.product-type.library.static";
76
+ };
77
+ /* End PBXNativeTarget section */
78
+
79
+ /* Begin PBXProject section */
80
+ 58B511D31A9E6C8500147676 /* Project object */ = {
81
+ isa = PBXProject;
82
+ attributes = {
83
+ LastUpgradeCheck = 0920;
84
+ ORGANIZATIONNAME = Facebook;
85
+ TargetAttributes = {
86
+ 58B511DA1A9E6C8500147676 = {
87
+ CreatedOnToolsVersion = 6.1.1;
88
+ };
89
+ };
90
+ };
91
+ buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "LivekitReactNative" */;
92
+ compatibilityVersion = "Xcode 3.2";
93
+ developmentRegion = English;
94
+ hasScannedForEncodings = 0;
95
+ knownRegions = (
96
+ English,
97
+ en,
98
+ );
99
+ mainGroup = 58B511D21A9E6C8500147676;
100
+ productRefGroup = 58B511D21A9E6C8500147676;
101
+ projectDirPath = "";
102
+ projectRoot = "";
103
+ targets = (
104
+ 58B511DA1A9E6C8500147676 /* LivekitReactNative */,
105
+ );
106
+ };
107
+ /* End PBXProject section */
108
+
109
+ /* Begin PBXSourcesBuildPhase section */
110
+ 58B511D71A9E6C8500147676 /* Sources */ = {
111
+ isa = PBXSourcesBuildPhase;
112
+ buildActionMask = 2147483647;
113
+ files = (
114
+ );
115
+ runOnlyForDeploymentPostprocessing = 0;
116
+ };
117
+ /* End PBXSourcesBuildPhase section */
118
+
119
+ /* Begin XCBuildConfiguration section */
120
+ 58B511ED1A9E6C8500147676 /* Debug */ = {
121
+ isa = XCBuildConfiguration;
122
+ buildSettings = {
123
+ ALWAYS_SEARCH_USER_PATHS = NO;
124
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
125
+ CLANG_CXX_LIBRARY = "libc++";
126
+ CLANG_ENABLE_MODULES = YES;
127
+ CLANG_ENABLE_OBJC_ARC = YES;
128
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
129
+ CLANG_WARN_BOOL_CONVERSION = YES;
130
+ CLANG_WARN_COMMA = YES;
131
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
132
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
133
+ CLANG_WARN_EMPTY_BODY = YES;
134
+ CLANG_WARN_ENUM_CONVERSION = YES;
135
+ CLANG_WARN_INFINITE_RECURSION = YES;
136
+ CLANG_WARN_INT_CONVERSION = YES;
137
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
138
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
139
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
140
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
141
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
142
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
143
+ CLANG_WARN_UNREACHABLE_CODE = YES;
144
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
145
+ COPY_PHASE_STRIP = NO;
146
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
147
+ ENABLE_TESTABILITY = YES;
148
+ GCC_C_LANGUAGE_STANDARD = gnu99;
149
+ GCC_DYNAMIC_NO_PIC = NO;
150
+ GCC_NO_COMMON_BLOCKS = YES;
151
+ GCC_OPTIMIZATION_LEVEL = 0;
152
+ GCC_PREPROCESSOR_DEFINITIONS = (
153
+ "DEBUG=1",
154
+ "$(inherited)",
155
+ );
156
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
157
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
158
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
159
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
160
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
161
+ GCC_WARN_UNUSED_FUNCTION = YES;
162
+ GCC_WARN_UNUSED_VARIABLE = YES;
163
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
164
+ MTL_ENABLE_DEBUG_INFO = YES;
165
+ ONLY_ACTIVE_ARCH = YES;
166
+ SDKROOT = iphoneos;
167
+ };
168
+ name = Debug;
169
+ };
170
+ 58B511EE1A9E6C8500147676 /* Release */ = {
171
+ isa = XCBuildConfiguration;
172
+ buildSettings = {
173
+ ALWAYS_SEARCH_USER_PATHS = NO;
174
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
175
+ CLANG_CXX_LIBRARY = "libc++";
176
+ CLANG_ENABLE_MODULES = YES;
177
+ CLANG_ENABLE_OBJC_ARC = YES;
178
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
179
+ CLANG_WARN_BOOL_CONVERSION = YES;
180
+ CLANG_WARN_COMMA = YES;
181
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
182
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
183
+ CLANG_WARN_EMPTY_BODY = YES;
184
+ CLANG_WARN_ENUM_CONVERSION = YES;
185
+ CLANG_WARN_INFINITE_RECURSION = YES;
186
+ CLANG_WARN_INT_CONVERSION = YES;
187
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
188
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
189
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
190
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
191
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
192
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
193
+ CLANG_WARN_UNREACHABLE_CODE = YES;
194
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
195
+ COPY_PHASE_STRIP = YES;
196
+ ENABLE_NS_ASSERTIONS = NO;
197
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
198
+ GCC_C_LANGUAGE_STANDARD = gnu99;
199
+ GCC_NO_COMMON_BLOCKS = YES;
200
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
201
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
202
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
203
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
204
+ GCC_WARN_UNUSED_FUNCTION = YES;
205
+ GCC_WARN_UNUSED_VARIABLE = YES;
206
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
207
+ MTL_ENABLE_DEBUG_INFO = NO;
208
+ SDKROOT = iphoneos;
209
+ VALIDATE_PRODUCT = YES;
210
+ };
211
+ name = Release;
212
+ };
213
+ 58B511F01A9E6C8500147676 /* Debug */ = {
214
+ isa = XCBuildConfiguration;
215
+ buildSettings = {
216
+ HEADER_SEARCH_PATHS = (
217
+ "$(inherited)",
218
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
219
+ "$(SRCROOT)/../../../React/**",
220
+ "$(SRCROOT)/../../react-native/React/**",
221
+ );
222
+ LIBRARY_SEARCH_PATHS = "$(inherited)";
223
+ OTHER_LDFLAGS = "-ObjC";
224
+ PRODUCT_NAME = LivekitReactNative;
225
+ SKIP_INSTALL = YES;
226
+ SWIFT_OBJC_BRIDGING_HEADER = "LivekitReactNative-Bridging-Header.h";
227
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
228
+ SWIFT_VERSION = 5.0;
229
+ };
230
+ name = Debug;
231
+ };
232
+ 58B511F11A9E6C8500147676 /* Release */ = {
233
+ isa = XCBuildConfiguration;
234
+ buildSettings = {
235
+ HEADER_SEARCH_PATHS = (
236
+ "$(inherited)",
237
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
238
+ "$(SRCROOT)/../../../React/**",
239
+ "$(SRCROOT)/../../react-native/React/**",
240
+ );
241
+ LIBRARY_SEARCH_PATHS = "$(inherited)";
242
+ OTHER_LDFLAGS = "-ObjC";
243
+ PRODUCT_NAME = LivekitReactNative;
244
+ SKIP_INSTALL = YES;
245
+ SWIFT_OBJC_BRIDGING_HEADER = "LivekitReactNative-Bridging-Header.h";
246
+ SWIFT_VERSION = 5.0;
247
+ };
248
+ name = Release;
249
+ };
250
+ /* End XCBuildConfiguration section */
251
+
252
+ /* Begin XCConfigurationList section */
253
+ 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "LivekitReactNative" */ = {
254
+ isa = XCConfigurationList;
255
+ buildConfigurations = (
256
+ 58B511ED1A9E6C8500147676 /* Debug */,
257
+ 58B511EE1A9E6C8500147676 /* Release */,
258
+ );
259
+ defaultConfigurationIsVisible = 0;
260
+ defaultConfigurationName = Release;
261
+ };
262
+ 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "LivekitReactNative" */ = {
263
+ isa = XCConfigurationList;
264
+ buildConfigurations = (
265
+ 58B511F01A9E6C8500147676 /* Debug */,
266
+ 58B511F11A9E6C8500147676 /* Release */,
267
+ );
268
+ defaultConfigurationIsVisible = 0;
269
+ defaultConfigurationName = Release;
270
+ };
271
+ /* End XCConfigurationList section */
272
+ };
273
+ rootObject = 58B511D31A9E6C8500147676 /* Project object */;
274
+ }
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ </Workspace>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>IDEDidComputeMac32BitWarning</key>
6
+ <true/>
7
+ </dict>
8
+ </plist>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>SchemeUserState</key>
6
+ <dict>
7
+ <key>LivekitReactNative.xcscheme_^#shared#^_</key>
8
+ <dict>
9
+ <key>orderHint</key>
10
+ <integer>0</integer>
11
+ </dict>
12
+ </dict>
13
+ </dict>
14
+ </plist>
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _reactNative = require("react-native");
9
+
10
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
+
12
+ const LINKING_ERROR = `The package 'livekit-react-native' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
13
+ ios: "- You have run 'pod install'\n",
14
+ default: ''
15
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
16
+ const LivekitReactNative = _reactNative.NativeModules.LivekitReactNative ? _reactNative.NativeModules.LivekitReactNative : new Proxy({}, {
17
+ get() {
18
+ throw new Error(LINKING_ERROR);
19
+ }
20
+
21
+ });
22
+ /**
23
+ * Configuration for the underlying AudioSession.
24
+ *
25
+ * ----
26
+ * Android specific options:
27
+ *
28
+ * * preferredOutputList - The preferred order in which to automatically select an audio output.
29
+ * This is ignored when an output is manually selected with {@link AudioSession.selectAudioOutput}.
30
+ *
31
+ * By default, the order is set to:
32
+ * 1. `"speaker"`
33
+ * 2. `"earpiece"`
34
+ * 3. `"headset"`
35
+ * 4. `"bluetooth"`
36
+ *
37
+ * ----
38
+ * iOS
39
+ *
40
+ * * defaultOutput - The default preferred output to use when a wired headset or bluetooth output is unavailable.
41
+ *
42
+ * By default, this is set to `"speaker"`
43
+ */
44
+
45
+ class AudioSession {}
46
+
47
+ exports.default = AudioSession;
48
+
49
+ _defineProperty(AudioSession, "configureAudio", async config => {
50
+ await LivekitReactNative.configureAudio(config);
51
+ });
52
+
53
+ _defineProperty(AudioSession, "startAudioSession", async () => {
54
+ await LivekitReactNative.startAudioSession();
55
+ });
56
+
57
+ _defineProperty(AudioSession, "stopAudioSession", async () => {
58
+ await LivekitReactNative.stopAudioSession();
59
+ });
60
+
61
+ _defineProperty(AudioSession, "getAudioOutputs", async () => {
62
+ if (_reactNative.Platform.OS === 'ios') {
63
+ return ['default', 'force_speaker'];
64
+ } else if (_reactNative.Platform.OS === 'android') {
65
+ return await LivekitReactNative.getAudioOutputs();
66
+ } else {
67
+ return [];
68
+ }
69
+ });
70
+
71
+ _defineProperty(AudioSession, "selectAudioOutput", async deviceId => {
72
+ await LivekitReactNative.selectAudioOutput(deviceId);
73
+ });
74
+
75
+ _defineProperty(AudioSession, "showAudioRoutePicker", async () => {
76
+ if (_reactNative.Platform.OS === 'ios') {
77
+ await LivekitReactNative.showAudioRoutePicker();
78
+ }
79
+ });
80
+ //# sourceMappingURL=AudioSession.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["AudioSession.ts"],"names":["LINKING_ERROR","Platform","select","ios","default","LivekitReactNative","NativeModules","Proxy","get","Error","AudioSession","config","configureAudio","startAudioSession","stopAudioSession","OS","getAudioOutputs","deviceId","selectAudioOutput","showAudioRoutePicker"],"mappings":";;;;;;;AAAA;;;;AACA,MAAMA,aAAa,GAChB,+EAAD,GACAC,sBAASC,M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ourcesContent":["import { NativeModules, Platform } from 'react-native';\nconst LINKING_ERROR =\n `The package 'livekit-react-native' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst LivekitReactNative = NativeModules.LivekitReactNative\n ? NativeModules.LivekitReactNative\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\n/**\n * Configuration for the underlying AudioSession.\n *\n * ----\n * Android specific options:\n *\n * * preferredOutputList - The preferred order in which to automatically select an audio output.\n * This is ignored when an output is manually selected with {@link AudioSession.selectAudioOutput}.\n *\n * By default, the order is set to:\n * 1. `\"speaker\"`\n * 2. `\"earpiece\"`\n * 3. `\"headset\"`\n * 4. `\"bluetooth\"`\n *\n * ----\n * iOS\n *\n * * defaultOutput - The default preferred output to use when a wired headset or bluetooth output is unavailable.\n *\n * By default, this is set to `\"speaker\"`\n */\nexport type AudioConfiguration = {\n android: {\n preferredOutputList: ('speaker' | 'earpiece' | 'headset' | 'bluetooth')[];\n };\n ios: {\n defaultOutput: 'speaker' | 'earpiece';\n };\n};\n\nexport default class AudioSession {\n /**\n * Applies the provided audio configuration to the underlying AudioSession.\n *\n * Must be called prior to connecting to a Room for the configuration to apply correctly.\n */\n static configureAudio = async (config: AudioConfiguration) => {\n await LivekitReactNative.configureAudio(config);\n };\n\n /**\n * Starts an AudioSession.\n */\n static startAudioSession = async () => {\n await LivekitReactNative.startAudioSession();\n };\n\n /**\n * Stops the existing AudioSession.\n */\n static stopAudioSession = async () => {\n await LivekitReactNative.stopAudioSession();\n };\n\n /**\n * Gets the available audio outputs for use with {@link selectAudioOutput}.\n *\n * {@link startAudioSession} must be called prior to using this method.\n *\n * For Android, will return if available:\n * * \"speaker\"\n * * \"earpiece\"\n * * \"headset\"\n * * \"bluetooth\"\n *\n * Note: For applications targeting SDK versions over 30, the runtime BLUETOOTH_CONNECT\n * permission must be requested to send audio to bluetooth headsets.\n *\n * ----\n *\n * For iOS, due to OS limitations, the only available types are:\n * * \"default\" - Use default iOS audio routing\n * * \"force_speaker\" - Force audio output through speaker\n *\n * See also {@link showAudioRoutePicker} to display a route picker that\n * can choose between other audio devices (i.e. headset/bluetooth/airplay),\n * or use a library like `react-native-avroutepicker` for a native platform\n * control.\n *\n * @returns the available audio output types\n */\n static getAudioOutputs = async (): Promise<string[]> => {\n if (Platform.OS === 'ios') {\n return ['default', 'force_speaker'];\n } else if (Platform.OS === 'android') {\n return (await LivekitReactNative.getAudioOutputs()) as string[];\n } else {\n return [];\n }\n };\n\n /**\n * Select the provided audio output if available.\n *\n * {@link startAudioSession} must be called prior to using this method.\n *\n * @param deviceId A deviceId retrieved from {@link getAudioOutputs}\n */\n static selectAudioOutput = async (deviceId: string) => {\n await LivekitReactNative.selectAudioOutput(deviceId);\n };\n\n /**\n * iOS only, requires iOS 11+.\n *\n * Displays an AVRoutePickerView for the user to choose their audio output.\n */\n static showAudioRoutePicker = async () => {\n if (Platform.OS === 'ios') {\n await LivekitReactNative.showAudioRoutePicker();\n }\n };\n}\n"]}
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.VideoView = void 0;
7
+
8
+ var React = _interopRequireWildcard(require("react"));
9
+
10
+ var _reactNative = require("react-native");
11
+
12
+ var _livekitClient = require("livekit-client");
13
+
14
+ var _reactNativeWebrtc = require("react-native-webrtc");
15
+
16
+ var _ViewPortDetector = _interopRequireDefault(require("./ViewPortDetector"));
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
+
22
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
+
24
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
25
+
26
+ const VideoView = _ref => {
27
+ var _mediaStream$toURL;
28
+
29
+ let {
30
+ style = {},
31
+ videoTrack,
32
+ objectFit = 'cover',
33
+ zOrder,
34
+ mirror
35
+ } = _ref;
36
+ const [elementInfo] = (0, React.useState)(() => {
37
+ let info = new VideoViewElementInfo();
38
+ info.id = videoTrack === null || videoTrack === void 0 ? void 0 : videoTrack.sid;
39
+ info.something = videoTrack;
40
+ return info;
41
+ });
42
+ const [mediaStream, setMediaStream] = (0, React.useState)(videoTrack === null || videoTrack === void 0 ? void 0 : videoTrack.mediaStream);
43
+ (0, React.useEffect)(() => {
44
+ setMediaStream(videoTrack === null || videoTrack === void 0 ? void 0 : videoTrack.mediaStream);
45
+
46
+ if (videoTrack instanceof _livekitClient.LocalVideoTrack) {
47
+ const onRestarted = track => {
48
+ setMediaStream(track === null || track === void 0 ? void 0 : track.mediaStream);
49
+ };
50
+
51
+ videoTrack.on(_livekitClient.TrackEvent.Restarted, onRestarted);
52
+ return () => {
53
+ videoTrack.off(_livekitClient.TrackEvent.Restarted, onRestarted);
54
+ };
55
+ } else {
56
+ return () => {};
57
+ }
58
+ }, [videoTrack]);
59
+ (0, React.useEffect)(() => {
60
+ if (videoTrack instanceof _livekitClient.RemoteVideoTrack && videoTrack.isAdaptiveStream) {
61
+ videoTrack === null || videoTrack === void 0 ? void 0 : videoTrack.observeElementInfo(elementInfo);
62
+ return () => {
63
+ videoTrack === null || videoTrack === void 0 ? void 0 : videoTrack.stopObservingElementInfo(elementInfo);
64
+ };
65
+ } else {
66
+ return () => {};
67
+ }
68
+ }, [videoTrack, elementInfo]);
69
+ return /*#__PURE__*/React.createElement(_reactNative.View, {
70
+ style: { ...style,
71
+ ...styles.container
72
+ },
73
+ onLayout: event => {
74
+ elementInfo.onLayout(event);
75
+ }
76
+ }, /*#__PURE__*/React.createElement(_ViewPortDetector.default, {
77
+ onChange: isVisible => elementInfo.onVisibility(isVisible),
78
+ style: styles.videoView
79
+ }, /*#__PURE__*/React.createElement(_reactNativeWebrtc.RTCView, {
80
+ style: styles.videoView,
81
+ streamURL: (_mediaStream$toURL = mediaStream === null || mediaStream === void 0 ? void 0 : mediaStream.toURL()) !== null && _mediaStream$toURL !== void 0 ? _mediaStream$toURL : '',
82
+ objectFit: objectFit,
83
+ zOrder: zOrder,
84
+ mirror: mirror
85
+ })));
86
+ };
87
+
88
+ exports.VideoView = VideoView;
89
+
90
+ const styles = _reactNative.StyleSheet.create({
91
+ container: {},
92
+ videoView: {
93
+ flex: 1,
94
+ width: '100%'
95
+ }
96
+ });
97
+
98
+ class VideoViewElementInfo {
99
+ constructor() {
100
+ _defineProperty(this, "element", {});
101
+
102
+ _defineProperty(this, "something", void 0);
103
+
104
+ _defineProperty(this, "id", void 0);
105
+
106
+ _defineProperty(this, "_width", 0);
107
+
108
+ _defineProperty(this, "_height", 0);
109
+
110
+ _defineProperty(this, "_observing", false);
111
+
112
+ _defineProperty(this, "visible", true);
113
+
114
+ _defineProperty(this, "visibilityChangedAt", void 0);
115
+
116
+ _defineProperty(this, "handleResize", void 0);
117
+
118
+ _defineProperty(this, "handleVisibilityChanged", void 0);
119
+
120
+ _defineProperty(this, "width", () => this._width);
121
+
122
+ _defineProperty(this, "height", () => this._height);
123
+ }
124
+
125
+ observe() {
126
+ this._observing = true;
127
+ }
128
+
129
+ stopObserving() {
130
+ this._observing = false;
131
+ }
132
+
133
+ onLayout(event) {
134
+ let {
135
+ width,
136
+ height
137
+ } = event.nativeEvent.layout;
138
+
139
+ const pixelRatio = _reactNative.PixelRatio.get();
140
+
141
+ this._width = width * pixelRatio;
142
+ this._height = height * pixelRatio;
143
+
144
+ if (this._observing) {
145
+ var _this$handleResize;
146
+
147
+ (_this$handleResize = this.handleResize) === null || _this$handleResize === void 0 ? void 0 : _this$handleResize.call(this);
148
+ }
149
+ }
150
+
151
+ onVisibility(isVisible) {
152
+ if (this.visible !== isVisible) {
153
+ this.visible = isVisible;
154
+ this.visibilityChangedAt = Date.now();
155
+
156
+ if (this._observing) {
157
+ var _this$handleVisibilit;
158
+
159
+ (_this$handleVisibilit = this.handleVisibilityChanged) === null || _this$handleVisibilit === void 0 ? void 0 : _this$handleVisibilit.call(this);
160
+ }
161
+ }
162
+ }
163
+
164
+ }
165
+ //# sourceMappingURL=VideoView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["VideoView.tsx"],"names":["VideoView","style","videoTrack","objectFit","zOrder","mirror","elementInfo","info","VideoViewElementInfo","id","sid","something","mediaStream","setMediaStream","LocalVideoTrack","onRestarted","track","on","TrackEvent","Restarted","off","RemoteVideoTrack","isAdaptiveStream","observeElementInfo","stopObservingElementInfo","styles","container","event","onLayout","isVisible","onVisibility","videoView","toURL","StyleSheet","create","flex","width","_width","_height","observe","_observing","stopObserving","height","nativeEvent","layout","pixelRatio","PixelRatio","get","handleResize","visible","visibilityChangedAt","Date","now","handleVisibilityChanged"],"mappings":";;;;;;;AAAA;;AAEA;;AAOA;;AAOA;;AAGA;;;;;;;;;;AAUO,MAAMA,SAAS,GAAG,QAMZ;AAAA;;AAAA,MANa;AACxBC,IAAAA,KAAK,G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;;AAAA,oCAYvC,MAAM,KAAKC,OAZ4B;AAAA;;AAchDC,EAAAA,OAAO,GAAS;AACd,SAAKC,UAAL,GAAkB,IAAlB;AACD;;AACDC,EAAAA,aAAa,GAAS;AACpB,SAAKD,UAAL,GAAkB,KAAlB;AACD;;AAEDZ,EAAAA,QAAQ,CAACD,KAAD,EAA2B;AACjC,QAAI;AAAES,MAAAA,KAAF;AAASM,MAAAA;AAAT,QAAoBf,KAAK,CAACgB,WAAN,CAAkBC,MAA1C;;AACA,UAAMC,UAAU,GAAGC,wBAAWC,GAAX,EAAnB;;AACA,SAAKV,MAAL,GAAcD,KAAK,GAAGS,UAAtB;AACA,SAAKP,OAAL,GAAeI,MAAM,GAAGG,UAAxB;;AAEA,QAAI,KAAKL,UAAT,EAAqB;AAAA;;AACnB,iCAAKQ,YAAL;AACD;AACF;;AACDlB,EAAAA,YAAY,CAACD,SAAD,EAAqB;AAC/B,QAAI,KAAKoB,OAAL,KAAiBpB,SAArB,EAAgC;AAC9B,WAAKoB,OAAL,GAAepB,SAAf;AACA,WAAKqB,mBAAL,GAA2BC,IAAI,CAACC,GAAL,EAA3B;;AACA,UAAI,KAAKZ,UAAT,EAAqB;AAAA;;AACnB,sCAAKa,uBAAL;AACD;AACF;AACF;;AAvC+C","sourcesContent":["import * as React from 'react';\n\nimport {\n LayoutChangeEvent,\n PixelRatio,\n StyleSheet,\n View,\n ViewStyle,\n} from 'react-native';\nimport {\n ElementInfo,\n LocalVideoTrack,\n Track,\n TrackEvent,\n VideoTrack,\n} from 'livekit-client';\nimport { RTCView } from 'react-native-webrtc';\nimport { useEffect, useState } from 'react';\nimport { RemoteVideoTrack } from 'livekit-client';\nimport ViewPortDetector from './ViewPortDetector';\n\nexport type Props = {\n videoTrack?: VideoTrack | undefined;\n style?: ViewStyle;\n objectFit?: 'cover' | 'contain' | undefined;\n mirror?: boolean;\n zOrder?: number;\n};\n\nexport const VideoView = ({\n style = {},\n videoTrack,\n objectFit = 'cover',\n zOrder,\n mirror,\n}: Props) => {\n const [elementInfo] = useState(() => {\n let info = new VideoViewElementInfo();\n info.id = videoTrack?.sid;\n info.something = videoTrack;\n return info;\n });\n\n const [mediaStream, setMediaStream] = useState(videoTrack?.mediaStream);\n useEffect(() => {\n setMediaStream(videoTrack?.mediaStream);\n if (videoTrack instanceof LocalVideoTrack) {\n const onRestarted = (track: Track | null) => {\n setMediaStream(track?.mediaStream);\n };\n videoTrack.on(TrackEvent.Restarted, onRestarted);\n\n return () => {\n videoTrack.off(TrackEvent.Restarted, onRestarted);\n };\n } else {\n return () => {};\n }\n }, [videoTrack]);\n\n useEffect(() => {\n if (videoTrack instanceof RemoteVideoTrack && videoTrack.isAdaptiveStream) {\n videoTrack?.observeElementInfo(elementInfo);\n return () => {\n videoTrack?.stopObservingElementInfo(elementInfo);\n };\n } else {\n return () => {};\n }\n }, [videoTrack, elementInfo]);\n\n return (\n <View\n style={{ ...style, ...styles.container }}\n onLayout={(event) => {\n elementInfo.onLayout(event);\n }}\n >\n <ViewPortDetector\n onChange={(isVisible: boolean) => elementInfo.onVisibility(isVisible)}\n style={styles.videoView}\n >\n <RTCView\n style={styles.videoView}\n streamURL={mediaStream?.toURL() ?? ''}\n objectFit={objectFit}\n zOrder={zOrder}\n mirror={mirror}\n />\n </ViewPortDetector>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {},\n videoView: {\n flex: 1,\n width: '100%',\n },\n});\n\nclass VideoViewElementInfo implements ElementInfo {\n element: object = {};\n something?: any;\n id?: string;\n _width = 0;\n _height = 0;\n _observing = false;\n visible: boolean = true;\n visibilityChangedAt: number | undefined;\n handleResize?: (() => void) | undefined;\n handleVisibilityChanged?: (() => void) | undefined;\n width = () => this._width;\n height = () => this._height;\n\n observe(): void {\n this._observing = true;\n }\n stopObserving(): void {\n this._observing = false;\n }\n\n onLayout(event: LayoutChangeEvent) {\n let { width, height } = event.nativeEvent.layout;\n const pixelRatio = PixelRatio.get();\n this._width = width * pixelRatio;\n this._height = height * pixelRatio;\n\n if (this._observing) {\n this.handleResize?.();\n }\n }\n onVisibility(isVisible: boolean) {\n if (this.visible !== isVisible) {\n this.visible = isVisible;\n this.visibilityChangedAt = Date.now();\n if (this._observing) {\n this.handleVisibilityChanged?.();\n }\n }\n }\n}\n"]}