A React Native wrapper for the Amazon IVS iOS and Android broadcast SDKs.
amazon-ivs-react-native-broadcast must target iOS 11 and Android 12 (API 31).
👉 Read more about broadcasting to Amazon IVS.
👉 See Amazon IVS streaming configuration guideline.
$ yarn add amazon-ivs-react-native-broadcast
# --- or ---
$ npm install amazon-ivs-react-native-broadcast
$ cd ios && pod install && cd ..Allows consumers to stream video from an active phone camera.
An application must request permission to access the user’s camera and microphone. This isn't specific to the component but required for any application that needs access to the cameras and microphones.
Add NSCameraUsageDescription and NSMicrophoneUsageDescription keys to the Info.plist file:
...
<key>NSCameraUsageDescription</key>
<string>In order to stream your awesome video, allow access to camera please</string>
<key>NSMicrophoneUsageDescription</key>
<string>In order to stream your awesome audio, allow access to microphone please</string>
...Add CAMERA and RECORD_AUDIO permissions to the AndroidManifest.xml file:
...
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
...
⚠️ On devices before SDK version 23, the permissions are automatically granted if they appear in the manifest, so check should always result totrueand request should always resolve toPermissionsAndroid.RESULTS.GRANTED, however if your app is installed on a device that runs Android 6.0 or higher, you must request the _dangerous permissions at runtime manually._
Example of requesting Android dangerous permissions at runtime could be found in the ./example/src/index.android.tsx file.
| Props | Type | iOS | Android |
|---|---|---|---|
rtmpsUrl |
string? |
✅ | ✅ |
streamKey |
string? |
✅ | ✅ |
configurationPreset |
ConfigurationPreset? |
✅ | ✅ |
videoConfig |
IVideoConfig? |
✅ | ✅ |
audioConfig |
IAudioConfig? |
✅ | ✅ |
logLevel |
LogLevel? |
✅ | ✅ |
sessionLogLevel |
LogLevel? |
✅ | ✅ |
cameraPreviewAspectMode |
CameraPreviewAspectMode? |
✅ | ✅ |
isCameraPreviewMirrored |
boolean? |
✅ | ✅ |
cameraPosition |
CameraPosition? |
✅ | ✅ |
isMuted |
boolean? |
✅ | ✅ |
| Handlers | Type | iOS | Android |
|---|---|---|---|
onError |
(errorMessage: string): void? |
✅ | ✅ |
onBroadcastError |
(error: IBroadcastSessionError): void? |
✅ | ✅ |
onIsBroadcastReady |
(isReady: boolean): void? |
✅ | ✅ |
onBroadcastAudioStats |
(audioStats: IAudioStats): void? |
✅ | ✅ |
onBroadcastStateChanged |
(stateStatus: StateStatusUnion, metadata?: StateChangedMetadata): void? |
✅ | ✅ |
onTransmissionStatisticsChanged |
(transmissionStatistics: ITransmissionStatistics): void? |
✅ | ✅ |
onAudioSessionInterrupted |
(): void? |
✅ | 🚫 |
onAudioSessionResumed |
(): void? |
✅ | 🚫 |
onMediaServicesWereLost |
(): void? |
✅ | 🚫 |
onMediaServicesWereReset |
(): void? |
✅ | 🚫 |
| Methods | Type | iOS | Android |
|---|---|---|---|
start |
(options?: StartMethodOptions): void |
✅ | ✅ |
stop |
(): void |
✅ | ✅ |
👉 Read more detailed API documentation.
👉 iOS and Android known issues and workarounds.
A complex usage could be found in the ./example/src/App.tsx file or just go to the ./example folder and read Setting up and running application section how to set up and run the example app to see IVSBroadcastCameraView component in action.
This project has been built and is maintained thanks to the support from Apiko.
