Using the core SDK means interacting with the
io.video.videokit.VideoKit object. This is the
entry point for the whole SDK and gives you access to:
- the session manager, with
VideoKit.sessions(), to retrieve a session token
- the upload manager, with
VideoKit.uploads(), to upload videos
- the video store, with
VideoKit.videos(), to query, update or delete videos
- the stream store, with
VideoKit.streams(), to manage live streams
These methods return a concrete implementation of three interfaces (respectively,
StreamStore) that will let you
communicate with our infrastructure and perform all core operations.
This design makes it very easy to mock the behavior of these components in your unit tests.
Keep reading to know about the capabilities of each component.
Most of our API calls are asynchronous. By default, they are encapsulated in an object called
which will give you full control over the action and handling its results.
First of all, calls can be canceled:
If needed, calls can block the current thread to wait for their result. In this case, the result instance will determine whether the call was successful or not:
However, you will typically observe the call so that no thread is blocked. Results are received in the UI thread by default, but different threads can be specified through the handler parameter:
If you are using Kotlin coroutines, we provide a handy extension called get which suspends the execution until the call has a successful result, or throws an exception.
All objects that produce events implement the
T is a certain type of listener. This interface provides three functions:
addListener(T)to start listening to events
removeListener(T)to stop listening
addListener(LifecycleOwner, T)to start listening for the duration of the lifecycle.
We highly recommend to use the
LifecycleOwner signature as that will ensure that all listeners
are automatically cleared when the scope is destroyed, avoiding hard to catch memory leaks.