ANDROID_LOOP =真 - 如何避免MediaPlayer的音频循环使用该元数据标签 [英] ANDROID_LOOP = true -- how to avoid MediaPlayer looping audios with this metadata tag

查看:1241
本文介绍了ANDROID_LOOP =真 - 如何避免MediaPlayer的音频循环使用该元数据标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要玩的MediaPlayer设备的铃声又似乎在元数据标签

I want to play device ringtones with MediaPlayer yet it seems when the metadata tag

ANDROID_LOOP = true

设置MediaPlayer正在忽略方法的调用的 setLooping

mMediaPlayer.setLooping(false);

和循环,在任何情况下,该音频。另外,onCompletionListener方法不叫。

and loops the audio in any case. Also the onCompletionListener method is not called.

我注意到,即使音频应用程序,如ES媒体播放器循环音频与这个标签设置为true,不论是否已启用循环。

I noticed that even audio apps like ES Media Player loop audios with this tag set to true regardless if looping is enabled or not.

所以我的问题是,如果我能

So my question is if I can

  • 请MediaPlayer的忽略此标记
  • 临时修改标记,以便MediaPlayer的不循环的音频

这个问题出现了围绕铃声但它当然不是具体的铃声。有趣地教程,我发现玩就怎么铃声都设置mMediaPlayer.setLooping(真正的);让他们没有来处理这个问题似乎...

This question arose around ringtones yet it is of course not ringtone specific. Funnily the tutorials I found on how to play ringtones all set mMediaPlayer.setLooping(true); so that they dont have to handle this problem it seems ...

感谢

推荐答案

可能不是一个满意的答复,但似乎工程师们并不倾向于改变的MediaPlayer 和元数据标记 ANDROID_LOOP = TRUE 的OGG文件。见问题: HTTP://$c$c.google。 COM / P /安卓/问题/详细信息?ID = 1314

Might not be a satisfactory answer, but it seems the engineers are not inclined to change the behavior of MediaPlayer and the metadata tag ANDROID_LOOP=true for ogg files. See issue: http://code.google.com/p/android/issues/detail?id=1314

至于临时修改标签,我不知道你怎么会去这样做。

As for temporarily modifying the tag, I don't know how you could go about doing that.

我没有测试过,但我相信其他声音格式不出现此行为(如MP3或WAV)。也许你可以在OGG文件转换成不同的格式,并保持它们作为临时数据(可能有助于这一点:的 Java的 - 转换OGG格式为MP3 )当然,这似乎是一个很大的开销回放一些文件,但至少它们通常是小文件

I haven't tested it but I believe other sound formats don't exhibit this behavior (e.g. mp3 or wav). Perhaps you could convert the ogg files to a different format and keep them as temp data (might help with this: Java - Convert ogg to mp3) This of course seems like a lot of overhead to play back some files, but at least they're usually small files.

这篇关于ANDROID_LOOP =真 - 如何避免MediaPlayer的音频循环使用该元数据标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆