安全重置在$ P $ MediaPlayer在pparing状态?

编程入门 行业动态 更新时间:2024-10-25 16:20:57
本文介绍了安全重置在$ P $ MediaPlayer在pparing状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在写用的MediaPlayer,允许用户跳过的实际调的音频播放器。跳过请求可能发生在任何时间,包括调用MediaPlayer的。prepareAsync和prepared回调即将到来之间。该医生说:

I'm writing an audio player using MediaPlayer that allows the user to skip the actual tune. A skip request might occur at any time, including between a call to MediaPlayer.prepareAsync and the upcoming onPrepared callback. The doc says:

值得注意的是,preparing状态是过渡状态,并呼吁有副作用的任何方法的行为而MediaPlayer对象是在preparing状态是不确定的,是非常重要的。

这是否包括调用reset,甚至释放?因为如果是这样,那我要么必须等待上prepared回调重用的MediaPlayer或者分配一个全新的MediaPlayer,如果我不想等待,释放过时一个在上prepared回调,对吧?

Does that include calls to reset, or even to release? Because if it so, then I would either have to wait for the onPrepared callback to reuse the MediaPlayer or allocate a brand new MediaPlayer if I don't want to wait and release the obsolete one on the onPrepared callback, right?

推荐答案

在我看来,我会遵循文档的建议,我发现了一些问题,球员在不同的设备(在某些设备并不稳定可言重用相同播放器)。

In my opinion i will follow the advice in the docs, i found several issues with player in different devices (in some devices is not stable at all reusing the same player).

我觉得一个很好的选择是要分配的的球员,当用户跳过调整它们之间进行切换,那么你就等着原作的玩家才能到达prepared状态,然后您安全地重置。

I think a good option is to have to players allocated, and switch between them when user skips a tune, then you wait for the original player to arrive to prepared state and then you reset it safely.

更多推荐

安全重置在$ P $ MediaPlayer在pparing状态?

本文发布于:2023-10-24 08:53:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1523494.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:状态   MediaPlayer   pparing

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!