Youtubeapi非法状态异常播放器已经发布



我在我的应用程序上使用YoutubeAPI,但我得到了以下代码的illegalstateexception。上面写着player has been released。我如何克服这个问题

@Override
    protected void onResume() {
            if (video_player != null ){
                video_player.seekToMillis(pausedDuration);
        }
        // <-- this will cause re-buffer.
        super.onResume();
    }

编辑1播放器的初始化

@Override
    public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player,boolean wasRestored) {
        if (!wasRestored) {
            player.cueVideo(video_URL);
            video_player=player;
            prev_cat=cat_id;
        }
    }

此外,我无法观看全屏的视频

全屏代码

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 

我通过在活动的onDestroy中使videoPlayer为null来解决这个问题。

相关内容

  • 没有找到相关文章