How to play RTSP video url in Android Oreo and Pie

36
October 16, 2018, at 6:10 PM

I'm working on a project, and i need to play RTSP videos but the video must be set as background rather than simple image. And the only solution i found is using VideoView and MediaPlayer, and it works perfectly fine in Android 7.0, but when i tried it in Oreo and Pie, it shows only blackscreen.

Here is my VideoView code:

    videoView = (VideoView) findViewById(R.id.videoView);
    String videoUrl = "rtsp://10.0.1.50/gnc";
    Uri uri = Uri.parse(videoUrl);
    videoView.setVideoURI(uri);
    videoView.setOnErrorListener(new OnErrorListener() {
        @Override
        public boolean onError(MediaPlayer mp, int what, int extra) {
            return false;
        }
    });
    videoView.setOnPreparedListener(new OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            mp.start();
        }
    });

And here are the permissions i used in the manifest:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

What could be the problem ? is there any change in VideoViews or Permissions in the latest versions ?

EDIT:

When i try with this sample url, it works fine rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov

PS: i'm using ffmpeg cli as Streaming Server

READ ALSO
Qt Android - Reading a Directory

Qt Android - Reading a Directory

I'm working on a Qt Android application and would like to read a directory and list all the files inside it of a certain extension

46
&ldquo;onWindowFocusChanged()&rdquo; not excuted when switching fragments

“onWindowFocusChanged()” not excuted when switching fragments

I have an activity, with multiple master-detail fragments in the activityFragment 1 is opened with a button click in Activity, and Fragment 2 is open with a button click in Fragment 1

43
Unable to establish second Raspberry Pi [WIFI Direct] to a device

Unable to establish second Raspberry Pi [WIFI Direct] to a device

I have 2 Raspberry Pi and an Android Tablet and the Tablet is supposed to be controlling the Raspberry Pi via the webserver from the PiThe Android Tablet has a Wifi Direct application and I was able to establish connection with one of the Pi

15
Sending E-Mail with multiple attachments: &ldquo;SecurityException when openFileDescriptor&rdquo; (GMail)

Sending E-Mail with multiple attachments: “SecurityException when openFileDescriptor” (GMail)

To send multiple attachments I use this code to create the mail intent:

50