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

在Recycleview里, 正在播放的视频离开屏幕区域后,会引发崩溃 #195

Closed
lovearthhome opened this Issue Jul 8, 2016 · 7 comments

Comments

Projects
None yet
3 participants
@lovearthhome

lovearthhome commented Jul 8, 2016

07-08 20:41:31.190 26741-28158/com.lov.cs E/AndroidRuntime: FATAL EXCEPTION: JieCaoVideoPlayer
Process: com.lov.cs, PID: 26741
java.lang.IllegalStateException
at android.media.MediaPlayer._setVideoSurface(Native Method)
at android.media.MediaPlayer.setSurface(MediaPlayer.java:805)
at fm.jiecao.jcvideoplayer_lib.JCMediaManager$MediaHandler.handleMessage(JCMediaManager.java:104)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.os.HandlerThread.run(HandlerThread.java:61)

@lipangit

This comment has been minimized.

Show comment
Hide comment
@lipangit

lipangit Jul 9, 2016

Owner

过滤一下jiecaovideoplayer的log,记录了详细的工作过程,离开视频区域应该重置视频,为什么会setDisplay

Owner

lipangit commented Jul 9, 2016

过滤一下jiecaovideoplayer的log,记录了详细的工作过程,离开视频区域应该重置视频,为什么会setDisplay

@lovearthhome

This comment has been minimized.

Show comment
Hide comment
@lovearthhome

lovearthhome Jul 11, 2016

@lipangit 你好,不明白你说的这个调试过程,所以就自己试了试。现在解决了这个问题,解决方法是:每当要给一个jiecaoVideoPlayer设置url之前,都调用releaseAllVideos(). 之所以这么想,是因为,感觉崩溃的地方不是视频控件离开屏幕的地方,而是视频控件被recycleveiw回收后再次赋值(setUp)时发生崩溃。所以我在赋值前调用了 JCVideoPlayer.releaseAllVideos()。就没有问题了

感觉这个方法不是很优雅,有点暴力。希望jiecaovideoplayer能够更好的兼容recycleview(如果确实是我说的这个问题)
....
JCVideoPlayer.releaseAllVideos();
videoPlayer.setUp(videoUrl, content_obj.optString("title"));
....
这样,

lovearthhome commented Jul 11, 2016

@lipangit 你好,不明白你说的这个调试过程,所以就自己试了试。现在解决了这个问题,解决方法是:每当要给一个jiecaoVideoPlayer设置url之前,都调用releaseAllVideos(). 之所以这么想,是因为,感觉崩溃的地方不是视频控件离开屏幕的地方,而是视频控件被recycleveiw回收后再次赋值(setUp)时发生崩溃。所以我在赋值前调用了 JCVideoPlayer.releaseAllVideos()。就没有问题了

感觉这个方法不是很优雅,有点暴力。希望jiecaovideoplayer能够更好的兼容recycleview(如果确实是我说的这个问题)
....
JCVideoPlayer.releaseAllVideos();
videoPlayer.setUp(videoUrl, content_obj.optString("title"));
....
这样,

@lovearthhome

This comment has been minimized.

Show comment
Hide comment
@lovearthhome

lovearthhome Jul 11, 2016

@lipangit 我在这个issue上发下了在Listview下的解决方案
#172
都是用releaseAllVideos();

lovearthhome commented Jul 11, 2016

@lipangit 我在这个issue上发下了在Listview下的解决方案
#172
都是用releaseAllVideos();

@lipangit

This comment has been minimized.

Show comment
Hide comment
@lipangit

lipangit Jul 11, 2016

Owner

同学,这么做好像有问题,如果正在播放视频,在保证视频一直播放的时候滑动列表,如果有新item就会调用JCVideoPlayer.releaseAllVideos();这时候视频就停止了

Owner

lipangit commented Jul 11, 2016

同学,这么做好像有问题,如果正在播放视频,在保证视频一直播放的时候滑动列表,如果有新item就会调用JCVideoPlayer.releaseAllVideos();这时候视频就停止了

@lovearthhome

This comment has been minimized.

Show comment
Hide comment
@lovearthhome

lovearthhome Jul 12, 2016

@lipangit 是哈,是有这样的问题,目前只能这么将就一下。有没有更好的办法啊?

lovearthhome commented Jul 12, 2016

@lipangit 是哈,是有这样的问题,目前只能这么将就一下。有没有更好的办法啊?

@zeroci

This comment has been minimized.

Show comment
Hide comment
@zeroci

zeroci Aug 11, 2016

@lovearthhome对RV 或者LV 的scroll进行监听,划分一个区域 就是每个item在当前可视的区域,超出就停止

zeroci commented Aug 11, 2016

@lovearthhome对RV 或者LV 的scroll进行监听,划分一个区域 就是每个item在当前可视的区域,超出就停止

@lipangit

This comment has been minimized.

Show comment
Hide comment
@lipangit

lipangit Oct 25, 2016

Owner

用新版

Owner

lipangit commented Oct 25, 2016

用新版

@lipangit lipangit closed this Oct 25, 2016

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