PierfrancescoSoffritti / android-youtube-player

YouTube Player library for Android and Chromecast, stable and customizable.
https://pierfrancescosoffritti.github.io/android-youtube-player/
MIT License
3.42k stars 759 forks source link

how to use the full screen listener #610

Open DanielJMorrissey opened 4 years ago

DanielJMorrissey commented 4 years ago

Hello,

I am new to coding so I am learning how to create an app. So far I managed to create an app with 3 youtube videos using the XML and shown the full-screen button.

In non-fullscreen mode, the edges of the youtube videos are not visible but the video plays fine. Upon testing it, when I click on the full-screen button the edges become visible but it does not fill the screen of the phone.

I tried looking for fullscreen listeners online but have failed in finding one or in how to use it.

Would you know how to create a full-screen listener? I don't have any Java so far

bazantik commented 4 years ago

Hi, I just added an answer to a similar issue (how to use the fullscreen) on Stack Overflow. In a nutshell:

Consider it as a "fake" fullscreen" - you are rotating the whole layout while remaining in portrait mode :-)

TavernKeeper20 commented 3 years ago

Hi, I just added an answer to a similar issue (how to use the fullscreen) on Stack Overflow. In a nutshell:

  • create a layout for fullscreen and add it to the parent layout;
  • in the .getPlayerUiController().setFullScreenButtonClickListener remove the YT player View from the layout (eg. trailerLayout) and add the same YT player View into the fullscreen layout;
  • when exiting fullscreen, remove the YT player View from the fullscreen layout and add the same YT player View into the trailerLayout.

Consider it as a "fake" fullscreen" - you are rotating the whole layout while remaining in portrait mode :-)

Do you have this in Java?

bazantik commented 3 years ago

Do you have this in Java?

Hi, unfortunately not, I have it only in Kotlin. But thanks to the similarities between Kotlin and Java, it should be very similar.

TavernKeeper20 commented 3 years ago

Do you have this in Java?

Hi, unfortunately not, I have it only in Kotlin. But thanks to the similarities between Kotlin and Java, it should be very similar.

I've migrated my app to Kotlin just for this and the code seems to not work for some reason. Can I contact you privately? I've been struggling with this for days and would appreciate the help.

bazantik commented 3 years ago

Yes, of course, feel free to contact me via e-mail (in my profile) - although I am not a skilled developer, I am just learning how to code :-)

TavernKeeper20 commented 3 years ago

Sent an email