View & Play Live Stream
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 community.amity.co with your use-case and we will determine if the current limit can be raised.
Retrieve a stream object
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 Status
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
.
Stream Moderation
The system offers real-time automated moderation for live streams, where streams can be flagged or terminated based on customizable thresholds set via the console. The SDK provides access to information about which categories the live stream has been flagged or terminated by.
Retrieve streams collection
To query stream 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 maintaining only one collection for each query, in an application scope. And use it as a single source of truth.
Play a live stream
Use AmityVideoPlayer to play a live stream.
Play recorded videos
Live streams are recorded and saved as files after the session ends. It would take some time to prepare recorded videos to be ready. You can observe the collection of streams that have recorded videos available.
Use AmityRecordedStreamPlayer to play recorded videos. If the live stream session contains multiple recorded videos, the player will play one video after another.
Social Plus Video Player
Social Plus Video SDK includes AmityVideoPlayerKit.framework
, a basic RTMP player to support live video functionality.
This framework requires MobileVLCKit.framework
as a dependency. You can download the framework from the link provided in the Installation Steps.
Social Plus Recorded Stream Player
This player is part of the Social Plus Video SDK, built as a subclass of AVPlayer for playing recorded livestream videos. It works seamlessly with AVPlayerViewController.
Last updated