开发者

android media player - PVMFFailure on mp3 http radio stream

开发者 https://www.devze.com 2023-02-12 15:56 出处:网络
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:

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/PlayerDriv开发者_JS百科er(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!


You should use player.prepareAsync(); instead player.prepare();.

0

精彩评论

暂无评论...
验证码 换一张
取 消