Open chiragtalaviya opened 1 year ago
Please read the doc and have a look at the sample app. The fullscreen video plays in a separate view.
I have already implemented it.
I suggest looking at the sample app, and copy the code from there.
Please share a snippet of how you're handling fullscreen.
lifecycle.addObserver(binding.youtubePlayerView)
val iFramePlayerOptions: IFramePlayerOptions = IFramePlayerOptions.Builder()
.controls(1)
.fullscreen(1)
.build()
binding.youtubePlayerView.initialize(object : AbstractYouTubePlayerListener() {
override fun onReady(youTubePlayer: YouTubePlayer) {
this@FullScreenVideoActivity.youTubePlayer = youTubePlayer
youTubePlayer.loadVideo(Utils.extractYTId(videoLink), 0f)
}
}, true, iFramePlayerOptions)
binding.youtubePlayerView.addFullscreenListener(object : FullscreenListener {
override fun onEnterFullscreen(fullscreenView: View, exitFullscreen: Function0<Unit>) {
isFullscreen = true
binding.youtubePlayerView.visibility = View.GONE
binding.fullScreenViewContainer.visibility = View.VISIBLE
binding.fullScreenViewContainer.addView(fullscreenView)
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
}
override fun onExitFullscreen() {
isFullscreen = false
// the video will continue playing in the player
binding.youtubePlayerView.visibility = View.VISIBLE
binding.fullScreenViewContainer.visibility = View.GONE
binding.fullScreenViewContainer.removeAllViews()
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
}
})
What about your layout file?
Here it is
Does the fullscreen example work when you run directly the sample app?
yes, even my player is working fine in other tablets but in Samsung tablet it showing black screen.
Yes also having same issue some time black screen only ..video not playing
So does the sample app work in your Samsung tablet?
It could be that that specific table has a modified version of Webview.
i have issue with samsung s22 mobile
Have you tried running the sample app?
Actually I don't have that tablet. This issue is reported by user.
i think i missed
@Override
public void onDestroy() {
super.onDestroy();
youTubePlayerView.release();
}
In your AndroidManifest file, add this line in application tag. This might fix your issue
android:hardwareAccelerated="true"
Description of the Bug
It shows black screen while playing video in full screen
Environment details
Android Version: Android 13 API Version: 33
Tested devices:
Youtube Player Library Version: 12.0.0
Steps to reproduce the bug
Expected behavior
Should play video
Actual behavior
Displaying black screen