Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Programmatically load next/previous video in a playlist #887

Closed
x3rocode opened this issue Sep 16, 2022 · 2 comments
Closed

Programmatically load next/previous video in a playlist #887

x3rocode opened this issue Sep 16, 2022 · 2 comments

Comments

@x3rocode
Copy link

x3rocode commented Sep 16, 2022

Feature Request

Describe your idea

Thanks for the addition of new features that using playlist.

  1. Load next/previous vedio when use playlist
  • I can't found next or prev button when using playlist ( This feature is already provided by YouTube API V3. ). or get current video number, and the total number of videos to changing vedio.
  1. Sign with google to use YouTube Premium (remove ads, play private viedos) I found solution !!!!!!! here
  • I don't know it's possible. for using YouTube Premium sign in Google and choose account before playing video to playing private viedos (or playlists) and remove ads. I tried get an access token using OAuth2.0 to use the permission. However, it is not compatible with the 'YouTubePlayerView' library provided by youtube.
  1. Get total time of current viedo.

Expected behavior and realization

private lateinit var player: YouTubePlayer
                     :
youTubePlayerView.initialize(API_KEY, this@MainActivity)

playbtn.setOnClickListener {
            player.play()
        }
pausebtn.setOnClickListener {
            player.pause()
        }

prevbtn.setOnClickListener {
           if(player.hasPrevious){
                    player.previous()
            }
        }
nextbtn.setOnClickListener {
           if(player.hasNext){
                    player.next()
            }
        }
                :

override fun onInitializationSuccess(
        p0: YouTubePlayer.Provider?,
        p1: YouTubePlayer?,
        p2: Boolean
    ) {
        /** add listeners to YouTubePlayer instance **/
        p1?.setPlayerStateChangeListener(playerStateChangeListener);
        p1?.setPlaybackEventListener(playbackEventListener);

        if (!p2) {
            p1?.cuePlaylist(PlayList_ID);
        }
        player = p1!!
    }

image
image

@PierfrancescoSoffritti PierfrancescoSoffritti changed the title Load next/previous vedio when use playlist Programmatically load next/previous video in a playlist Mar 25, 2023
reactormonk added a commit to reactormonk/android-youtube-player that referenced this issue Jun 15, 2023
@PierfrancescoSoffritti
Copy link
Owner

This will be available in version 12.1.0 which releases sometimes this week.

@MuhammadAshikurRahman
Copy link

i want after end of video next video will play automatic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants