Query Videos
To access all videos in the library, we have a service called VideoStore
that allows you to manage all your videos.
Note that just like all other network APIs, you will need a valid session to use it. You can ensure that you have a valid session by checking SessionManager.state
is equal to SessionState.CONNECTED
.
Fetch single video
Single videos can be fetched by id with the getVideo()
method:
try {
const video = await VideoStore.getVideo(id)
} catch (error) {
// Something went wrong
}
Query lists
The video store can return lists of videos (VideoList
) by calling getVideos()
. VideoList
represents an object with an array of videos (videos
) and total video count (totalCount
).
{
videos: [Video, Video, ...],
totalCount: 100
}
Here's some request examples:
All videos
try {
const videos = await VideoStore.getVideos()
} catch (error) {
// Something went wrong
}
Get next page of videos
try {
const videos = await VideoStore.getVideos({
sortOrder: SortOrder.DESC,
offset: 50,
limit: 50
})
} catch (error) {
// Something went wrong
}
Get videos by ids
try {
const videos = await VideoStore.getVideos({
ids: [
'1a073e79-82d0-4d09-8640-44faa6ac0906',
'5fba1709-5cd5-4fb3-9b77-7987d550f9f3'
]
})
} catch (error) {
// Something went wrong
}
Get user videos using identity
try {
const videos = await VideoStore.getVideos({
identity: 'Daniel'
})
} catch (error) {
// Something went wrong
}
Filter by metadata and tags
try {
const videos = await VideoStore.getVideos({
metadata: {
'key1': 'value1'
},
tags: ['tag1']
})
} catch (error) {
// Something went wrong
}