2013-05-02 61 views
1

鏈接打我的音頻文件,音頻文件是http://www.nomadicsmart.com/co-notes/files/testsong_20_sec.mp3 但它總是給錯誤(1,-2147483648) 其中作爲此鏈接http://www.hrupin.com/wp-content/uploads/mp3/testsong_20_sec.mp3放在服務器不是在Android的媒體播放器錯誤(1,-2147483648)

+0

發佈您的代碼。 – AnilPatel 2013-05-02 09:31:08

+0

MediaPlayer player = new MediaPlayer(); \t player.setAudioStreamType(AudioManager.STREAM_MUSIC); \t \t \t player.setDataSource( 「http://www.nomadicsmart.com/co-notes/files/testsong_20_sec.mp3」 \t); \t player.prepareAsync(); \t player.setOnPreparedListener(新OnPreparedListener(){ \t公共無效onPrepared(MediaPlayer的熔點){ \t \t Log.d( 「F」, 「媒體3」); \t mp.start(); \t} \t }); – 2013-05-02 09:35:53

+0

你等待........ – AnilPatel 2013-05-02 09:45:00

回答

0
try { 
       player .setDataSource("http://www.hrupin.com/wp-ontent/uploads/mp3/testsong_20_sec.mp3"); 
       player .prepare(); 
       player .seekTo(0); 
      } catch (IllegalArgumentException e1) { 
         e1.printStackTrace(); 
      } catch (SecurityException e1) { 
         e1.printStackTrace(); 
      } catch (IllegalStateException e1) { 
         e1.printStackTrace(); 
      } catch (IOException e1) { 
         e1.printStackTrace(); 
       } 
     player .start(); 

編輯

使用許可權的android:NAME = 「android.permission.INTERNET對」

+0

從http://www.hrupin.com/wp-ontent/uploads/mp3/testsong_20_sec開始播放歌曲的代碼播放。 mp3。 – AnilPatel 2013-05-02 10:23:51

+0

嘗試播放上面提到的其他鏈接 – 2013-05-02 10:25:04

+0

http://www.nomadicsmart.com/co-notes/files/testsong_20_sec.mp3 – 2013-05-02 10:25:34