Reputation: 1
While playing videos in YouTube player I need to restrict the user from seeking forward but he can seek backward. How can we achieve this? Thanks.
Upvotes: 0
Views: 621
Reputation: 1200
YoutubePlayer API has not this possibility, but you can do the trick. The logic is next: you can listen the played position of the player with mYouTubePlayer.getCurrentTimeMillis()
and remember the last played position. When user will make the seek, you should calculate the difference between last played position and getCurrentTimeMillis()
. And if difference more than needed time, just set the maximum available time to seek by mYouTubePlayer.seekToMillis(max_available_time_to_seek)
Upvotes: 2