android 媒体播放器 - MP3 http 广播流上的 PVMFFailure
我想通过 http 协议使用 Android MediaPlayer 播放 mp3 广播流。有时 [1 次播放 5 次 - 这实际上很常见] 我收到这样的 PVMFFailure:
02-23 02:05:23.503: ERROR/PlayerDriver(91): Command PLAYER_INIT completed with an error or info PVMFFailure
02-23 02:05:23.503: ERROR/MediaPlayer(2111): error (1, -1)
02-23 02:05:23.533: ERROR/MediaPlayer(2111): stop called in state 0
02-23 02:05:23.533: ERROR/MediaPlayer(2111): error (-38, 0)
这里或谷歌上没有解决方案,所以如果您知道如何调试这个问题,请帮忙:)
这是我的代码对于玩家:
//start
MediaPlayer player = new MediaPlayer();
player.setAudioStreamType(AudioManager.STREAM_MUSIC);
player.setDataSource(address);
player.prepare();
player.start();
//stop
player.stop();
player.reset();
我正在使用 Android 2.2 API。谢谢!
I want to play mp3 radio stream using Android MediaPlayer via http protocol. From time to time [1 playing of 5 - that is actually quite often] I receive PVMFFailure like this:
02-23 02:05:23.503: ERROR/PlayerDriver(91): Command PLAYER_INIT completed with an error or info PVMFFailure
02-23 02:05:23.503: ERROR/MediaPlayer(2111): error (1, -1)
02-23 02:05:23.533: ERROR/MediaPlayer(2111): stop called in state 0
02-23 02:05:23.533: ERROR/MediaPlayer(2111): error (-38, 0)
There is no solution here or on google, so please if you do know how to debug this, please help :)
Here is my code for player:
//start
MediaPlayer player = new MediaPlayer();
player.setAudioStreamType(AudioManager.STREAM_MUSIC);
player.setDataSource(address);
player.prepare();
player.start();
//stop
player.stop();
player.reset();
I`m using Android 2.2 API. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该使用
player.prepareAsync();
而不是player.prepare();
。You should use
player.prepareAsync();
insteadplayer.prepare();
.