codepath / codepath/android_guides
Show/Hide subtitle in YouTubePlayer
- Dominant language
- No language data
- Stars
- 28.3k
- Forks
- 6.2k
- PR merge metrics
- No merged PRs in 30d
Description
I'm using a "YouTubePlayerFragment" in my android app. According to our requirements, I need to use "CHROMELESS" player style and use custom controllers. Is it any way to show/hide captions programmatically?
Layout
```
```
Player Initialization:
```
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider,
YouTubePlayer player, boolean wasRestored) {
youTubePlayer = player;
youTubePlayer.setPlayerStyle(YouTubePlayer.PlayerStyle.CHROMELESS);
youTubePlayer.setFullscreenControlFlags(YouTubePlayer.FULLSCREEN_FLAG_CONTROL_SYSTEM_UI);
setPlayPause(isPlaying);
initialProgressHandler();
resumePoint = calculateResumePoint();
if (!wasRestored) {
if (isPlaying)
youTubePlayer.loadVideo(mItem.getVideoId(), resumePoint);
else
youTubePlayer.cueVideo(mItem.getVideoId(), resumePoint);
}
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.