2012-07-30 69 views
5

我想現場演奏一段RTSP視頻(從rtsp://media2.tripsmarter.com/LiveTV/BTV/)使用VideoView,這裏是我的代碼:無法在三星Galaxy S2在VideoView播放RTSP視頻

public class ViewTheVideo extends Activity { 
    VideoView vv; 

    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.main); 
     vv = (VideoView) this.findViewById(R.id.VideoView); 

     Uri videoUri = Uri.parse("rtsp://media2.tripsmarter.com/LiveTV/BTV/"); 
     vv.setMediaController(new MediaController(this)); 
     vv.setVideoURI(videoUri); 
     vv.requestFocus(); 
     vv.setOnPreparedListener(new OnPreparedListener() { 
      @Override 
      public void onPrepared(MediaPlayer mp) { 
       vv.start(); 
      }   
     }); 
    } 
} 

此代碼工作正常上三星Galaxyÿ ,甚至在模擬器上,但它不會在三星Galaxy S2上運行(對不起,這個視頻無法播放)!設備和模擬器都運行薑餅。

這裏的logcat的消息:

07-30 10:48:28.310: I/MediaPlayer(24573): uri is:rtsp://media2.tripsmarter.com/LiveTV/BTV/ 
07-30 10:48:28.310: I/MediaPlayer(24573): path is null 
07-30 10:48:28.310: D/MediaPlayer(24573): Couldn't open file on client side, trying server side 
07-30 10:49:13.025: W/MediaPlayer(24573): info/warning (1, 26) 
07-30 10:49:13.025: I/MediaPlayer(24573): Info (1,26) 
07-30 10:49:13.075: E/MediaPlayer(24573): error (1, -1) 
07-30 10:49:13.075: E/MediaPlayer(24573): Error (1,-1) 
07-30 10:49:13.075: D/VideoView(24573): Error: 1,-1 

我無法弄清楚這些錯誤代碼是什麼。

三星Galaxy S2與流媒體有任何問題嗎?我也嘗試過使用YouTube流(rtsp://v2.cache2.c.youtube.com/CjgLENy73wIaLwm3JbT_9HqWohMYESARFEIJbXYtZ29vZ2xlSARSB3Jlc3VsdHNg_vSmsbeSyd5JDA==/0/0/0/video.3gp),但都是一樣的。

更新: 後來我記錄的Galaxy S2視頻(格式:3GP,編碼器:H.264,比特率:56kbps的,幀率:15fps的),並使用VLC媒體播放器的PC流媒體視頻。這個可以在Galaxy S2(和其他)中查看,沒有任何錯誤。但是,S2上不能播放其他視頻。

+0

確實2.3.x版本,支持RTSP?我認爲它確實形成3.x等等。 – 2012-07-30 05:15:44

+0

你的wifi或gprs的設備是否開啓....? – Yash 2012-07-30 05:23:04

+0

我正在通過Wi-Fi測試它。 – 0605002 2012-07-30 05:41:33

回答

-2

@Andro塞爾瓦我這是怎麼流了鏈接

video_url = "rtsp://media2.tripsmarter.com/LiveTV/BTV/"; 
try { 
      videoView =(VideoView)findViewById(R.id.videoView1); 
      //Set video link (mp4 format) 
      Uri video = Uri.parse(video_url); 
      videoView.setVideoURI(video); 
      videoView.setOnPreparedListener(new OnPreparedListener() { 
      public void onPrepared(MediaPlayer mp) { 

       videoView.start(); 
       } 
      }); 
     }catch(Exception e){ 
     } 
+0

它在星系s2上嗎? – 0605002 2012-07-30 05:44:29