Using unique tag
Using unique tag¶
To have the automatic playback works, you just need this:
kohii.setUp(videoUrl).bind(playerView)
kohii.setUp(videoUrl).bind(playerView);
With this one line, once user scrolls some Videos off screen, and then scrolls them back, the playback position will be reset and the Videos will start from the beginning. If you want the Videos to start from where it was before being scrolled off screen, you need to set an application wide unique tag for the Video. Sample code as below:
kohii.setUp(videoUrl) {
tag = videoUniqueTag
}
.bind(playerView)
By having a unique tag, your Video state will also be retained across configuration changes like Window size change, orientation change or other system config changes. So it is highly recommended to have unique tags for your Videos.
With tag | Without tag |
---|---|