我試圖在網上找到答案,沒有一個對我來說很清楚。我開始編程並且不太瞭解所以任何有意義的幫助都會有所幫助。我的兄弟開發了一個網站,我試圖從開發人員網頁上流式傳輸音頻,並找到要使用的代碼。日食讓我沒有錯誤,但是當我運行程序的時候,部隊密切這裏是我的代碼:使用來自web url的eclipse流式音頻
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
String url = "http://beatswith.us/uploads/Mac%20Miller%20- %20Paper%20Route%20feat.%20Kev%20Da%20Hustla.mp3"; // your URL here
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
try {
mediaPlayer.setDataSource(url);
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
mediaPlayer.prepare();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} // might take long! (for buffering, etc)
mediaPlayer.start();
}
};
OK遺憾的答案,但我不知道你的要求我所知道的是,我在我的錯誤日誌中沒有錯誤,但登錄貓顯示了這種 – trunks85719 2012-01-06 04:28:14
01-05 23:26:10.660:I/Process(1267):發送信號。 PID:1267 SIG:9SurfaceViewExample 01-05 23:26:08.976:E/AndroidRuntime(1267):致命例外:main 01-05 23:26:08.976:E/AndroidRuntime(1267):android.content.ActivityNotFoundException:未發現處理意圖{act = us.beats.with.Mplay} 01-05 23:26:08.976:E/AndroidRuntime(1267):\t at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1409) – trunks85719 2012-01-06 04:29:08
01-05 23:26:08.976:E/AndroidRuntime(1267):\t at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379) 01-05 23:26:08.976:E/AndroidRuntime(1267) \t at android.app.Activity.startActivityForResult(Activity.java:2827) 01-05 23:26:08.976:E/AndroidRuntime(1267):\t at android.app.Activity.startActivity(Activi ty.java:2933) 01-05 23:26:08.976:E/AndroidRuntime(1267):\t at beats.us.with.myMenu $ 1.onClick(myMenu.java:31) – trunks85719 2012-01-06 04:30:31