Android RTSP Live Streaming on Samsung Galaxy Tab 3

702 views Asked by At

I'm trying to play a live RTSP video (from rtsp://IP_ADDR:554/user=admin&password=admin&channel=&stream=.sdp?real_stream--rtp-caching=100) using android VideoView, and here's my code:

public class TestCamera3 extends Activity {

private VideoView mVideoView;
private String videoAddress;
private static final String TAG = "videoTest";
private String keyValue = "videoAddress";
private String defaultAddress = "rtsp://IP_ADDR:554/user=admin&password=admin&channel=&stream=.sdp?real_stream--rtp-caching=100";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    SharedPreferences prefs = this.getSharedPreferences(TAG, 0);

    videoAddress = prefs.getString(keyValue, defaultAddress);
    mVideoView = (VideoView) findViewById(R.id.video);
    PlayRtspStream(defaultAddress);

}

private void PlayRtspStream(String rtspUrl) {
    // mVideoView.setVideoPath(rtspUrl);
    mVideoView.setVideoURI(Uri.parse(rtspUrl));
    mVideoView.requestFocus();
    mVideoView.setMediaController(new MediaController(this));
    mVideoView.start();
}}

& activity_main.xml :

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<VideoView
    android:id="@+id/video"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" >
</VideoView>

So when i tested this code in Samsung Note 4 v4.2.2 (Jelly Bean) & Nexus 5 v5.0 (Lollipop) .. it's worked well but when i tested it in Galaxy tab 3 v4.1.2 (Jelly Bean) it's display message (Can't Play this Video)

Can any one tell me why this ?

0

There are 0 answers