Host your events virtually and see community interaction as it happens
Live streams and playback videos information are stored in AmityStream
. These stream objects reside in AmityStreamRepository
. To start working with stream, first, the app needs to initialize the repository.
Note : There is a limitation for the maximum number of concurrent live events. Reach out to us at community.amity.co with your use-case and we will determine if the current limit can be raised.
Each stream object has a unique identifier. To retrieve a single stream object.
This function returns a flowable of AmityStream
. The stream object contains essential data, for example, title and description.
Stream consists of many states. It can change from one state to another, depending on events and actions.
Amitystream.Status
represents a stream status. The following enum cases describe all the possible statuses of a stream.
.IDLE
indicates "a stream that has generated but no actions have been taken."
.LIVE
indicates "a stream is currently being broadcasted."
.ENDED
indicates "a stream has ended broadcasting and in the process of transforming to a recorded stream."
.RECORDED
indicates "a stream has ended broadcasting and has been transformed to a recorded stream."
You can check the status of a stream by calling stream.getStatus()
.
AmityStreamRepository provides a convenient method getStreams
and also call setStatus(statuses: Array<Amitystream.Status>)
to query live streams. We provide enums of stream status as AmityStream.Status
You can observe changes in a collection as per the defined statuses.
You simply need to include this dependency to your project in build.gradle
in the application l
Inside your Application class, in the application initialization process, you need to register the video player SDK to the core SDK by calling.
SDK provides AmityVideoPlayer with a capability to play a Live stream based on streamId
From SDK version 6.19.0 onwards, AmityVideoPlayer plays a Live stream with streamId
To play a live stream, currently FLV, RTMP and HLS protocol are supported by calling getWatcherData.getUrl()
inside the stream object. The parameter accepts streamId and enum of AmityWatcherData.Format.
This function provides request/response API. The callback of this function returns a URL string.This object contains a full FLV, RTMP or HLS URL.
From SDK version 6.19.0 onwards, recorded stream can only be played with AmityVideoPlayer
SDK provides AmityVideoPlayer with a capability to play a recorded stream based on streamId
To play a recorded stream, currently FLV, MP4 and M3U8 protocol are supported by calling getRecordings()[index]
inside the stream object. The parameter accepts streamId and enum of AmityWatcherData.Format.
This function provides request/response API. The callback of this function returns a URL string.This object contains a full FLV, MP4 or M3U8 URL.
We recommend using ExoPlayer from Google. ExoPlayer supports features not currently supported by Android’s MediaPlayer API, including DASH and SmoothStreaming adaptive playbacks. Unlike the MediaPlayer API, ExoPlayer is easy to customize and extend.
For FLV we highly recommend using the DefaultDataSourceFactory
.
For RTMP we highly recommend using the RtmpDataSourceFactory
.
By inflating AmityVideoPlayer
as AndroidView in Compose, it can seamlessly play live or recorded stream video within the Composable function
Ensure that your users don’t miss important content from each other
This functionality is not currently supported for Android but will be coming soon! We will update the relevant sections accordingly
This module allows for richer, interactive experiences by enabling video stories and live streaming in your application
More than ever, videos are increasingly dominating mobile screens. From fun short-form clips to promote new products to live-streamed talk shows to educate your customers, videos have the potential to transform the way customers experience your brand.
To broadcast a live stream video, we provide a convenient broadcaster tool called AmityStreamBroadcaster
. We now only support 16:9 video ratio with the following resolution representing by the enum AmityStreamBroadcastResolution
:
.SD_480P
indicates a video with resolution 480x854 and video bitrate 1216 kpbs
.HD_720P
indicates a video with resolution 720x1280 and video bitrate 2496 kpbs
.FHD_1080P
indicates a video with resolution 1080x1920 and video bitrate 4992 kpbs
You simply need to include this dependency to your project in build.gradle
in the application level.
Inside your Application class, in the application initialization process, you need to register the video publisher SDK to the core SDK by calling.
We highly recommend using Android's ConstraintLayout to construct our AmityCameraView
Since we only support 16:9 video ratio, ConstratntLayout will ensure that the view will be drawn in the correct width and height.
AmityStreamBroadcaster
requires the following permissions to work properly.
As per the required parameter by the aforementioned object to provide AmityCameraView
, you will need to define the view in your Activity or Fragment layout by :
Camera access
Microphone access
Before using AmityStreamBroadcaster
, please make sure these permissions are granted.
See here the steps to ask for the permissions.
In order to create the object, we also provide the AmityStreamBroadCaster.Builder
class to create and configure this object easily. It requires AmityCameraView
as a parameter and AmityStreamBroadcasterConfig
as a configurable value which will be explained in the following section.
For configuration, we provide the AmityStreamBroadcasterConfiguration.Builder
to construct the configuration conveniently. As we have mentioned above, We support SD_480P
, HD_720P
and, FHD_1080P
resolutions. Orientations are relying on Android Configuration class, you may either choose Configuration.ORIENTATION_PORTRAIT or Configuration.ORIENTATION_LANDSCAPE
.
As per the required parameter by the aforementioned object to provide AmityCameraView
, you need to define the view in your Activity or Fragment layout by :
We highly recommend using Android's ConstraintLayout to construct our AmityCameraView
Since we only support 16:9 video ratio, ConstraintLayout ensures that the view will be drawn in the correct width and height.
In Jetpack Compose, inflate AmityCameraView
as AndroidView and provide it to aforementioned object as below
To begin previewing the camera input call
To begin broadcasting live stream call
To stop broadcasting live stream call
By default, the broadcaster will use the back camera. However, you can switch camera position anytime by calling.
To observe the status of a broadcast, we provide a function (flow) to observe any status changes and return as AmityStreamBroadcasterState
. The possible statuses are :
.IDLE
indicates a status of stream in an idle state.
.CONNECTING
indicates a status of stream that it's connecting to a rtmp server.
.CONNECTED
indicates a status of stream that it's connected to a rtmp server.
.DISNNECTED
indicates a status of stream that it's disconnected to a rtmp server. We also provide error information through an exception.