Update & Delete Videos
Updating and deleting videos happens through the video store component that you can retrieve with
VideoKit.videos()
. Just like other network APIs, you will need a valid session
to perform these operation successfully. In addition, the current session identity must match
the identity of the session who originally created the videos.
Updating videos
To update videos, you need to prepare the update params:
// Option 1: Simple constructor
val params = VideoUpdateParams(title = "New Title")
// Option 2: Java-style builder
val params = VideoUpdateParams.builder()
.title("New Title")
.tags("New Tag")
.metadata("New Key", "New Value")
.location(latitude, longitude)
.build()
// Option 3: Kotlin-friendly builder
val params = VideoUpdateParams.builder {
title("New Title")
tags("New Tag")
metadata("New Key", "New Value")
location(latitude, longitude)
}
Then, the request must be passed to the video store:
val videos: VideoStore = VideoKit.videos()
videos.update(params).onSuccess {
// Updated!
}.onError {
// Something went wrong
}
Coroutine projects can use updateSuspending()
as well.
Deleting videos
To delete videos, all you need is the id of the video:
val videos: VideoStore = VideoKit.videos()
videos.delete("id").onSuccess {
// Deleted!
}.onError {
// Something went wrong
}
Coroutine projects can use deleteSuspending()
as well.