我正在嘗試開發一個android應用來從一個URL流式傳輸視頻。但是我收到以下錯誤。請幫助在Android媒體播放器中流媒體
@Override
public void onClick(View v) {
Log.d("TAG", "on Click");
System.out.println("on Click");
// TODO Auto-generated method stub
if(v==play)
{
if(mp.isPlaying()==false && mp!=null)
{
mp.start();
}
}
if(v==stop)
{
mp.stop();
mp.release();
mp=null;
}
if(v==sd)
{
Log.d("TAG", "Loading the video file");
//path="C:\\Users\\Public\\Videos\\Sample Videos\\Wildlife.wmv";
//path="http://10.17.68.18:8080/stream";
path = "http://www.youtube.com/watch?v=wBGIoxvEakw";
try{
mp=new MediaPlayer();
mp.reset();
mp.setDataSource(URLEncoder.encode(path,"UTF-8"));
mp.prepareAsync();
mp.setOnPreparedListener(new OnPreparedListener(){
public void onPrepared(MediaPlayer mp) {
Log.d("TAG", "Playing the video file");
mp.start();
}
});
//mp.start();
}
catch(Exception e)
{
System.out.println(e);
Toast.makeText(this,e.toString(),Toast.LENGTH_LONG)
.show();
}
}
}
錯誤日誌。
02-09 20:44:11.746: W/MediaPlayer(2807): info/warning (1, 26)
02-09 20:44:11.746: E/MediaPlayer(2807): error (-4, -4)
02-09 20:44:11.777: I/MediaPlayer(2807): Info (1,26)
02-09 20:44:11.785: E/MediaPlayer(2807): Error (-4,-4)
02-09 20:49:50.815: W/KeyCharacterMap(2807): No keyboard for id 0
我應該怎麼做才能將內容從網絡服務器路徑=「http://10.17.68.18:8080/stream – user2058145 2013-02-10 17:14:44