Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
This module allows for richer, interactive experiences by enabling video stories and live streaming on 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 have provided a convenient broadcaster tool called AmityStreamBroadcaster
. You will need to import AmityLiveVideoBroadcastKit.framework
into your app.
AmityStreamBroadcaster
requires the following permissions to work properly.
Camera access
Microphone access
Before using AmityStreamBroadcaster
, please make sure these permissions are already granted.
Here are the steps to ask for the permissions.
Add NSCameraUsageDescription
to your app's info.plist
.
Add NSMicrophoneUsageDescription
to your app's info.plist
.
Call AVCaptureDevice.requestAccess(for: .video, completion: ...)
Call AVAudioSession.sharedInstance().requestRecordPermission(_:)
You can create broadcaster instance by providing AmityClient
.
Before going live, you will need to set up the broadcaster session by creating AmityStreamBroadcasterConfiguration
. This configuration will be applied for the next live session.
The broadcaster object provides "preview view". After finish setting up the broadcaster, you then can take the preview view to attach into your screen.
You can set up video resolution anytime "before" going live. This setting will affect both the rendering of preview view, and the resolution of live stream session.
To begin broadcasting the live stream, call
To stop broadcasting the live stream, call
By default, the broadcaster will use the back camera. However, you can switch camera position anytime by calling
To observe a broadcaster state, we provide a delegate object that you can set to listen to broadcaster's events.
AmityStreamBroadcasterState
represents all the possible states.
.idle
indicates a state of stream in an idle state.
.connecting
indicates a state of stream that it's connecting to the stream server.
.connected
indicates a state of stream that it's connected to the stream server.
.disconnected
indicates a status of stream that it's disconnected.
The code below shows an example of printing out the state of broadcaster, when it changes.
iOS ​ Android ​ Web TypeScript React NativeFlutter
Amity video SDK allows engineers to integrate live-streaming capabilities into their applications. The live stream SDK simplifies mobile app development for iOS and Android by offering a common, cross-platform API to capture, encode and stream live video and audio, without the hassle of deploying and maintaining your own infrastructure.
Amity video SDK allows you to:
Implement and enable professional low-latency live streaming capabilities of up to four hours
Provision a playback video when streaming ends
Support high volume concurrent viewers simultaneously
Receive notifications when a live stream has started
Manage and run multiple live streams in parallel
Manage & moderate live streams via our admin panel
Work across platforms, with SDK's available for both Android and iOS devices
More information on the implementation of these SDK’s can be found under each of the following sections, for the respective platform (iOS, Android, Web).
Ensure that your users don’t miss important content from each other
This functionality is not currently supported for IOS but will be coming soon! We will update the relevant sections accordingly
Host your events virtually and see community interaction as it happens
Live streams and playback videos information are stored in AmityStream
. This stream objects reside in AmityStreamRepository
. To start working with stream, first the app need to intialize the repository.
*Note : There is a limitation for the maximum concurrent live events. Please feel free to reach out to us at 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, call
repository.getStreamById(_:)
This function returns a Live Object 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.
AmityStreamStatus
represents a stream status. The following enum cases describe all the possible status 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 progress 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 .status
.
To query streams collection, first you need to create a AmityStreamCollectionQuery
.
Then call .getStreamsCollection(from:)
with the query object that you've created.
.getStreamsCollection(from: query)
This function returns the live collection of stream objects.
If your app needs stream collections in many parts of the app. We recommend to maintain only one collection for each query, in an application scope. And use it as a single source of truth.
Use AmityVideoPlayer to play a live stream.
To play a live stream, currently only RTMP protocol is supported, call
stream.watcherUrl
AmityLiveStreamURLInfo
contains a full RTMP url, which most of RTMP players support. For some players that does not support the full url, this object contains enough data for custom RTMP url formatting.
AmityStream
has isLive
property.
When there is an update of live object, use isLive
property to check.
When there is an update of live stream collections:
The streams that are not live, will disappear from the collection.
The streams that are just live, will appear in the collection.
RTMP is a low-latency video streaming protocol, that iOS does not support in its native video player. Therefore when working with RTMP, here are some open-source players that we recommend:
Live streams are recorded, and saved as files after the session ends. It would take some time for preparing recorded videos to be ready. You can observe the collection of stream that has recorded videos available.
Use AmityRecordedStreamPlayer to play recorded videos. If the live stream session contains multiple recorded video, player will play one video after another.
Each live stream session can contain multiple recorded videos. You can retrieve the array of AmityLiveVideoRecordingData
that store all recording data, by calling
stream.recordingData
To get the actual url, you need to specify the file format by calling on a recorded item.
recordingItem.url(for: AmityLiveVideoRecordingFileFormat)
The following code shows an example of getting all the mp4 url of a stream instance.
In contrast with RTMP live videos, you don't need 3rd party video players for the recorded videos. iOS native players already support playing mp4 file from the URL given by API.
Amity Video SDK includes AmityVideoPlayerKit.framework
, a basic RTMP player to support live video functionality.
This player is the part of the Amity Video SDK, built as a subclass of AVPlayer for playing recorded livestream videos. It works seamlessly with AVPlayerViewController.
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.
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
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 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.
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
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.
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.
See also and .
This framework requires MobileVLCKit.framework
as a dependency. You can download the framework from the link provided in the .
We recommend using 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.
See the steps to ask for the permissions.
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.
Run this command:
With Flutter:
This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get
):
Alternatively, your editor might support flutter pub get
. Check the docs for your editor to learn more.
Now in your Dart code, you can use:
To begin with you will need to setup the AmityVideoPlayerClient in the application level.
SDK provides AmityVideoPlayer with a capability to play a live stream or a recorded live stream by providing a streamId
in AmityVideoContoller
.
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.
Host your events virtually and see community interaction as it happens
In order to play a live stream or recorded live stream using the JS-SDK, we have implemented an internal player. This player allows developers to easily incorporate video playback functionality into their applications. To utilize this feature, developers can refer to the example code provided below, which demonstrates how to play the desired video with simplicity and efficiency.
In the example code mentioned above, developers are required to provide a streamId
parameter to utilize the stream player functionality. This stream player is capable of playing both live streams and recorded live streams.
Recorded stream video refers to a previously streamed content that has concluded and has been recorded within the system.
Ensure that your users don’t miss important content from each other
This functionality is not currently supported for Flutter 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 on your application
Chrome: 38+
Firefox: 42+
Microsoft Edge: 13+
Safari: 9+
Opera: 25+
Amity Web SDK probably won't work great in Internet Explorer 11. We generally support the recent versions of major browsers listed above.
Since Amity Web SDK uses local cache for performance and user experience reason, server side rendering is not supported. To use Amity Web SDK with NextJS, Amity Web SDK must be imported using Dynamic Import with SSR disabled.
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.
Host your events virtually and see community interaction as it happens
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.
To create a stream, follow the code below. This will return a LiveObject
instance of the created StreamModel
.
To delete a stream, you will need the ID of the stream that you want to delete. The function will return true if successfully deleted, otherwise, it will throw an error.
Disposing a stream means updating the streaming status to ended and invalidating the streaming URL.
To dispose a stream, you need the ID of the stream that you want to dispose. The function will return true if successfully deleted, otherwise, it will throw an error.
Each stream object has a unique identifier. To retrieve a single stream object, use the sample code below. This function returns a LiveObject
instance of streamModel
. The stream object contains essential data such as the video stream title and description.
Stream consists of many states. It can change from one state to another, depending on events and actions. The following enum cases describe all the possible status of a stream.
StreamStatus.Idle
- has generated but no actions have been taken
StreamStatus.Live
- currently being broadcasted
StreamStatus.Ended
- has ended broadcasting and in the progress of transforming to a recorded stream
StreamStatus.Recorded
- has ended broadcasting and has been transformed to a recorded stream
You can check the status of a stream by calling .status
.
StreamRepository
provides a convenient method queryStreams
and can be called to query live streams. We provide enums of stream status as parameters.statuses
. You can observe changes in a collection as per the defined statuses.
This function returns a live collection of stream objects.
isDeleted
can be any of these values:
null
(default) - show all streams (deleted and undeleted)
true
- show only deleted streams
false
- show only non deleted streams
This module allows for richer, interactive experiences by enabling video stories and live streaming on your application
Chrome: 38+
Firefox: 42+
Microsoft Edge: 13+
Safari: 9+
Opera: 25+
Amity Web SDK probably won't work great in Internet Explorer 11. We generally support the recent versions of major browsers listed above.
Since Amity Web SDK uses local cache for performance and user experience reason, server side rendering is not supported. To use Amity Web SDK with NextJS, Amity Web SDK must be imported using .
For details on using the TypeScript SDK with React Native, refer to these .
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.
Ensure that your users don’t miss important content from each other
This functionality is not currently supported for Web but will be coming soon! We will update the relevant sections accordingly
Host your events virtually and see community interaction as it happens
Live streams and playback videos information are stored in Amity.Stream
. To start working with stream, first, the app needs to initialize the repository. To create a new SDK instance with your API key, refer to the section.
There is a limitation for the maximum concurrent live events. Please feel free to reach out to us at 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. The stream object contains essential data such as title, description, streamerUrl, watcherUrl, etc
Stream consists of many states. It can change from one state to another, depending on events and actions.
Amity.StreamStatus.<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 query a list of stream by calling queryStream
.
To play a live stream, currently FLV, RTMP and HLS protocol are supported by using watcherUrl
inside the stream object.
To play a recorded stream, currently FLV, MP4 and M3U8 protocol are supported by using recordings
inside the stream object.
Note that the TypeScript SDK does not support broadcasting a live stream directly. Instead, it allows the creation of a stream object. You can then retrieve the streaming URL from this object and implement it with a third-party library or streaming tools like OBS.
To stop broadcasting a live stream, you can use the dedicated stop function provided by the SDK. This function will explicitly end the ongoing live stream and change its status to 'ENDED' Using this function is crucial for effectively managing your live streams and ensuring that they transition properly to their recorded state after broadcasting. Here's how you can use the function:
To delete a stream, you will need the ID of the stream that you want to delete. The function will return true if successfully deleted, otherwise, it will throw an error.
Every action inside of ts-sdk can be wrapped by runQuery
to enable offline first functionality.
For a getter, runQuery
will first try to get the data from cache. If the data already exists in the cache, it will not fetch from the server. Otherwise, it will fetch the data and store the cache accordingly.
You can set the period of validity of the cache manually using the third parameter. With this example, the cache will be considered valid for an hour.
For a mutator, runQuery
will do an optimistic mutation (creation, update, delete operation) to the cache before making a request to the server.
The runQuery
for an action that requires pagination acts a little differently. Instead of accepting a callback that passes just the object of interest, it will also pass a pages
object with the key prevPage
and nextPage
referring to the Amity.Page
object that can be used to query the previous page and the next page, respectively. A sample code is provided below: