Tôi đang cố gắng phát triển một ứng dụng dựa trên Android, có thể phát video từ luồng trực tiếp. Luồng trực tiếp này được tạo bằng cách sử dụng Wowza Media Server.Phát RTSP trực tuyến trong ứng dụng Android
URL là:
rtsp://tv.hindiworldtv.com:1935/live/getpun
Tôi đã thử sau mã trong ecliplse:
package com.kalloh.wpa;
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.net.Uri;
import android.os.Bundle;
import android.view.Window;
import android.widget.MediaController;
import android.widget.VideoView;
public class a extends Activity {
VideoView videoView;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
//Create a VideoView widget in the layout file
//use setContentView method to set content of the activity to the layout file which contains videoView
this.setContentView(R.layout.videoplayer);
videoView = (VideoView)this.findViewById(R.id.videoView);
//add controls to a MediaPlayer like play, pause.
MediaController mc = new MediaController(this);
videoView.setMediaController(mc);
//Set the path of Video or URI
videoView.setVideoURI(Uri.parse("rtsp://tv.hindiworldtv.com:1935/live/getpnj"));
//
//Set the focus
videoView.requestFocus();
}
}
Lúc đầu, nó đã không làm việc.
Bây giờ nó bắt đầu hoạt động, nhưng nó dừng lại sau 20 đến 30 giây. Làm cách nào để khắc phục sự cố này?
Tôi gặp vấn đề tương tự khi sử dụng vlc và tìm thấy nội dung nào đó ở đây (không phải là giải pháp, nhưng thông tin hữu ích): http://code.google.com/p/android/issues/detail?id=15229 – hungson175
Bây giờ url đã cho đang hoạt động trên Android 4 trở lên .. nhưng vấn đề vẫn là âm thanh không liên tục. Nó giống như 1 giây trễ sau 2 giây phát .. – SJSSoft
Bạn giải quyết vấn đề này như thế nào? –