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

How for Youtube Playlists Make autoplay and redirect it to Native Installed YouTube App #1100

Open pooya-mohammadhossein opened 9 months ago

pooya-mohammadhossein commented 9 months ago

@PierfrancescoSoffritti

I have managed to use this library to play both YouTube videos and playlists with Google TV Chromecast (Android 14), but I have one critical issue. How can I enable autoplay for YouTube playlists and redirect them to the native installed YouTube app? P.S. When I disable autoplay by setting it to zero, it redirects to the YouTube native installed application. However, when I enable autoplay and set it to 1, autoplay works but it stays on the web view. Could someone please kindly let me know how I can have autoplay enabled and redirect playlists to the native YouTube installed app? Please consider that Users your library in Android use Different devices , I mean I am using it in Google Tv and it should be user and remote control friendly too. Thanks.

      IFramePlayerOptions iFramePlayerOptions = new IFramePlayerOptions.Builder()
          .controls(1)
          .autoplay(1)
         .listType("playlist")
          .list(PLAYLIST_ID)
          .build();
      getLifecycle().addObserver(youTubePlayerView);
      youTubePlayerView.initialize(youtubePlayerListener, true, iFramePlayerOptions);

Kindest Regards, Sincerely