Android MediaPlayer 警告:应该已经设置了字幕控制器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20166186/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android MediaPlayer warning: Should have subtitle controller already set
提问by PFort
My Nexus 4 got upgraded to 4.4 and now whenever MediaPlayer plays a sound, I get the warning:
我的 Nexus 4 升级到 4.4,现在每当 MediaPlayer 播放声音时,我都会收到警告:
Should have subtitle controller already set
And also when calling mp.release()
I now get the warning
而且在打电话时mp.release()
我现在收到警告
mediaplayer went away with unhandled events
The same app on a Nexus 7 with 4.3 doesn't display these warnings.
Nexus 7 4.3 上的同一个应用程序不会显示这些警告。
回答by Ganesh
In Android 4.4
kitkat
, there is a new feature which supports WebVTT
for HLS
which has introduced some changes in MediaPlayer
. (Reference: Kitkat
highlights- Closed Captions)
在Android 4.4
kitkat
,没有支持新的功能,WebVTT
为HLS
它推出了一些变化MediaPlayer
。(参考:Kitkat
亮点- 隐藏字幕)
From your description of the error, it looks like the actual player engine is not invoking setSubtitleAnchor
as VideoView
is doing here. This leads to the error message from another method herewhich is invoked as part of the prepare
state transition before invoking the listener.
从你的错误的描述,它看起来像实际的播放引擎不调用setSubtitleAnchor
因为VideoView
是做在这里。这会导致此处另一个方法的错误消息prepare
在调用侦听器之前作为状态转换的一部分被调用。
P.S:Is your player a custom player or a standard player which comes pre-bundled as part of the Android
distribution? Can you share any further logs?
PS:您的播放器是自定义播放器还是作为发行版一部分预先捆绑的标准播放器Android
?你能分享更多的日志吗?
回答by DroidShout
mp.reset();
mp.release();
That should help you get rid of the second warning
这应该可以帮助您摆脱第二个警告