Query Videos
Querying videos happens through the video store component that you can retrieve with VideoKit.videos()
.
All functions of this component are asynchronous and will return the usual Call
object,
described here.
Note that just like all other network APIs, you will need a valid session or the call will return an error.
Fetch single video
Single videos can be fetched by id with the get()
method:
val videos: VideoStore = VideoKit.videos()
videos.get(id).onSuccess {
// Got video!
}.onError {
// Something went wrong.
}
Coroutine projects can use getSuspending()
as well.
Query lists
The video store can return immutable lists of videos (List<Video>
). As with other APIs, we
use request objects to define the query parameters, all extending the VideosRequest
interface.
We expose several types of requests, and in all cases you can set a SortOrder
and limit
and offset
parameters.
Once you have the request, just call getList
:
val videos: VideoStore = VideoKit.videos()
videos.getList(request).onSuccess {
// Got videos!
}.onError {
// Something went wrong.
}
Coroutine projects can use getListSuspending()
as well.
Filter by user
You can filter by user using UserVideosRequest
:
val request = UserVideosRequest(userIdentity)
val request = UserVideosRequest.builder(userIdentity) {
order(SortOrder.DESC)
limit(10)
offset(10)
}
Filter by id
You can filter by id using CustomVideosRequest
:
val request = CustomVideosRequest(ids = listOfIds)
val request = CustomVideosRequest.builder() {
ids("id1", "id2")
order(SortOrder.DESC)
limit(10)
offset(10)
}
Filter by metadata and tags
You can filter by metadata and tags using FilteredVideosRequest
:
val request = FilteredVideosRequest(tags = tags, metadata = metadata)
val request = FilteredVideosRequest.builder() {
tags("tag1", "tag2")
metadata("key", "value")
order(SortOrder.DESC)
limit(10)
offset(10)
}