Concepts
The VideoKit
object
Using the core SDK means interacting with the 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 - the token registry, with
VideoKit.tokens()
, to manage signed playback
These methods return a concrete implementation of base interfaces (respectively,
SessionManager
, UploadManager
, VideoStore
, StreamStore
, TokenRegistry
) 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.
let sessions: SessionManager = VideoKit.sessions()
let uploads: UploadManager = VideoKit.uploads()
let videos: VideoStore = VideoKit.videos()
let streams: StreamStore = VideoKit.streams()
let tokens: TokenRegistry = VideoKit.tokens()
Keep reading to know about the capabilities of each component.
Asynchronous calls
All of our API calls are asynchronous. By convention, such functions accept a completion block with an optional result (non-nil in case of success) and an optional Error
(non-nil in case of failure).
They also return a Cancellable
object that can be used to interrupt the call before it ends, if needed.
For Swift projects that use await
and Swift concurrency features, in most cases we offer an async
function with the same name.