本文介绍了Youtubeapi非法状态异常播放器已发布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的应用程序上使用YoutubeAPI,但我得到以下代码的illegalstateexception
,它表示player has been released
.我该如何克服这个问题
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();
}
修改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;
}
}
另外,我无法观看全屏视频
Also,I am unable to watch the video of full screen
全屏代码
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
推荐答案
我通过在Activity的onDestroy
中将videoPlayer设置为null来解决此问题.
I overcome this issue by making videoPlayer null in onDestroy
of Activity.
这篇关于Youtubeapi非法状态异常播放器已发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!