请教大神,android video view播放rtsp格式实时视频,有10秒的延迟,怎么能设
发布网友
发布时间:2022-05-10 19:06
我来回答
共1个回答
热心网友
时间:2023-10-23 15:52
android播放rtsp实时网络串流核心代码如下:
import android.app.Activity;
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 rtspActivity extends Activity {
/** Called when the activity is first created. */
Button playButton ;
VideoView videoView ;
EditText rtspUrl ;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
rtspUrl = (EditText)this.findViewById(R.id.url);
playButton = (Button)this.findViewById(R.id.start_play); playButton.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v) {
PlayRtspStream(rtspUrl.getEditableText().toString()); } });
videoView = (VideoView)this.findViewById(R.id.rtsp_player); }
//play rtsp stream
private void PlayRtspStream(String rtspUrl){
videoView.setVideoURI(Uri.parse(rtspUrl));
videoView.requestFocus();
videoView.start();
}
}追问还是无法取消延迟啊