Hey @PierfrancescoSoffritti, I have an issue related to the custom actions. I set the actions in initlistener method using the YouTubePlayerTracker class. The buttons appear at first when the video player is initializing but when the video starts to play the buttons disappear. This is the code I used, where ytVideo is the YouTubePlayerView:
ytVideo.initialize(new YouTubePlayerInitListener() {
@Override
public void onInitSuccess(@NonNull final YouTubePlayer youTubePlayer) {
final YouTubePlayerTracker tracker = new YouTubePlayerTracker();
youTubePlayer.addListener(tracker);
PlayerUIController playerUIController = ytVideo.getPlayerUIController();
playerUIController.setCustomAction2(ContextCompat.getDrawable(ContentPageActivity.this, R.drawable.ic_forward_white_24dp), new View.OnClickListener() {
@Override
public void onClick(View view) {
float seekTo = tracker.getCurrentSecond() + 10;
youTubePlayer.seekTo(seekTo);
}
});
playerUIController.setCustomAction1(ContextCompat.getDrawable(ContentPageActivity.this, R.drawable.ic_back_white_24dp), new View.OnClickListener() {
@Override
public void onClick(View view) {
float seekTo = tracker.getCurrentSecond() - 10;
youTubePlayer.seekTo(seekTo);
}
});
playerUIController.showCustomAction1(true);
playerUIController.showCustomAction2(true);
youTubePlayer.addListener(new AbstractYouTubePlayerListener() {
@Override
public void onReady() {
String videoId = getYouTubeId(mContentPageResponse.getContent());
youTubePlayer.loadVideo(videoId, 0);
}
});
}
}, true);
There seem to be an issue with custom actions, they get hidden sometimes. Will be fixed in the next version.
Thank you for reporting the issue :)
Thank you very much for acknowledging the issue. This is a very useful and nicely made library, and was hoping to include in my release. I'll be waiting for a fix.
You're welcome. The next version won't be out before 2/3 weeks, I suggest disabling custom actions for now and re-enabling them after the bugfix.
Bugfix is done. Will be available in the next version.
Most helpful comment
You're welcome. The next version won't be out before 2/3 weeks, I suggest disabling custom actions for now and re-enabling them after the bugfix.