PierfrancescoSoffritti / android-youtube-player

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

Unable to play a youtube video inside a dialog #1061

Open gauri-singh opened 1 year ago

gauri-singh commented 1 year ago

I am trying to play a YouTube video inside a dialog box. However, I suspect the video isn't playing due to dialogs not having a distinct lifecycle. While the YouTube video loads, it shows "this video is unavailable," even though the same video works in an activity within the same app.

I followed the method of rendering the activity as a dialog, as outlined here: https://developer.android.com/develop/ui/views/components/dialogs#ActivityAsDialog. However, this approach requires extending Activity instead of AppCompatActivity. Activity Class does not have a getLifeCycle().addObserver() method. any help would be appreciated

Screenshot 2023-09-22 at 1 37 10 PM
PierfrancescoSoffritti commented 1 year ago

The lifecycle does not affect the player's ability to play a video. Please double check your code in the dialog to make sure everything is correct.