Broadcast Live Stream

Host your events virtually and see community interaction as it happens.

Setup & Configuration

To use AmityVideoBroadcaster , please follow this setup step in your react native project.

Install peer dependencies

yarn add \
@amityco/ts-sdk-react-native \
@api.video/react-native-livestream

After peer dependencies installed, follow these following steps depends on your Platform

IOS

  1. Install pod

cd ios && pod install
  1. Add permission in your info.split file

<key>NSCameraUsageDescription</key>
<string>Your own description of the purpose</string>

<key>NSMicrophoneUsageDescription</key>
<string>Your own description of the purpose</string>

Android

  1. config kotlinVersion and compileSdkVersion in android/build.gradle, add kotlinVersion above 1.7.0 and compileSdkVersion above 34 in buildscript > ext

  1. Add following permissions to AndroidManifest.xml file

Broadcast a stream

To create a stream, use StreamRepository.createStream() This will return a LiveObject instance of the created AmityStream. After AmityStream created successfully, StreamId will be used to publish the stream.

We provide AmityVideoBroadcaster component. This component can be used to preview your preview your video. You can adjust your own resolution and bitrate as followed.

Observe a broadcasting state

To observe the status of a broadcast, you can pass onBroadcastStateChange to observe broadcaster's stage change. This function will be invoke and accept AmityStreamBroadcasterState as an input. The possible statuses are :

  • idle a status of stream in an idle state.

  • connectingindicates a status of stream that it's connecting to a rtmp server.

  • connectedindicates a status of stream that it's connected to a rtmp server.

  • disconnectedindicates a status of stream that it's disconnected to a rtmp server. We also provide error information through an exception.

Last updated

Was this helpful?