1
我在我的應用程序上使用YoutubeAPI,但我得到illegalstateexception
以下代碼。它說player has been released
。我該如何解決這個問題Youtubeapi illegalstateexception播放器已發佈
@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
你可以發佈你的代碼的其餘部分(你如何加載視頻)? –
您是否嘗試過示例應用程序?並嘗試player.loadVideo(id);? –
沒有我說的是取代player.cueVideo(video_URL);使用player.loadVideo(video_URL);你有沒有看到Android的YouTube的api示例應用程序? –