Reputation: 1
I'm trying to make a kid-safe youtube player (users can't easily watch unapproved content). Using the CHROMELESS style almost gets there, but users can still click the lower banners or 'Watch Next' button that pops on the video. This takes them to the Youtube app where they could browse to any video.
Similar questions that I've found without resolutions: how to remove bottom overlay ads from custom youtube player Android
Is there any way to disable "Watch Next" block at the end of video using YouTube Android Player API?
Someone in the second thread suggested using "a ViewTreeObserver and hiding that particular view", but I am having trouble getting that to work.
Upvotes: 0
Views: 1502
Reputation: 69
In case anyone is still stuck with this, here is what worked for me. If you are only playing a single video then cue the video when playing is finished but don't call player.play()
unless you want to repeat the video.
if(player.getCurrentTimeMillis()>=player.getDurationMillis())
{
player.cueVideo(CurrentVideoUrl);
}
If you are providing a long list of videos that play one after the other then use an array list
if(player.getCurrentTimeMillis()>=player.getDurationMillis())
{
CurrentVideoIndex++;
CurrentVideoUrl =videosListArray.get(CurrentVideoIndex).getVideoUrl();
player.cueVideo(CurrentVideoUrl);
}
Upvotes: 0
Reputation: 2606
-Hello! Please correct me if i am wrong but this line of code may be helpful to you i think player.setPlayerStyle(PlayerStyle.MINIMAL);
-Try this line this may will sure solve your problem :-
player.setPlayerStyle(PlayerStyle.CHROMELESS);
Upvotes: 1