Gathering detailed insights and metrics for react-native-twilio-video-webrtc-pru
Gathering detailed insights and metrics for react-native-twilio-video-webrtc-pru
Gathering detailed insights and metrics for react-native-twilio-video-webrtc-pru
Gathering detailed insights and metrics for react-native-twilio-video-webrtc-pru
npm install react-native-twilio-video-webrtc-pru
Typescript
Module System
Node Version
NPM Version
67.7
Supply Chain
99
Quality
74.6
Maintenance
100
Vulnerability
100
License
Java (50.25%)
JavaScript (23.84%)
Objective-C (22.25%)
TypeScript (1.85%)
Starlark (1.06%)
Ruby (0.76%)
Total Downloads
14,888
Last Day
1
Last Week
1
Last Month
10
Last Year
1,010
610 Stars
304 Commits
403 Forks
25 Watching
14 Branches
70 Contributors
Latest Version
1.0.3
Package Id
react-native-twilio-video-webrtc-pru@1.0.3
Unpacked Size
578.45 kB
Size
211.79 kB
File Count
89
NPM Version
6.14.4
Node Version
12.18.0
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
-80%
1
Compared to previous week
Last month
25%
10
Compared to previous month
Last year
18.7%
1,010
Compared to previous year
Platforms:
People using a version < 1.0.1 please move to 1.0.1 since the project changed a lot internally to support the stable TwilioVideo version.
1yarn add https://github.com/blackuy/react-native-twilio-video-webrtc
1npm install https://github.com/blackuy/react-native-twilio-video-webrtc --save
1pod 'react-native-twilio-video-webrtc', path: '../node_modules/react-native-twilio-video-webrtc'
Note that this will automatically pull in the appropriate version of the underlying TwilioVideo
pod.
1pod install
1pod 'TwilioVideo'
1pod install
Libraries
directory fromnode_modules/react-native-twilio-video-webrtc/ios/RNTwilioVideoWebRTC.xcodeproj
Add libRNTwilioVideoWebRTC.a
to your XCode project target's Linked Frameworks and Libraries
Update Build Settings
Find Search Paths
and add $(SRCROOT)/../node_modules/react-native-twilio-video-webrtc/ios
with recursive
to Framework Search Paths
and Library Search Paths
Be sure to increment your iOS Deployment Target to at least iOS 11 through XCode and your Podfile
contains
platform :ios, '11.0'
To enable camera usage and microphone usage you will need to add the following entries to your Info.plist
file:
<key>NSCameraUsageDescription</key>
<string>Your message to user when the camera is accessed for the first time</string>
<key>NSMicrophoneUsageDescription</key>
<string>Your message to user when the microphone is accessed for the first time</string>
TwilioVideo version 1.3.8 (latest) has the following know issues.
As with iOS, make sure the package is installed:
1yarn add https://github.com/blackuy/react-native-twilio-video-webrtc
Then add the library to your settings.gradle
file:
include ':react-native-twilio-video-webrtc'
project(':react-native-twilio-video-webrtc').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-twilio-video-webrtc/android')
And include the library in your dependencies in android/app/build.gradle
:
dependencies {
.....
.....
.....
compile project(':react-native-twilio-video-webrtc')
}
You will also need to update this file so that you compile with java 8 features:
android {
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
Now you're ready to load the package in MainApplication.java
. In the imports section, add this:
1import com.twiliorn.library.TwilioPackage;
Then update the getPackages()
method:
1 protected List<ReactPackage> getPackages() { 2 return Arrays.<ReactPackage>asList( 3 ... 4 new TwilioPackage() 5 ); 6 }
For most applications, you'll want to add camera and audio permissions to your AndroidManifest.xml
file:
1 <uses-permission android:name="android.permission.CAMERA" /> 2 <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> 3 <uses-permission android:name="android.permission.RECORD_AUDIO" /> 4 <uses-feature android:name="android.hardware.camera" android:required="false" /> 5 <uses-feature android:name="android.hardware.camera.autofocus" android:required="false" /> 6 <uses-feature android:name="android.hardware.microphone" android:required="false" />
Newer versions of Android have a different permissions model. You will need to use the PermissionsAndroid
class in react-native
in order to request the CAMERA
and RECORD_AUDIO
permissions.
Under default settings, the Android build will fail if the total number of symbols exceeds a certain threshold. If you should encounter this issue when adding this library (e.g., if your build fails with com.android.dex.DexIndexOverflowException
), you can turn on jumbo mode by editing your app/build.gradle
:
android {
...
dexOptions {
jumboMode true
}
}
If you are using proguard (very likely), you will also need to ensure that the symbols needed by
this library are not stripped. To do that, add these two lines to proguard-rules.pro
:
-keep class org.webrtc.** { *; }
-keep class com.twilio.** { *; }
-keep class tvi.webrtc.** { *; }
You can see the documentation here.
We have three important components to understand:
1import { 2 TwilioVideo, 3 TwilioVideoLocalView, 4 TwilioVideoParticipantView 5} from 'react-native-twilio-video-webrtc'
TwilioVideo
/ is responsible for connecting to rooms, events delivery and camera/audio.TwilioVideoLocalView
/ is responsible local camera feed viewTwilioVideoParticipantView
/ is responsible remote peer's camera feed viewHere you can see a complete example of a simple application that uses almost all the apis:
1import React, { Component } from 'react'; 2import { 3 TwilioVideoLocalView, 4 TwilioVideoParticipantView, 5 TwilioVideo 6} from 'react-native-twilio-video-webrtc' 7 8export default class Example extends Component { 9 state = { 10 isAudioEnabled: true, 11 isVideoEnabled: true, 12 status: 'disconnected', 13 participants: new Map(), 14 videoTracks: new Map(), 15 token: '' 16 } 17 18 _onConnectButtonPress = () => { 19 this.refs.twilioVideo.connect({ accessToken: this.state.token }) 20 this.setState({status: 'connecting'}) 21 } 22 23 _onEndButtonPress = () => { 24 this.refs.twilioVideo.disconnect() 25 } 26 27 _onMuteButtonPress = () => { 28 this.refs.twilioVideo.setLocalAudioEnabled(!this.state.isAudioEnabled) 29 .then(isEnabled => this.setState({isAudioEnabled: isEnabled})) 30 } 31 32 _onFlipButtonPress = () => { 33 this.refs.twilioVideo.flipCamera() 34 } 35 36 _onRoomDidConnect = ({ roomName, error }) => { 37 console.log('onRoomDidConnect: ', roomName); 38 39 this.setState({ status: 'connected' }); 40 }; 41 42 _onRoomDidDisconnect = ({roomName, error}) => { 43 console.log("ERROR: ", error) 44 45 this.setState({status: 'disconnected'}) 46 } 47 48 _onRoomDidFailToConnect = (error) => { 49 console.log("ERROR: ", error) 50 51 this.setState({status: 'disconnected'}) 52 } 53 54 _onParticipantAddedVideoTrack = ({participant, track}) => { 55 console.log("onParticipantAddedVideoTrack: ", participant, track) 56 57 this.setState({ 58 videoTracks: new Map([ 59 ...this.state.videoTracks, 60 [track.trackSid, { participantSid: participant.sid, videoTrackSid: track.trackSid }] 61 ]), 62 }); 63 } 64 65 _onParticipantRemovedVideoTrack = ({participant, track}) => { 66 console.log("onParticipantRemovedVideoTrack: ", participant, track) 67 68 const videoTracks = this.state.videoTracks 69 videoTracks.delete(track.trackSid) 70 71 this.setState({videoTracks: { ...videoTracks }}) 72 } 73 74 render() { 75 return ( 76 <View style={styles.container}> 77 { 78 this.state.status === 'disconnected' && 79 <View> 80 <Text style={styles.welcome}> 81 React Native Twilio Video 82 </Text> 83 <TextInput 84 style={styles.input} 85 autoCapitalize='none' 86 value={this.state.token} 87 onChangeText={(text) => this.setState({token: text})}> 88 </TextInput> 89 <Button 90 title="Connect" 91 style={styles.button} 92 onPress={this._onConnectButtonPress}> 93 </Button> 94 </View> 95 } 96 97 { 98 (this.state.status === 'connected' || this.state.status === 'connecting') && 99 <View style={styles.callContainer}> 100 { 101 this.state.status === 'connected' && 102 <View style={styles.remoteGrid}> 103 { 104 Array.from(this.state.videoTracks, ([trackSid, trackIdentifier]) => { 105 return ( 106 <TwilioVideoParticipantView 107 style={styles.remoteVideo} 108 key={trackSid} 109 trackIdentifier={trackIdentifier} 110 /> 111 ) 112 }) 113 } 114 </View> 115 } 116 <View 117 style={styles.optionsContainer}> 118 <TouchableOpacity 119 style={styles.optionButton} 120 onPress={this._onEndButtonPress}> 121 <Text style={{fontSize: 12}}>End</Text> 122 </TouchableOpacity> 123 <TouchableOpacity 124 style={styles.optionButton} 125 onPress={this._onMuteButtonPress}> 126 <Text style={{fontSize: 12}}>{ this.state.isAudioEnabled ? "Mute" : "Unmute" }</Text> 127 </TouchableOpacity> 128 <TouchableOpacity 129 style={styles.optionButton} 130 onPress={this._onFlipButtonPress}> 131 <Text style={{fontSize: 12}}>Flip</Text> 132 </TouchableOpacity> 133 <TwilioVideoLocalView 134 enabled={true} 135 style={styles.localVideo} 136 /> 137 </View> 138 </View> 139 } 140 141 <TwilioVideo 142 ref="twilioVideo" 143 onRoomDidConnect={ this._onRoomDidConnect } 144 onRoomDidDisconnect={ this._onRoomDidDisconnect } 145 onRoomDidFailToConnect= { this._onRoomDidFailToConnect } 146 onParticipantAddedVideoTrack={ this._onParticipantAddedVideoTrack } 147 onParticipantRemovedVideoTrack= { this._onParticipantRemovedVideoTrack } 148 /> 149 </View> 150 ); 151 } 152} 153 154AppRegistry.registerComponent('Example', () => Example);
To run the example application:
cd Example
yarn install
cd ios && pod install
open Example.xcworkspace
s.dependency 'TwilioVideo', '~> 2.2.0'
Both participants and tracks are uniquely identified by their sid
/trackSid
field.
The trackId
field no longer exists and should be replaced by trackSid
. Commensurate with this change,
participant views now expect participantSid
and videoTrackSid
keys in the trackIdentity
prop (instead of
identity
and trackId
).
Make sure you're listening to participant events via onParticipant{Added/Removed}VideoTrack
rather than onParticipant{Enabled/Disabled}Track
.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
9 commit(s) and 6 issue activity found in the last 90 days -- score normalized to 10
Reason
license file detected
Details
Reason
binaries present in source code
Details
Reason
Found 6/22 approved changesets -- score normalized to 2
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
41 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More