安卓如何调用播放器实现流媒体播放
各位大大们:我公司架设了一台流媒体服务器(192.168.1.67),都是一些宣传影片,可以通过VLC RTSP进行易做图,现在领导要求做安卓客户端,我自己做出了XML调用所有的影片名称、图片、和介绍,但不知道怎么进行调用播放,请帮忙说明下,最好能给我代码,万分感谢。
--------------------编程问答-------------------- RTSP这个好像可以直接易做图的,
import android.app.Activity;--------------------编程问答-------------------- 谢谢mmorss,我这边用了你的代码,还是不行,提示“无法播放此视频”,附图,帮忙看下,万分感谢!
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.VideoView;
public class TestRTSP extends Activity{
private EditText etURL;
private Button play,pause,stop;
private VideoView mVideoView;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
etURL = (EditText)findViewById(R.id.URL);
play = (Button)findViewById(R.id.play);
pause = (Button)findViewById(R.id.pause);
stop = (Button)findViewById(R.id.stop);
play.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v) {
PlayRtspStream(etURL.getEditableText().toString());
}
});
mVideoView = (VideoView)this.findViewById(R.id.VideoViewDisplay);
}
//play rtsp stream
private void PlayRtspStream(String rtspUrl){
mVideoView.setVideoURI(Uri.parse(rtspUrl));
mVideoView.requestFocus();
mVideoView.start();
}
}
=========================================================
public class MainActivity extends Activity {
private String uri= "rtsp://192.168.1.67/1/dianying_x10001_SayYes.mp4";
private Button paly, pause, stop;
private VideoView videoView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
paly = (Button) findViewById(R.id.play);
paly.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.d("TAG", "----button-play-----");
PlayRtspStream(uri);
}
});
videoView = (VideoView) findViewById(R.id.video);
}
private void PlayRtspStream(String uri) {
videoView.setVideoURI(Uri.parse(uri));
videoView.requestFocus();
videoView.start();
Log.d("TAG", "-----video-start----");
}
}
--------------------编程问答-------------------- 把ffmpeg移植到Android可以实现播放
补充:移动开发 , Android