本文介绍了安卓的MediaPlayer播放M3U8只有音频streamming的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,感谢提前,

在整天看,搜索和尝试,我不知道,如果它甚至有可能,如果这个问题是在code,或者如果问题出在服务器....

After all day looking, searching and trying i do not know if it is even possible, or if the problem is in the code, or if the problem is in the server....

首先,可以的MediaPlayer播放一个M3U8文件?

First of all, can MediaPlayer play a m3u8 file?

在情况下,是的......它只是在版本大于3.0或4.0?

In case Yes...it is only in versions greater than 3.0 or 4.0?

如果我只是尝试播放URL在真实设备4.0.4我得到错误(1,-1010)或错误100或-214 ....在code是简单的:

if i just try to play the url in a real device 4.0.4 i get error (1,-1010) or error 100 or -214.... The code is simple:

MediaPlayer mp = new MediaPlayer();
fich="http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8"; //e.g.
mp.setDataSource(localContext, Uri.parse(fich));
mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
mp.setVolume(((float)volumenAudio / 100), ((float)volumenAudio / 100));
mp.prepare();

有没有在我这样做的方式基误差?一些我不知道的?

Is there a base error in my way of doing this? something i do not know?

最好的问候和感谢,

推荐答案

要你的第一个问题,可以的MediaPlayer播放一个 M3U8 文件?的,答案是的MediaPlayer 不支持 MP3 播放列表文件的播放。

To your first question, can MediaPlayer play a m3u8 file?, the answer is Yes. MediaPlayer does support the playback of MP3 playlist files.

要你的下一个问题,只有在版本大于3.0或4.0?的,我们需要仔细考虑的答案。 的Andr​​oid 3.0 又名蜂窝不是一个开放的分布,因此,我不知道该回答你的问题。它可以是负载的,但只是一个猜测。对 M3U8 文件的播放是从 Android 4.0的支持 / ICS 起。请找到链接到源,让玩家针对 M3U8 创建的文件为http://androidxref.com/4.0.4/xref/frameworks/base/media/libmediaplayerservice/MediaPlayerService.cpp#583

To your next question, it is only in versions greater than 3.0 or 4.0?, we need to carefully consider the answer. Android 3.0 a.k.a. HoneyComb is not an open distribution and hence, I am not sure about the answer to your question. It may be supported, but just a guess. The playback of m3u8 files is supported from Android 4.0 / ICS onwards. Please find the link to the source, where the player is created for m3u8 file as http://androidxref.com/4.0.4/xref/frameworks/base/media/libmediaplayerservice/MediaPlayerService.cpp#583

如果您收到一个错误,因为错误(1,-1010),这意味着地方在您的播放器,发动机返回一个 ERROR_UNSUPPORTED 返回code。仅供参考,你可以看看源代码here.

If you are getting an error as error(1, -1010), it means somewhere in your player, the engine is returning with a ERROR_UNSUPPORTED return code. For reference, you could look into the sources here.

您将不得不进一步调试和定位问题。

You would have to debug further and localize the problem.

这篇关于安卓的MediaPlayer播放M3U8只有音频streamming的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 20:39