Question

I am using YoutubeAPI on my app but I am getting illegalstateexception of the following code.It says player has been released. How do I overcome this problem

@Override
    protected void onResume() {

            if (video_player != null ){

                video_player.seekToMillis(pausedDuration);

        }
        // <-- this will cause re-buffer.
        super.onResume();
    }

edit 1 initialization of player

@Override
    public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player,boolean wasRestored) {
        if (!wasRestored) {

            player.cueVideo(video_URL);
            video_player=player;
            prev_cat=cat_id;

        }
    }

Also, I am unable to watch the video of full screen

full-screen code

12-16 15:02:38.859: D/YouTubeAndroidPlayerAPI(22422): apps.youtube.core.player.Director.a:473 VideoStage: NEW
12-16 15:02:38.969: E/YouTubeAndroidPlayerAPI(22422): apps.youtube.core.player.Director.F:521 Media progress reported outside media playback
12-16 15:02:38.979: D/YouTubeAndroidPlayerAPI(22422): apps.youtube.core.player.sequencer.a.<init>:41 SequencerStage: New o
12-16 15:02:38.979: D/YouTubeAndroidPlayerAPI(22422): apps.youtube.core.player.sequencer.a.a:46 SequencerStage: NEW
12-16 15:02:38.989: D/YouTubeAndroidPlayerAPI(22422): apps.youtube.core.player.Director.a:627 PlaybackState reset by init
12-16 15:02:39.019: D/YouTubeAndroidPlayerAPI(22422): apps.youtube.core.player.sequencer.a.a:46 SequencerStage: VIDEO_LOADING 
Was it helpful?

Solution

I overcome this issue by making videoPlayer null in onDestroy of Activity.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top