├── .nvmrc ├── android ├── gradle.properties ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ ├── res │ │ └── drawable │ │ │ └── ic_daily_videocam_24dp.xml │ │ └── java │ │ └── com │ │ └── daily │ │ └── reactlibrary │ │ ├── DailyNativeUtilsPackage.java │ │ ├── DailyOngoingMeetingForegroundService.java │ │ └── DailyNativeUtils.java └── build.gradle ├── ios ├── DailyNativeUtils.h ├── DailyJs.xcworkspace │ └── contents.xcworkspacedata ├── DailyNativeUtils.m └── DailyJs.xcodeproj │ └── project.pbxproj ├── .gitignore ├── scripts └── tag ├── tsconfig.json ├── .npmrc ├── .github └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── react-native-daily-js.podspec ├── LICENSE ├── package.json ├── src ├── DailyMediaView.tsx ├── iOSCallObjectBundleCache.ts └── index.ts ├── CONTRIBUTING.md ├── README.md └── type-overrides └── @daily-co └── daily-js └── index.d.ts /.nvmrc: -------------------------------------------------------------------------------- 1 | 18.19.0 2 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Enabling android x 2 | android.useAndroidX=true 3 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /ios/DailyNativeUtils.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface DailyNativeUtils : RCTEventEmitter 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /dist 2 | 3 | # node.js 4 | # 5 | node_modules/ 6 | npm-debug.log 7 | yarn-error.log 8 | 9 | android/build 10 | *.iml 11 | -------------------------------------------------------------------------------- /ios/DailyJs.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /scripts/tag: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | TAG_NAME=$(echo ${npm_package_name} | sed -E 's|^.+/||')-$(date -u +'%Y-%m-%d')-${npm_package_version} && \ 4 | git tag -a -m "${npm_package_name} ${npm_package_version} published to npmjs" ${TAG_NAME} HEAD && \ 5 | git push origin ${TAG_NAME} 6 | -------------------------------------------------------------------------------- /android/src/main/res/drawable/ic_daily_videocam_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "commonjs", 5 | "outDir": "./dist", 6 | "lib": ["es2021"], 7 | "strict": true, 8 | "jsx": "react-native", 9 | "esModuleInterop": true, 10 | "allowSyntheticDefaultImports": true, 11 | "baseUrl": ".", 12 | "declaration": true, 13 | "paths": { 14 | "@daily-co/daily-js": ["type-overrides/@daily-co/daily-js"] 15 | }, 16 | "types": ["react", "react-native"] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | # We need that because after npm 7, npm automatically tries to install peer dependencies. 2 | # More details can be found here: https://github.blog/2021-02-02-npm-7-is-now-generally-available/#peer-dependencies 3 | # But the problem is that several modules that react-native-daily-js depends on, like, @react-native-async-storage/async-storage, 4 | # react-native-background-timer, react-native-url-polyfill, and—yes—@daily-co/react-native-webrtc, all declare a peer dependency on react-native. 5 | # If we remove that we are going to receive errors of different version creating conflict. 6 | legacy-peer-deps=true 7 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Tell us if there's a feature you'd like to add or change that would be helpful. 4 | title: '[FEATURE-REQUEST]' 5 | labels: enhancement 6 | assignees: kimberleejohnson 7 | --- 8 | 9 | # Feature request 10 | 11 | 12 | 13 | # Why you need this 14 | 15 | 16 | 17 | # Alternatives you've considered 18 | 19 | 20 | 21 | # Additional context 22 | 23 | 24 | -------------------------------------------------------------------------------- /android/src/main/java/com/daily/reactlibrary/DailyNativeUtilsPackage.java: -------------------------------------------------------------------------------- 1 | package com.daily.reactlibrary; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collections; 5 | import java.util.List; 6 | 7 | import com.facebook.react.ReactPackage; 8 | import com.facebook.react.bridge.NativeModule; 9 | import com.facebook.react.bridge.ReactApplicationContext; 10 | import com.facebook.react.uimanager.ViewManager; 11 | 12 | public class DailyNativeUtilsPackage implements ReactPackage { 13 | @Override 14 | public List createNativeModules(ReactApplicationContext reactContext) { 15 | return Arrays.asList(new DailyNativeUtils(reactContext)); 16 | } 17 | 18 | @Override 19 | public List createViewManagers(ReactApplicationContext reactContext) { 20 | return Collections.emptyList(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /react-native-daily-js.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 = "react-native-daily-js" 7 | s.version = package["version"] 8 | s.summary = package["description"] 9 | s.description = <<-DESC 10 | react-native-daily-js 11 | DESC 12 | s.homepage = "https://github.com/daily-co/react-native-daily-js" 13 | # brief license entry: 14 | s.license = "MIT" 15 | # optional - use expanded license entry instead: 16 | # s.license = { :type => "MIT", :file => "LICENSE" } 17 | s.authors = { "Paul Kompfner" => "paul@daily.co" } 18 | s.platforms = { :ios => "12.0" } 19 | s.source = { :git => "https://github.com/daily-co/react-native-daily-js.git", :tag => "#{s.version}" } 20 | 21 | s.source_files = "ios/**/*.{h,c,m,swift}" 22 | s.requires_arc = true 23 | 24 | s.dependency "React-Core" 25 | s.dependency "ReactNativeDailyJSScreenShareExtension", "0.0.1" 26 | # ... 27 | # s.dependency "..." 28 | end 29 | 30 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: BUG 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | 12 | # Expected behavior 13 | 14 | 15 | 16 | # Describe the bug (unexpected behavior) 17 | 18 | 19 | 20 | # Steps to reproduce 21 | 22 | 23 | 24 | 25 | 26 | 27 | # Screenshots 28 | 29 | 30 | 31 | # System information 32 | 33 | 34 | 35 | * Device: 36 | * OS, version: 37 | * Browser, version: 38 | 39 | # Additional context 40 | 41 | 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 2-Clause License 2 | 3 | Copyright (c) 2019, daily-co 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@daily-co/react-native-daily-js", 3 | "private": true, 4 | "//": "^ COMMENT OUT 'private: true' BEFORE RUNNING NPM PUBLISH", 5 | "version": "0.82.0", 6 | "description": "React Native library for making video calls using Daily", 7 | "main": "dist/index.js", 8 | "types": "dist/index.d.ts", 9 | "files": [ 10 | "dist", 11 | "type-overrides", 12 | "android/src", 13 | "android/build.gradle", 14 | "android/gradle.properties", 15 | "ios", 16 | "react-native-daily-js.podspec", 17 | "react-native.config.js", 18 | "README.md", 19 | "LICENSE" 20 | ], 21 | "scripts": { 22 | "build": "tsc", 23 | "postbuild": "sed -E -i.bak 's|@daily-co/daily-js|../type-overrides/@daily-co/daily-js|g' ./dist/index.d.ts && rm ./dist/index.d.ts.bak", 24 | "prepare": "npm run build", 25 | "tag": "scripts/tag", 26 | "prepublishOnly": "npm run tag" 27 | }, 28 | "license": "BSD-2-Clause", 29 | "repository": { 30 | "type": "git", 31 | "url": "git+https://github.com/daily-co/react-native-daily-js.git", 32 | "baseUrl": "https://github.com/daily-co/react-native-daily-js" 33 | }, 34 | "dependencies": { 35 | "@daily-co/daily-js": "^0.85.0", 36 | "@types/react-native-background-timer": "^2.0.0", 37 | "base-64": "^1.0.0", 38 | "react-native-url-polyfill": "^1.1.2" 39 | }, 40 | "///": "WHEN ONE OF THESE CHANGE, PLEASE UPDATE README.md INSTALL SNIPPET ACCORDINGLY", 41 | "peerDependencies": { 42 | "@daily-co/react-native-webrtc": "^124.0.6-daily.1", 43 | "@react-native-async-storage/async-storage": "^1.24.0", 44 | "react-native": ">=0.68.0", 45 | "react-native-background-timer": "^2.4.1", 46 | "react-native-get-random-values": "^1.11.0" 47 | }, 48 | "devDependencies": { 49 | "@daily-co/react-native-webrtc": "^124.0.6-daily.1", 50 | "@react-native-async-storage/async-storage": "^1.24.0", 51 | "@types/base-64": "^1.0.0", 52 | "@types/react": "18.3.21", 53 | "react-native": "0.76.9", 54 | "react-native-background-timer": "^2.4.1", 55 | "typescript": "^5.8.3" 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/DailyMediaView.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { useEffect, useState } from 'react'; 3 | import { ViewStyle, View, Platform } from 'react-native'; 4 | import { 5 | MediaStreamTrack, 6 | RTCView, 7 | MediaStream, 8 | RTCViewProps, 9 | } from '@daily-co/react-native-webrtc'; 10 | 11 | type Props = { 12 | videoTrack: MediaStreamTrack | null; 13 | audioTrack: MediaStreamTrack | null; 14 | mirror?: RTCViewProps['mirror']; 15 | zOrder?: RTCViewProps['zOrder']; 16 | objectFit?: RTCViewProps['objectFit']; 17 | style?: ViewStyle; 18 | }; 19 | 20 | export default function DailyMediaView(props: Props) { 21 | const [stream, setStream] = useState(null); 22 | 23 | useEffect(() => { 24 | const tracks = [props.videoTrack, props.audioTrack].filter( 25 | (t) => t 26 | ) as MediaStreamTrack[]; 27 | const stream = tracks.length > 0 ? new MediaStream(tracks) : null; 28 | setStream(stream); 29 | }, [props.videoTrack, props.audioTrack]); 30 | 31 | const rtcView = stream ? ( 32 |