├── .eslintrc.js ├── .gitignore ├── .npmignore ├── LICENSE ├── NOTICE ├── README.md ├── android ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── io │ └── livekit │ └── reactnative │ └── expo │ ├── LiveKitApplicationLifecycleListener.kt │ └── LiveKitExpoPackage.kt ├── app.plugin.js ├── example ├── .gitignore ├── App.tsx ├── app.json ├── assets │ ├── adaptive-icon.png │ ├── favicon.png │ ├── icon.png │ └── splash.png ├── babel.config.js ├── eas.json ├── metro.config.js ├── package.json ├── tsconfig.json ├── webpack.config.js └── yarn.lock ├── expo-module.config.json ├── ios ├── LiveKitExpoAppDelegate.swift └── LiveKitExpoPlugin.podspec ├── package.json ├── plugin ├── src │ └── index.ts └── tsconfig.json ├── src └── index.ts ├── tsconfig.json └── yarn.lock /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: ['universe/native', 'universe/web'], 4 | ignorePatterns: ['build'], 5 | }; 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # VSCode 6 | .vscode/ 7 | jsconfig.json 8 | 9 | # Xcode 10 | # 11 | build/ 12 | *.pbxuser 13 | !default.pbxuser 14 | *.mode1v3 15 | !default.mode1v3 16 | *.mode2v3 17 | !default.mode2v3 18 | *.perspectivev3 19 | !default.perspectivev3 20 | xcuserdata 21 | *.xccheckout 22 | *.moved-aside 23 | DerivedData 24 | *.hmap 25 | *.ipa 26 | *.xcuserstate 27 | project.xcworkspace 28 | 29 | # Android/IJ 30 | # 31 | .classpath 32 | .cxx 33 | .gradle 34 | .idea 35 | .project 36 | .settings 37 | local.properties 38 | android.iml 39 | android/app/libs 40 | android/keystores/debug.keystore 41 | *.apk 42 | 43 | # Cocoapods 44 | # 45 | example/ios/Pods 46 | 47 | # Ruby 48 | example/vendor/ 49 | 50 | # node.js 51 | # 52 | node_modules/ 53 | npm-debug.log 54 | yarn-debug.log 55 | yarn-error.log 56 | .yarn/ 57 | 58 | # Expo 59 | .expo/* 60 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # Exclude all top-level hidden directories by convention 2 | /.*/ 3 | 4 | __mocks__ 5 | __tests__ 6 | 7 | /babel.config.js 8 | /android/src/androidTest/ 9 | /android/src/test/ 10 | /android/build/ 11 | /example/ 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2024 LiveKit, Inc. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Expo Plugin for LiveKit React Native SDK 2 | 3 | 4 | This plugin handles the setup required for Expo projects to use the [LiveKit React Native SDK](https://github.com/livekit/client-sdk-react-native). 5 | 6 | 7 | ## Installation for managed Expo projects 8 | 9 | ```sh 10 | npx expo install livekit-client @livekit/react-native @livekit/react-native-expo-plugin @livekit/react-native-webrtc @config-plugins/react-native-webrtc 11 | ``` 12 | 13 | ### Configure app.json 14 | 15 | After installing this npm package, add the config plugin to the plugins array of your app.json or app.config.js: 16 | 17 | ``` 18 | { 19 | "expo": { 20 | "plugins": ["@livekit/react-native-expo-plugin", "@config-plugins/react-native-webrtc"] 21 | } 22 | } 23 | ``` 24 | 25 | This plugin optionally takes in an [object to customize the configuration]( 26 | https://github.com/livekit/client-sdk-react-native-expo-plugin/blob/main/plugin/src/index.ts): 27 | 28 | ``` 29 | { 30 | "expo": { 31 | "plugins": [ 32 | [ 33 | "@livekit/react-native-expo-plugin", 34 | { 35 | "android": { 36 | "audioType": <"media" or "communication"> (defaults to "communication") 37 | } 38 | } 39 | ] 40 | ] 41 | } 42 | } 43 | ``` 44 | 45 | ## Installation in React Native projects 46 | 47 | Config plugins are not supported in React Native projects. Read the [installation guide on the React Native SDK](https://github.com/livekit/client-sdk-react-native?tab=readme-ov-file#installation) to see how to setup in a React Native project. 48 | 49 | 50 |
51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 |
LiveKit Ecosystem
Real-time SDKsReact Components · JavaScript · iOS/macOS · Android · Flutter · React Native · Rust · Python · Unity (web) · Unity (beta)
Server APIsNode.js · Golang · Ruby · Java/Kotlin · Python · Rust · PHP (community)
Agents FrameworksPython · Playground
ServicesLivekit server · Egress · Ingress · SIP
ResourcesDocs · Example apps · Cloud · Self-hosting · CLI
60 | 61 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'maven-publish' 4 | 5 | group = 'io.livekit.reactnative.expo' 6 | version = '0.1.0' 7 | 8 | buildscript { 9 | def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle") 10 | if (expoModulesCorePlugin.exists()) { 11 | apply from: expoModulesCorePlugin 12 | applyKotlinExpoModulesCorePlugin() 13 | } 14 | 15 | // Simple helper that allows the root project to override versions declared by this library. 16 | ext.safeExtGet = { prop, fallback -> 17 | rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback 18 | } 19 | 20 | // Ensures backward compatibility 21 | ext.getKotlinVersion = { 22 | if (ext.has("kotlinVersion")) { 23 | ext.kotlinVersion() 24 | } else { 25 | ext.safeExtGet("kotlinVersion", "1.8.10") 26 | } 27 | } 28 | 29 | repositories { 30 | mavenCentral() 31 | } 32 | 33 | dependencies { 34 | classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}") 35 | } 36 | } 37 | 38 | afterEvaluate { 39 | publishing { 40 | publications { 41 | release(MavenPublication) { 42 | from components.release 43 | } 44 | } 45 | repositories { 46 | maven { 47 | url = mavenLocal().url 48 | } 49 | } 50 | } 51 | } 52 | 53 | android { 54 | compileSdkVersion safeExtGet("compileSdkVersion", 33) 55 | 56 | def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION 57 | if (agpVersion.tokenize('.')[0].toInteger() < 8) { 58 | compileOptions { 59 | sourceCompatibility JavaVersion.VERSION_11 60 | targetCompatibility JavaVersion.VERSION_11 61 | } 62 | 63 | kotlinOptions { 64 | jvmTarget = JavaVersion.VERSION_11.majorVersion 65 | } 66 | } else { 67 | compileOptions { 68 | sourceCompatibility JavaVersion.VERSION_17 69 | targetCompatibility JavaVersion.VERSION_17 70 | } 71 | 72 | kotlinOptions { 73 | jvmTarget = JavaVersion.VERSION_17 74 | } 75 | } 76 | 77 | namespace "io.livekit.reactnative.expo" 78 | defaultConfig { 79 | minSdkVersion safeExtGet("minSdkVersion", 21) 80 | targetSdkVersion safeExtGet("targetSdkVersion", 34) 81 | versionCode 1 82 | versionName "0.1.0" 83 | } 84 | lintOptions { 85 | abortOnError false 86 | } 87 | publishing { 88 | singleVariant("release") { 89 | withSourcesJar() 90 | } 91 | } 92 | } 93 | 94 | repositories { 95 | mavenCentral() 96 | } 97 | 98 | dependencies { 99 | implementation project(':expo-modules-core') 100 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}" 101 | implementation project(':livekit_react-native') 102 | } 103 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /android/src/main/java/io/livekit/reactnative/expo/LiveKitApplicationLifecycleListener.kt: -------------------------------------------------------------------------------- 1 | package io.livekit.reactnative.expo 2 | 3 | import android.app.Application 4 | import android.content.pm.PackageManager 5 | import android.util.Log 6 | import com.livekit.reactnative.LiveKitReactNative 7 | import com.livekit.reactnative.audio.AudioType 8 | import expo.modules.core.interfaces.ApplicationLifecycleListener 9 | 10 | class LiveKitApplicationLifecycleListener : ApplicationLifecycleListener { 11 | override fun onCreate(application: Application) { 12 | val applicationInfo = application.packageManager?.getApplicationInfo(application.packageName.toString(), PackageManager.GET_META_DATA) 13 | 14 | val audioTypeString = applicationInfo?.metaData?.getString("io.livekit.reactnative.expo.ANDROID_AUDIO_TYPE") 15 | 16 | val audioType = when(audioTypeString) { 17 | "media" -> AudioType.MediaAudioType() 18 | "communication", null -> AudioType.CommunicationAudioType() 19 | else -> { 20 | Log.w("LiveKitExpoPlugin", "Unrecognized audio type \"$audioTypeString\". Defaulting to communication audio type.") 21 | AudioType.CommunicationAudioType() 22 | } 23 | } 24 | LiveKitReactNative.setup(application, audioType) 25 | } 26 | } -------------------------------------------------------------------------------- /android/src/main/java/io/livekit/reactnative/expo/LiveKitExpoPackage.kt: -------------------------------------------------------------------------------- 1 | package io.livekit.reactnative.expo 2 | 3 | import android.content.Context 4 | import expo.modules.core.interfaces.ApplicationLifecycleListener 5 | import expo.modules.core.interfaces.Package 6 | 7 | 8 | class LiveKitExpoPackage : Package { 9 | override fun createApplicationLifecycleListeners(context: Context): List { 10 | return listOf(LiveKitApplicationLifecycleListener()) 11 | } 12 | } -------------------------------------------------------------------------------- /app.plugin.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./plugin/build'); -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files 2 | 3 | # dependencies 4 | node_modules/ 5 | 6 | # Expo 7 | .expo/ 8 | dist/ 9 | web-build/ 10 | 11 | # Expo prebuild folders 12 | android/ 13 | ios/ 14 | 15 | # Native 16 | *.orig.* 17 | *.jks 18 | *.p8 19 | *.p12 20 | *.key 21 | *.mobileprovision 22 | 23 | # Metro 24 | .metro-health-check* 25 | 26 | # debug 27 | npm-debug.* 28 | yarn-debug.* 29 | yarn-error.* 30 | 31 | # macOS 32 | .DS_Store 33 | *.pem 34 | 35 | # local env files 36 | .env*.local 37 | 38 | # typescript 39 | *.tsbuildinfo 40 | -------------------------------------------------------------------------------- /example/App.tsx: -------------------------------------------------------------------------------- 1 | 2 | import * as React from 'react'; 3 | 4 | import { 5 | StyleSheet, 6 | View, 7 | FlatList, 8 | ListRenderItem, 9 | } from 'react-native'; 10 | import { useEffect } from 'react'; 11 | import { 12 | AudioSession, 13 | LiveKitRoom, 14 | useTracks, 15 | TrackReferenceOrPlaceholder, 16 | VideoTrack, 17 | isTrackReference, 18 | registerGlobals, 19 | } from '@livekit/react-native'; 20 | 21 | import { Track } from 'livekit-client'; 22 | 23 | registerGlobals(); 24 | 25 | // Fill in these values with your own url and token. 26 | const wsURL = "wss://www.example.com" 27 | const token = "your-token-here" 28 | export default function App () { 29 | 30 | // Start the audio session first. 31 | useEffect(() => { 32 | let start = async () => { 33 | await AudioSession.startAudioSession(); 34 | }; 35 | 36 | start(); 37 | return () => { 38 | AudioSession.stopAudioSession(); 39 | }; 40 | }, []); 41 | 42 | return ( 43 | 53 | 54 | 55 | ); 56 | }; 57 | 58 | const RoomView = () => { 59 | // Get all camera tracks 60 | const tracks = useTracks([Track.Source.Camera]); 61 | 62 | const renderTrack: ListRenderItem = ({item}) => { 63 | // Render using the VideoTrack component 64 | if(isTrackReference(item)) { 65 | return () 66 | } else { 67 | return () 68 | } 69 | }; 70 | 71 | return ( 72 | 73 | 77 | 78 | ); 79 | }; 80 | 81 | const styles = StyleSheet.create({ 82 | container: { 83 | flex: 1, 84 | alignItems: 'stretch', 85 | justifyContent: 'center', 86 | }, 87 | participantView: { 88 | height: 300, 89 | }, 90 | }); -------------------------------------------------------------------------------- /example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "expo": { 3 | "name": "react-native-expo-plugin-example", 4 | "slug": "react-native-expo-plugin-example", 5 | "version": "1.0.0", 6 | "orientation": "portrait", 7 | "icon": "./assets/icon.png", 8 | "userInterfaceStyle": "light", 9 | "splash": { 10 | "image": "./assets/splash.png", 11 | "resizeMode": "contain", 12 | "backgroundColor": "#ffffff" 13 | }, 14 | "assetBundlePatterns": [ 15 | "**/*" 16 | ], 17 | "ios": { 18 | "supportsTablet": true, 19 | "bundleIdentifier": "io.livekit.reactnative.expo.example" 20 | }, 21 | "android": { 22 | "adaptiveIcon": { 23 | "foregroundImage": "./assets/adaptive-icon.png", 24 | "backgroundColor": "#ffffff" 25 | }, 26 | "package": "io.livekit.reactnative.expo.example" 27 | }, 28 | "web": { 29 | "favicon": "./assets/favicon.png" 30 | }, 31 | "extra": { 32 | "eas": { 33 | "projectId": "436b85b6-499e-427e-b3be-50f71b1d66bc" 34 | } 35 | }, 36 | "plugins": [ 37 | [ 38 | "../app.plugin.js", 39 | { 40 | "android": { 41 | "audioType": "media" 42 | } 43 | } 44 | ], 45 | "@config-plugins/react-native-webrtc" 46 | ] 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /example/assets/adaptive-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livekit/client-sdk-react-native-expo-plugin/d05337c3713b4466621c53540ac7399039d33f25/example/assets/adaptive-icon.png -------------------------------------------------------------------------------- /example/assets/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livekit/client-sdk-react-native-expo-plugin/d05337c3713b4466621c53540ac7399039d33f25/example/assets/favicon.png -------------------------------------------------------------------------------- /example/assets/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livekit/client-sdk-react-native-expo-plugin/d05337c3713b4466621c53540ac7399039d33f25/example/assets/icon.png -------------------------------------------------------------------------------- /example/assets/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/livekit/client-sdk-react-native-expo-plugin/d05337c3713b4466621c53540ac7399039d33f25/example/assets/splash.png -------------------------------------------------------------------------------- /example/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function (api) { 2 | api.cache(true); 3 | return { 4 | presets: ['babel-preset-expo'], 5 | }; 6 | }; 7 | -------------------------------------------------------------------------------- /example/eas.json: -------------------------------------------------------------------------------- 1 | { 2 | "cli": { 3 | "version": ">= 7.6.2", 4 | "promptToConfigurePushNotifications": false 5 | }, 6 | "build": { 7 | "development": { 8 | "developmentClient": true, 9 | "distribution": "internal" 10 | }, 11 | "preview": { 12 | "distribution": "internal" 13 | }, 14 | "production": {} 15 | }, 16 | "submit": { 17 | "production": {} 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /example/metro.config.js: -------------------------------------------------------------------------------- 1 | // Learn more https://docs.expo.io/guides/customizing-metro 2 | const { getDefaultConfig } = require('expo/metro-config'); 3 | const path = require('path'); 4 | 5 | const config = getDefaultConfig(__dirname); 6 | 7 | // npm v7+ will install ../node_modules/react and ../node_modules/react-native because of peerDependencies. 8 | // To prevent the incompatible react-native bewtween ./node_modules/react-native and ../node_modules/react-native, 9 | // excludes the one from the parent folder when bundling. 10 | config.resolver.blockList = [ 11 | ...Array.from(config.resolver.blockList ?? []), 12 | new RegExp(path.resolve('..', 'node_modules', 'react')), 13 | new RegExp(path.resolve('..', 'node_modules', 'react-native')), 14 | ]; 15 | 16 | config.resolver.nodeModulesPaths = [ 17 | path.resolve(__dirname, './node_modules'), 18 | path.resolve(__dirname, '../node_modules'), 19 | ]; 20 | 21 | config.resolver.extraNodeModules = { 22 | 'react-native-expo-plugin': '..', 23 | }; 24 | 25 | config.watchFolders = [path.resolve(__dirname, '..')]; 26 | 27 | config.transformer.getTransformOptions = async () => ({ 28 | transform: { 29 | experimentalImportSupport: false, 30 | inlineRequires: true, 31 | }, 32 | }); 33 | 34 | module.exports = config; 35 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@livekit/react-native-expo-plugin-example", 3 | "version": "1.0.0", 4 | "main": "node_modules/expo/AppEntry.js", 5 | "scripts": { 6 | "start": "expo start", 7 | "prebuild": "expo prebuild", 8 | "android": "expo run:android", 9 | "ios": "expo run:ios" 10 | }, 11 | "dependencies": { 12 | "@config-plugins/react-native-webrtc": "^8.0.0", 13 | "@livekit/react-native": "^2.1.0-0", 14 | "@livekit/react-native-webrtc": "^114.1.1", 15 | "expo": "~52.0.20", 16 | "expo-dev-client": "~5.0.6", 17 | "react": "18.3.1", 18 | "react-native": "0.76.5" 19 | }, 20 | "devDependencies": { 21 | "@babel/core": "^7.20.0", 22 | "@types/react": "~18.3.12", 23 | "typescript": "^5.1.3" 24 | }, 25 | "private": true, 26 | "expo": { 27 | "autolinking": { 28 | "nativeModulesDir": ".." 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "expo/tsconfig.base", 3 | "compilerOptions": { 4 | "strict": true, 5 | "paths": { 6 | "react-native-expo-plugin": ["../src/index"], 7 | "react-native-expo-plugin/*": ["../src/*"] 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /example/webpack.config.js: -------------------------------------------------------------------------------- 1 | const createConfigAsync = require('@expo/webpack-config'); 2 | const path = require('path'); 3 | 4 | module.exports = async (env, argv) => { 5 | const config = await createConfigAsync( 6 | { 7 | ...env, 8 | babel: { 9 | dangerouslyAddModulePathsToTranspile: ['react-native-expo-plugin'], 10 | }, 11 | }, 12 | argv 13 | ); 14 | config.resolve.modules = [ 15 | path.resolve(__dirname, './node_modules'), 16 | path.resolve(__dirname, '../node_modules'), 17 | ]; 18 | 19 | return config; 20 | }; 21 | -------------------------------------------------------------------------------- /expo-module.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "platforms": ["ios", "android"], 3 | "ios": { 4 | "appDelegateSubscribers": ["LiveKitExpoAppDelegate"] 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /ios/LiveKitExpoAppDelegate.swift: -------------------------------------------------------------------------------- 1 | import ExpoModulesCore 2 | import livekit_react_native 3 | 4 | public class LiveKitExpoAppDelegate: ExpoAppDelegateSubscriber { 5 | public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { 6 | LivekitReactNative.setup() 7 | print("LK setup\n") 8 | return false 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /ios/LiveKitExpoPlugin.podspec: -------------------------------------------------------------------------------- 1 | require 'json' 2 | 3 | package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json'))) 4 | 5 | Pod::Spec.new do |s| 6 | s.name = 'LiveKitExpoPlugin' 7 | s.version = package['version'] 8 | s.summary = package['description'] 9 | s.description = package['description'] 10 | s.license = package['license'] 11 | s.author = package['author'] 12 | s.homepage = package['homepage'] 13 | s.platforms = { :ios => '13.4', :tvos => '13.4' } 14 | s.swift_version = '5.4' 15 | s.source = { git: 'https://github.com/livekit/client-sdk-react-native-expo-plugin' } 16 | s.static_framework = true 17 | 18 | s.dependency 'ExpoModulesCore' 19 | s.dependency "livekit-react-native" 20 | 21 | # Swift/Objective-C compatibility 22 | s.pod_target_xcconfig = { 23 | 'DEFINES_MODULE' => 'YES', 24 | 'SWIFT_COMPILATION_MODE' => 'wholemodule' 25 | } 26 | 27 | s.source_files = "**/*.{h,m,swift}" 28 | end 29 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@livekit/react-native-expo-plugin", 3 | "version": "1.0.0", 4 | "description": "Expo Plugin for LiveKit React Native SDK", 5 | "main": "build/index.js", 6 | "types": "build/index.d.ts", 7 | "scripts": { 8 | "build": "expo-module build", 9 | "clean": "expo-module clean", 10 | "lint": "expo-module lint", 11 | "test": "expo-module test", 12 | "prepare": "expo-module prepare", 13 | "prepublishOnly": "expo-module prepublishOnly", 14 | "expo-module": "expo-module", 15 | "open:ios": "open -a \"Xcode\" example/ios", 16 | "open:android": "open -a \"Android Studio\" example/android" 17 | }, 18 | "keywords": [ 19 | "react-native", 20 | "expo", 21 | "react-native-expo-plugin", 22 | "LiveKit" 23 | ], 24 | "repository": { 25 | "type": "git", 26 | "url": "git+https://github.com/livekit/client-sdk-react-native-expo-plugin.git" 27 | }, 28 | "bugs": { 29 | "url": "https://github.com/livekit/client-sdk-react-native-expo-plugin/issues" 30 | }, 31 | "author": "LiveKit (https://github.com/livekit)", 32 | "license": "Apache-2.0", 33 | "homepage": "https://github.com/livekit/client-sdk-react-native-expo-plugin#readme", 34 | "devDependencies": { 35 | "@types/react": "^18.0.25", 36 | "expo-module-scripts": "^3.4.1", 37 | "expo-modules-core": "^1.11.12" 38 | }, 39 | "peerDependencies": { 40 | "@livekit/react-native": "^2.1.0", 41 | "expo": "*", 42 | "react": "*", 43 | "react-native": "*" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /plugin/src/index.ts: -------------------------------------------------------------------------------- 1 | import { 2 | withAndroidManifest, 3 | AndroidConfig, 4 | ConfigPlugin, 5 | } from '@expo/config-plugins'; 6 | 7 | type LKConfigOptions = { 8 | "android"? : { 9 | "audioType"?: "media"|"communication" 10 | } 11 | } 12 | 13 | const withLiveKit: ConfigPlugin = (config, options) => { 14 | if(options) { 15 | let androidOptions = options.android 16 | if(androidOptions) { 17 | let audioType = androidOptions.audioType 18 | if(audioType) { 19 | config = withAndroidManifest(config, config => { 20 | const mainApplication = AndroidConfig.Manifest.getMainApplicationOrThrow(config.modResults); 21 | 22 | AndroidConfig.Manifest.addMetaDataItemToMainApplication( 23 | mainApplication, 24 | 'io.livekit.reactnative.expo.ANDROID_AUDIO_TYPE', 25 | audioType 26 | ); 27 | return config; 28 | }); 29 | } 30 | } 31 | } 32 | 33 | return config; 34 | }; 35 | 36 | export default withLiveKit; 37 | -------------------------------------------------------------------------------- /plugin/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "expo-module-scripts/tsconfig.plugin", 3 | "compilerOptions": { 4 | "outDir": "build", 5 | "rootDir": "src" 6 | }, 7 | "include": ["./src"], 8 | "exclude": ["**/__mocks__/*", "**/__tests__/*"] 9 | } 10 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | // This file is intentionally left empty. -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | // @generated by expo-module-scripts 2 | { 3 | "extends": "expo-module-scripts/tsconfig.base", 4 | "compilerOptions": { 5 | "outDir": "./build" 6 | }, 7 | "include": ["./src"], 8 | "exclude": ["**/__mocks__/*", "**/__tests__/*"] 9 | } 10 | --------------------------------------------------------------------------------