Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
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.
The Video SDK for iOS is delivered as a binary .xcframework file
Install: Homebrew using: /bin/bash -c “$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
or see more instruction at https://brew.sh
Install: git-lfs using: brew install git-lfs
Starting from version 4.3, the use of the .xcframework will reduce the required number of installation steps and also support the use of same binary, even when the Xcode version changes. We also include an additional framework as a dependency: Realm.
In order to properly install the SDK, you must make sure to import and link both frameworks. XCFrameworks for both realm & our Video SDK are bundled together for your convenience, this can be downloaded using the link below:
Drag EkoChat.xcframework
and Realm.xcframework
to your project's Embedded Binaries
. Make sure that Copy items if needed
is selected and click Finish. Also switch the Embed section as Embed & Sign
.
Carthage is a decentralised dependency manager that builds your dependencies and provides you with binary frameworks. To integrate the Amity Video SDK, add the following line of code to your Cartfile
.
To integrate the Amity Video SDK into your Xcode project using CocoaPods, specify the following line of code in your Podfile
:
Please check if you have git-lfs installed and clear cocoapod cache before running install again
To clear cache please go to ~/Library/Caches/Cocoapods/ and remove Amity SDK folder - you should be able to run a clean install afterward
If this doesn't work, please do visit the cocoapod Github repo for further resolutions.
Here are the steps to migrate from the previous version of our SDK to the new .xcframework
Remove and unlink EkoChat.framework
and Realm.framework
from your project.
Remove custom Run Script Phase
that is required for the version prior to v4.3. strip-frameworks.sh
is no longer required, since .xcframework
automatically handles the fat binary issue.
Copy and link EkoChat.xcframework
and Realm.xcframework
to your project. And set Embed & Sign
.
This section outlines how you can set-up your project for success and begin using our Video SDK for iOS application
Before using the Video SDK, you will need to create a new SDK instance with your API key. Please find your account API key via the Admin Panel. If you have trouble finding this, you can send our support team an email at developer@amity.co
In order to use any Video SDK feature, you must first register the current device with an userId
. A registered device will be tied to the registered userId
until the device is either proactively unregistered, or until the device has been inactive for over 90 days. A registered device will receive all the events messages belonging to the tied user.
An optional displayName
can be provided, which will be used in standard push notifications (related to user's actions, such as when the new message is sent).
The
displayName
is set only on the first time the device is registered, please follow your platforms necessary directions if you would like to rename this to something else.
When the user logs out, you should explicitly unregister the user from the SDK as well. This prevents the current device from receiving unnecessary and/or restricted data.
Each user can be registered, at the same time, to an unlimited number of devices. Amity's Video SDK will automatically synchronize the user data across all registered devices. We will also automatically unregister any device that has not been connected to the server for more than 90 days.
When a device is unregistered due to inactivity, the SDK data on the device will be reset. You will need to re-register this device in order to connect to server again.
If you have any logic or UI around the connection status, you can observe the connectionStatus
property on the EkoClient
instance.
Since the SDK automatically manages the network connection and queue up any requests in cases of bad connection, there should be little need to attach additional logic to this status. However the user may want to know the exact network status to determine if their actions will be performed in real-time, therefore this status is exposed.
The connectionStatus
flag supports KVO notifications, use NSObject
's observe methods to be notified whenever this status changes
In iOS, LiveObjects are represented by the EkoObject
and EkoCollection
classes. EkoObject
represents live updates on one model, while EkoCollection
represents live updates on a collection of models.
Observing live changes to any EkoObject
can be done via a simple observe block:
In this example the block observes the data of the currently authenticated user and prints out the displayName
. The observe block can be called multiple times throughout the lifetime of the application (as long as its associated EkoNotificationToken
is retained in memory):
If the requested object data is stored locally on the device, the block will be called immediately with the local version of the data (this can be verified this through the EkoObject
property dataStatus
).
In parallel, a network request for the latest version of the data is fired, once the network returns the data, the observe block will be called again with the updated data.
Any future changes to the data (whenever the user changes its displayName
on another device, for example) can trigger additional callbacks.
Any UI update logic can be performed within the observe blocks, which will always be called in the main thread: this way, you can ensure that your UI displays the most up-to-date version of the state at all times.
In case you'd like to operate exclusively with fresh data, without using the potientially out-of-date local data, you can make sure to do so by reading the
EkoObject
dataStatus
property, which reflects the status of the callback data, and check that its value is set to fresh.You can also use the
EkoObject
loadingStatus
property to determine the current state of network operations being performed by the LiveObject. This is useful for any UI element that needs to communicate the loading state.
The EkoNotificationToken
is a token that is used to control the lifecycle of a LiveObject. The observeWithBlock
callback will be triggered only if the notificationToken
is retained in memory: once it is released, the observe block will no longer be called, and its memory will be automatically released. Hold a strong reference to any EkoNotificationToken
whose block you would like still to be called.
Beside the
observeWithBlock
method, aobserveOnceWithBlock
method is also available, which will trigger its callback only once, regardless of thedataStatus
of the callback and the associated token retainment (the token still needs to be retained to fire once).To stop receiving
observeWithBlock
updates, release the associatedEkoNotificationToken
or callinvalidate
method on the token itself.
An EkoCollection
instance is given for any queries that return a list of objects. EkoCollection
has the same change observation interface as EkoObject
, but contains a few other helper methods around data access that allows better integration with collection views like UITableView
.
Unlike most databases, EkoCollection
does not return all data in an array. Instead, data are fetched one-by-one using the objectAtIndex:
method. This allows the framework to store most of the actual result on disk, and load them in memory only when absoutely necessary. Additionally, the objectAtIndex:
API fits perfectly into UITableView
's tableView:cellForRowAtIndexPath:
. Together with the count
property, a typical tableView
integration looks like this:
EkoCollection
offers both a nextPage
and previousPage
methods which will trigger a local cache lookup, a network call, and multiple LiveObject updates once new data is returned. After the method call is successful, the number of records returned by EkoCollection
will be increased by the additional number of new records. For the typical use case of infinite scroll, you can call nextPage
directly in the scroll view delegate method:
Lastly, if there is a need to shrink the list of models exposed back to original first page, when passing the EkoCollection
object to a new view for example, you can do so by calling resetPage
into the collection itself.
To broadcast a live stream video, we have provided a convenient broadcaster tool called EkoStreamBroadcaster
. You will need to import EkoLiveVideoBroadcastKit.framework
into your app.
EkoStreamBroadcaster
requires the following permissions to work properly.
Camera access
Microphone access
Before using EkoStreamBroadcaster
, 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 EkoClient
.
Before going live, you will need to setup the broadcaster session by creating EkoStreamBroadcasterConfiguration
. 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 setup video resolution anytime "before" going live. This setting will affects 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 broadcaster's events..
EkoStreamBroadcasterState
represent 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 show an example of printing out the state of broadcaster, when it changes.
Host your events virtually and see community interaction as it happens
Live streams and playback videos information are stored in EkoStream
. This stream objects reside in EkoStreamRepository
. 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 developer@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, call
repository.getStreamById(_:)
This function returns a Live Object of EkoStream
. 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.
EkoStreamStatus
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 EkoStreamCollectionQuery
.
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.
To play a live stream, currently only RTMP protocol is supported, call
stream.watcherUrl
EkoLiveStreamURLInfo
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.
EkoStream
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, by calling
streamRepository.getRecordedStreams()
Each live stream session can contain multiple recorded videos. You can retrieve the array of EkoLiveVideoRecordingData
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: EkoLiveVideoRecordingFileFormat)
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.
See also AVFoundation and AVKit.
Amity Video SDK includes UpstraVideoPlayerKit.framework
, a basic RTMP player to support live video functionality.
This framework requires MobileVLCKit.framework
as a dependency. You can download it from the link below.
This functionality is not currently supported for IOS but will be coming soon! We will update the relevant sections accordingly in good time
Make users share their life snippets through their short videos
This functionality is not currently supported for IOS, but will be coming soon! We will update the relevant sections accordingly in good time.
This page contains an overview of all relevant changes made to the Amity Video SDK modules and the latest version releases
Introduce a completion parameter to registerDeviceWithUserId(:_)
in EkoClient
None
Fixed issue where categories property of community is updated incorrectly when fetching list of community categories.
None
Fix crash when setting up custom avatar for in EkoClient
class.
None
Add EkoLiveVideoBroadcastKit.xcframework
. The tool helps broadcasting live video from mobile.
Add live video broadcasting functionalities in the sample app.
Add recorded video url API
Add a beta version of Amity Video Player, a basic RTMP player for sample app live video.
Error objects can be returned to you via LiveObjects, callbacks, or clientErrorDelegate
. All the errors returned by the SDK come in form of an NSError with domain Eko
. The possible error codes are listed in a public EkoErrorCode
enum: each case is named after its error and they're pretty self explanatory.
UnauthorizedError: 400100
ItemNotFound: 400400
BadRequestError: 400000
Conflict: 400900
ForbiddenError: 400300
PermissionDenied: 400301
UserIsMuted: 400302
ChannelIsMuted: 400303
UserIsBanned: 400304
NumberOfMemberExceed: 400305
ExemptFromBan: 400306
MaxRepetitionExceed: 400307
BanWordFound: 400308
LinkNotAllowed: 400309
GlobalBanError: 400312
BusinessError: 500000
Unknown: 800000
InvalidParameter: 800110
MalformedData: 800130
ErrorQueryInProgress: 800170
ConnectionError: 800210
When an error is returned as a result of an action from your side (e.g. trying to join a channel), the action is considered completed and the SDK will not execute any additional logic.
The EkoClient
includes a clientErrorDelegate
property that can be set to an error handler delegate class on your application. This error delegate gives you a chance to be notified of errors that can potientially break the functionality of the SDK. The SDK logic is usually robust enough to automatically handle most errors, as such, only unrecoverable errors are exposed through this delegate (for example, if the login session was invalidated).
We recommend you to always handle these errors in a production app by gracefully disabling messaging functionality in the event of an error.
Currently, Android does not support Live-Objects as such, we use a protocol that follows ReactiveX for Kotlin and Java related data streams.
You can find out more information here; https://github.com/ReactiveX/RxKotlin
Make users share their life snippets through their short videos
This functionality is not currently supported for Android but will be coming soon! We will update the relevant sections accordingly in good time
To broadcast a live stream video, we provide a convenient broadcaster tool called EkoStreamBroadcaster
. We now only support 16:9 video ratio with the following resolution representing by the enum EkoStreamBroadcastResolution
:
.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 initialisation process, you need to register the video publisher sdk to the core sdk by calling.
We highly recommend to use Android's ConstraintLayout to construct our EkoCameraView
Since we only support 16:9 video ratio, ConstratntLayout will ensure that the view will be drawn in the correct width and height.
EkoStreamBroadcaster
requires the following permissions to work properly.
As per the required parameter by the aforementioned object to provide EkoCameraView
, you will need to define the view in your Activity or Fragment layout by :
Camera access
Microphone access
Before using EkoStreamBroadcaster
, 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 a EkoStreamBroadCaster.Builder
class to create and configure this object easily. It requires EkoCameraView
as a parameter and EkoStreamBroadcasterConfig
as a configurable value which will be explained in the following section.
For configuration, we provide a EkoStreamBroadcasterConfiguration.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 EkoCameraView
, you need to define the view in your Activity or Fragment layout by :
We highly recommend to use Android's ConstraintLayout to construct our EkoCameraView
Since we only support 16:9 video ratio, ConstratntLayout ensures that the view will be drawn in the correct width and height.
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 EkoStreamBroadcasterState
. 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(e:Exception)
indicates a status of stream that it's disconnected to a rtmp server. We also provide an error information through an exception.
This section outlines how you can set-up your project for success and begin using our Chat SDK for Android.
Before using the Chat SDK, you will need to create a new SDK instance with your API key. Please find your account API key via the Admin Panel. If you have trouble finding this, you can send our support team an email at developer@amity.co
In order to use any Chat SDK feature, you must first register the current device with an userId
. A registered device will be tied to the registered userId
until the device is either proactively unregistered, or until the device has been inactive for over 90 days. A registered device will receive all the events messages belonging to the tied user.
An optional displayName
can be provided, which will be used in standard push notifications (related to user's actions, such as when the new message is sent).
The
displayName
is set only on the first time the device is registered, please follow your platforms necessary directions if you would like to rename this to something else.
When the user logs out, you should explicitly unregister the user from the SDK as well. This prevents the current device from receiving unnecessary and/or restricted data.
Each user can be registered, at the same time, to an unlimited number of devices. Amity's Chat SDK will automatically synchronize the user data across all registered devices. We will also automatically unregister any device that has not been connected to the server for more than 90 days.
When a device is unregistered due to inactivity, the SDK data on the device will be reset. You will need to re-register this device in order to connect to server again.
If you have any logic or UI around the connection status, you can observe the connectionStatus
property on the EkoClient
instance.
Since the Chat SDK automatically manages the network connection and queue up any requests in cases of bad connection, there should be little need to attach additional logic to this status. However the user may want to know the exact network status to determine if their actions will be performed in real-time, therefore this status is exposed.
Host your events virtually and see community interaction as it happens
Live streams and playback videos information are stored in EkoStream
. This stream objects reside in EkoStreamRepository
. 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 developer@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 EkoStream
. 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.
Ekostream.Status
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 progess 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()
.
EkoStreamRepository provides a convenient method getStreamCollection
and also call setStatus(statuses: Array<Ekostream.Status>)
to query live streams. We provide enums of stream status as Ekostream.Status
You can observe changes in a collection as per the defined statuses.
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 EkoWatcherData.Format.
This function provides request/response API. The callback of this function returns string of the url.This object contains a full FLV, RTMP or HLS url.
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 EkoWatcherData.Format.
This function provides request/response API. The callback of this function returns string of the url.This object contains a full FLV, MP4 or M3U8 url.
We recommend to use 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 to use DefaultDataSourceFactory
For RTMP we highly recommend to use the RtmpDataSourceFactory
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.
This page contains an overview of all relevant changes made to the Amity Video SDK modules and the latest version releases
Eko Messaging SDK 4.7.2 is released.
New APIs
Breaking APIs
None
Deprecations
None
Fixes
None
Behavioural changes
None
Compatibility
OKHTTP - 3.10.0
Retrofit - 2.4.0
Kotlin-std-lib - 1.3.72
Eko Messaging SDK 4.7.1 is released.
None
None
None
Optimize PagedList configuration
Fix incorrect pagination of categories
None
OKHTTP - 3.10.0
Retrofit - 2.4.0
Kotlin-std-lib - 1.3.72
Eko Messaging SDK 4.7.0 is released.
None
None
None
None
OKHTTP - 3.10.0
Retrofit - 2.4.0
Kotlin-std-lib - 1.3.72
Eko Messaging SDK 4.6.0 is released.
Change query option setIsLive(isLive: Boolean)
to setStatus(statuses: Array)
in EkoStreamQuery.Builder
. The user is now able to query live-stream videos based on its statues.
Query memberships by role. .role(role: String)
ImprovegetMyReactions()
performance on EkoMessage
, EkoPost
, EkoComment
None
OKHTTP - 3.10.0
Retrofit - 2.4.0
Kotlin-std-lib - 1.3.72
Eko Messaging SDK 4.5.1 is released.
None
None
None
Active user missing from community list when community has more than 10 members
None
OKHTTP - 3.10.0
Retrofit - 2.4.0
Kotlin-std-lib - 1.3.72
Eko Messaging SDK 4.5.0 is released.
Add query option setIsLive(boolean)
in EkoStreamQuery.Builder
. The user is now able to query currently live or ended live-stream videos.
Add new method getRecordings()
in EkoStream
model . The user is now able to get recorded videos.
None
None
None
None
OKHTTP - 3.10.0
Retrofit - 2.4.0
Kotlin-std-lib - 1.3.72
This section outlines how you can set-up your project for success and begin using our Chat SDK for Web applications
Before using the Video SDK, you will need to create a new SDK instance with your API key. Please find your account API key via the Admin Panel. If you have trouble finding this, you can send our support team an email at developer@amity.co
In order to use any Video SDK feature, you must first register the current device with an userId
. A registered device will be tied to the registered userId
until the device is either proactively unregistered, or until the device has been inactive for over 90 days. A registered device will receive all the events messages belonging to the tied user.
An optional displayName
can be provided, which will be used in standard push notifications (related to user's actions, such as when the new message is sent).
The
displayName
is set only on the first time the device is registered, please follow your platforms necessary directions if you would like to rename this to something else.
When the user logs out, you should explicitly unregister the user from the SDK as well. This prevents the current device from receiving unnecessary and/or restricted data.
Each user can be registered, at the same time, to an unlimited number of devices. Amity's Video SDK will automatically synchronize the user data across all registered devices. We will also automatically unregister any device that has not been connected to the server for more than 90 days.
When a device is unregistered due to inactivity, the SDK data on the device will be reset. You will need to re-register this device in order to connect to server again.
If you have any logic or UI around the connection status, you can observe the connectionStatus
property on the EkoClient
instance.
Since the SDK automatically manages the network connection and queue up any requests in cases of bad connection, there should be little need to attach additional logic to this status. However the user may want to know the exact network status to determine if their actions will be performed in real-time, therefore this status is exposed.
You can also be notified about connectionStatus
changes via the connectionStatusChanged
event.
Add a function to observe broadcasting status in EkoStreamBroadcaster. For further information please see .
Introduce eko-video-publisher
for video broadcasting. Refer to documentation.
Add manual paging functionality to EkoCommentQuery
Refer to documentation.
Add new option .roles(roles: List<String>)
inEkoChannelMembershipQuery.Builder
. Refer to documentation.
Add new option .sortBy(option: EkoCommentSortOption)
in EkoCommentQuery.Builder
. Refer to documentation.
Add new API getLatestComment()
in EkoCommentRepository
. Refer to documentation.
Add custom dataType
support for EkoPost
. Refer to documentation.
All data returned by the SDK are wrapped in the SDK's LiveObject API. The LiveObject API allows you to easily retrieve the queried data asynchronously, as well as subscribe to any new changes to the data.
Observing live changes to any object queries can be done by observing the dataUpdated
event on the LiveObject:
In this example the block observes the data of the currently authenticated user and prints out the displayName
. The observe block can be called multiple times throughout the lifetime of the application:
If the requested object data is stored locally on the device, the block will be called immediately with the local version of the data (you can verify this through the dataStatus
property).
In parallel, a network request for the latest version of the data is fired. Once the network returns the data, the observe block will be called again with the updated data.
Any future changes to the data (whenever the user changes its displayName
on another device, for example) can trigger additional callbacks.
We recommend you to always call removeAllListeners()
whenever you are done observing event to avoid any unnecessary callbacks.
The data provided by LiveObject is directly accessible via the model
property. The model
property is always kept up to date with the latest state changes; every time when dataUpdated
event is fired, the model
property has already been updated.
If in your UI you want to exclusively display fresh data (without using the potientially out-of-date local data), you can do so by reading the object's dataStatus
property, which reflects the status of the callback data, and check that its value is set to fresh.
You can also use the object's loadingStatus
property to determine the current state of network operations being performed by the LiveObject. This is useful for any UI element that needs to provide the loading state.
The LiveObject can also emit events for updates for dataStatus
as well as loadingStatus
. As with other events, please make sure to call removeAllListeners()
when you are done observing changes to these values in order to prevent memory leaks.
The LiveObject updates statuses and data in strict order and emits related events accordingly when an instance is created. Few different cases might occurs when you create a LiveObject instance:
Initial values:
loadingStatus = EkoLoadingStatus.Loading
dataStatus = EkoDataStatus.NotExist
model = undefined
Process received data:
emits loadingStatusChanged
emits dataStatusChanged
emits dataUpdated
Initial values:
loadingStatus = EkoLoadingStatus.Loading
dataStatus = EkoDataStatus.Local
model = localData
Process received data (same order):
emits loadingStatusChanged
emits dataStatusChanged
emits dataUpdated
- only if data is really different
loadingStatus = EkoLoadingStatus.Loaded
dataStatus = EkoDataStatus.Fresh
model = localFreshData
The LiveObject API supports queries that return a list of objects, this is known as a LiveCollection. LiveCollection has the same methods and properties as its object counterpart, but contains a few other helper methods around pagination.
Pagination with LiveCollections is very simple: the collection offers a convenient nextPage
method that you can call which will automatically trigger a local cache lookup, a network call, and multiple LiveObject updates once new data is returned. Every collection starts with one page of 20 models. After nextPage()
is successful, the dataUpdated
event will be triggered with a new array combining both the old objects as well as 20 newly fetched objects.
You can use the
hasMore
property to determine if you've scrolled to the end of the list. ThehasMore
property initially returns 'false' until the first collection query is finished.
Lastly, if there is a need to shrink the list of objects exported back to only the first 20 records (for example, if you pass the LiveCollection object to a new view), you can simply call resetPage()
.
Similar to model
property of the LiveObject, the LiveCollection provides models
property what is basically is an array of LiveObject's model
objects. models
is mutable and always contains same data as one what returned by dataUpdated
event.
Both LiveObject and LiveCollection can be subscribed to the dataError
event which is fired every time an error happens during the data update process. In other words, every time the LiveObject or LiveCollection fails to get data from the server - this error will be emmited.
We recommend you to always call dispose()
whenever you are done working with any LiveObject/LiveCollection.
Dispose is a very important functionality of the LiveObject. It allows you to avoid memory leaks and keeps your application performant. What does dispose()
do:
unsubscribe all listeners attached to the LiveObject instance;
stop all internall observers related to the LiveObject instance;
clean up an internall buffer of the LiveObject instance;
After you call dispose()
on a LiveObject instance, dataStatus and loadingStatus switch to Error
.
Error objects can be returned to you via LiveObjects, callbacks, or from the error
event emitted by the EkoClient
instance. The possible error codes are listed in a public ErrorCode
object: each case is named after its error and they're pretty self explanatory.
UnauthorizedError: 400100
ItemNotFound: 400400
BadRequestError: 400000
Conflict: 400900
ForbiddenError: 400300
PermissionDenied: 400301
UserIsMuted: 400302
ChannelIsMuted: 400303
UserIsBanned: 400304
NumberOfMemberExceed: 400305
ExemptFromBan: 400306
MaxRepetitionExceed: 400307
BanWordFound: 400308
LinkNotAllowed: 400309
BusinessError: 500000
Unknown: 800000
InvalidParameter: 800110
MalformedData: 800130
ErrorQueryInProgress: 800170
ConnectionError: 800210
When an error is returned as a result of an action from your side (e.g. trying to join a channel), the action is considered completed and the SDK will not execute any additional logic.
The EkoClient
emits a dataError
event that can be observed by your application. This error event gives you a chance to be notified of errors that can potentially break the functionality of the SDK. The SDK logic is usually robust enough to automatically handle most errors, as such, only unrecoverable errors are exposed through this delegate (for example, if the login session was invalidated).
We recommend you to always handle these errors in a production app by gracefully disabling messaging functionality in the event of an error.
Host your events virtually and see community interaction as it happens
This functionality is not currently supported for Web but will be coming soon! We will update the relevant sections accordingly in good time
All the errors returned by the SDK come in form of an EkoException
. The possible error codes are listed in a public EkoError
enum: each case is named after its error and they are designed to be self explanatory.
You can convert an EkoException
into EkoError
enum with the following:
When an error is returned as a result of an action from your side (e.g. trying to join a channel), the action can considered complete, and the SDK will not execute any additional logic.
The EkoClient
class includes the EkoClient.errors()
method that can be called and observed to asynchronous errors. This observable object notifies you of errors that can potentially break the functionality of the SDK. The SDK logic is usually robust enough to automatically handle most errors, as such, only unrecoverable errors are exposed through this observable (for example, if the login session was invalidated).
We recommend you to always handle these errors in a production app by gracefully disabling messaging functionality in the event of an error.
Make users share their life snippets through their short videos
This functionality is not currently supported for Web but will be coming soon! We will update the relevant sections accordingly in good time
This functionality is not currently supported for Web but will be coming soon! We will update the relevant sections accordingly in good time.
Error
Code
BAD_REQUEST_ERROR
400000
INVALID_REGULAR_EXPRESSION
400001
UNAUTHORIZED_ERROR
400100
FORBIDDEN_ERROR
400300
PERMISSION_DENIED
400301
USER_IS_MUTED
400302
CHANNEL_IS_MUTED
400303
USER_IS_BANNED
400304
NUMBER_OF_MEMBER_EXCEED
400305
EXEMPT_FROM_BAN
400306
MAX_REPETITION_EXCEED
400307
BAN_WORD_FOUND
400308
LINK_NOT_ALLOWED
400309
TOO_MANY_MEMBER_ERROR
400310
RPC_RATE_LIMIT_ERROR
400311
USER_IS_GLOBAL_BANNED
400312
ITEM_NOT_FOUND
400400
CONFLICT
400900
BUSINESS_ERROR
500000
Error
Code
UNKNOWN
800000
INVALID_PARAMETER
800110
MALFORMED_DATA
800130
FILE_SIZE_EXCEEDED
800140
CONNECTION_ERROR
800210
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
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 on these SDK’s can be found under each of the following sections, for the respective platform (iOS, Android, Web).
Host your events virtually and see community interaction as it happens
Make users share their life snippets through their short videos
Let users react to messages, posts, and comments, which are visible to others
Ensure that your users don’t miss important content from each other
This page contains an overview of all relevant changes made to the Amity Video SDK modules and the latest version releases
iOS Android Web
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.
The Chat SDK for Android is delivered via maven repository.
Add the Jitpack repository in your project level build.grade
at the end of repositories:
Add the dependency in your module level build.grade
:
To get started using the SDK, data binding is required as a mandatory dependency. You need to download the library from the Support Repository in the Android SDK manager. For more information, see Update the IDE and SDK Tools.
To configure your app to use data binding, enable the dataBinding
build option in your build.gradle
file in the app module, as shown in the following example:
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 in good time