-
-
Couldn't load subscription status.
- Fork 774
Open
Labels
Description
Bug Report
Description of the Bug
On my API 28 emulator I noticed that the YouTube embed player appears zoomed in, only the top right quadrant of the video is visible. In the screenshot below, the center message is a youtube video.
Environment details
Android Version: 9
API Version: 28
Tested devices:
Android Studio Emulator Pixel 2 API 28
Android Studio Emulator Pixel 3 API 28
Youtube Player Library Version: 12.1.2
Steps to reproduce the bug
- Use Android Studio Emulator device with API 28
- Programmatically create YoutubePlayer
- Add to ViewGroup (LinearLayout) which lies in a RecyclerView
- Run the application on the targeted device (as mentioned earlier)
- Navigate to that YoutubePlayer on the emulator
- Observe the player is zoomed in and only shows the top right quadrant
- Video is still clickable and you can hear audio in the background
What I've tried
- Tested on APIs above 28 to see if it's an isolate case to level 28 (same code works normally on 29+)
- Set layout parameters to
MATCH_PARENT,WRAP_CONTENTfor width and height respectively, and set margins and paddings to 0 - Confirmed
hardwareAcceleratedis set to true
Additional information
| When navigating to player | When clicked on | Works on Pixel3 with API 29 |
|---|---|---|
![]() |
![]() |
![]() |
Relevant codeblock
val youTubePlayerView = YouTubePlayerView(view.context).apply {
enableAutomaticInitialization = false
}
val iFramePlayerOptions = IFramePlayerOptions.Builder()
.rel(0)
.autoplay(0)
.controls(1)
.build()
val youTubePlayerListener = object : AbstractYouTubePlayerListener() {
override fun onReady(youTubePlayer: YouTubePlayer) {
youTubePlayer.cueVideo(videoId, 0f)
youTubePlayerView.visibility = View.VISIBLE
}
override fun onError(youTubePlayer: YouTubePlayer, error: PlayerConstants.PlayerError) {
youTubePlayerView.visibility = View.GONE
super.onError(youTubePlayer, error)
}
}
viewGroup.addView(youTubePlayerView)
youTubePlayerView.initialize(youTubePlayerListener, iFramePlayerOptions)
lifecycle.addObserver(youTubePlayerView)
bsiegel and dachev


