Android的MediaPlayer的警告:如果已经设置副标题控制器副标题、控制器、Android、MediaPlayer

2023-09-07 08:44:36 作者:那份多的爱~

我的Nexus 4已升级到4.4,现在只要MediaPlayer的播放声音,我得到​​了警告:

My Nexus 4 got upgraded to 4.4 and now whenever MediaPlayer plays a sound, I get the warning:

Should have subtitle controller already set

在调用的时候并且还 mp.release()我现在明白了警告

mediaplayer went away with unhandled events

4.3上的Nexus 7相同的应用程序不会显示这些警告。

The same app on a Nexus 7 with 4.3 doesn't display these warnings.

推荐答案

Android 4.4系统 奇巧,有一项新功能,它支持 WebVTT HLS 已推出的 MediaPlayer的一些修改。 (参考: 奇巧亮点的 - 限制字幕)

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)

从你的错误的描述,它看起来像实际的播放器引擎不调用 setSubtitleAnchor VideoView 是做here.这就导致了错误消息从另一种方法here它被调用为 prepare 状态转变的一部分调用监听器之前。

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 here which is invoked as part of the prepare state transition before invoking the listener.

PS:是您的播放器自定义播放器或标准的播放器来pre-捆绑为安卓发行版的一部分?你可以共享任何进一步的日志?

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?