Skip to content
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

VideoPlayerActivity.java的各种对象的生命周期处理不当 #3

Open
MilesChan opened this issue Sep 16, 2015 · 3 comments
Open

Comments

@MilesChan
Copy link

如果从VitamioPlayer更换为系统的MediaPlayer,就会发现各种mediaPlayer的illegalState异常,而代码中异常捕获太少,各种崩溃

如:timerTask启动太早,应该在startVideoPlayback函数中启动.否则各种异常
另外清理工作不够彻底,也容易导致播放器异常

private void doCleanUp() {
mVideoWidth = 0;
mVideoHeight = 0;
mIsVideoReadyToBePlayed = false;
mIsVideoSizeKnown = false;
releaseMediaPlayer();
handler.removeCallbacksAndMessages(null);
if (timerTask != null) {
timerTask.cancel();
timerTask = null;
}
if (timer != null) {
timer.cancel();
timer = null;
}
}

最好还是用系统播放器来做,等ok后,再替换为Vitamio,否则各种问题被隐藏.

@MilesChan
Copy link
Author

毕竟有部分用户不想用vitamio,因为会导致apk变的较大

@MilesChan
Copy link
Author

还有很多其他问题,比如seek必须在startVideoPlayback之后,基本上在播放器准备好之前,任何操作都是无效的,直接导致播放起始位置没生效

@gpfduoduo
Copy link
Owner

@MilesChan 协议之上,用什么播放器可以自行处理修改。谢谢…… 目前android自带的播放器是不好用的,一般这个东西用于盒子开发,盒子厂商肯定使用自己的播放器这样就好多了。
另外 关于这个问题,代码中我使用了vitamio的videoview,这个类用起来不太好,倒是seek等出问题。另外代码中还有使用了vitamio的mediaplayer是没有这个问题的。
使用seek是因为想要实现断点继续播放。代码中使用mediaplayer的那个是没有问题。 之不过很简单。没有进行全屏处理等。
谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants