Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Viewing RTSP video stream through WebView in Android App

My App has a WebView which loads a simple html. However, this html links to a rtsp live video stream and the WebView isn't able to load it, instead it returns a "Web Page Not Available" message. When I open the rtsp link in the native Android browser, it loads and works fine so I know it's not the video stream being incompatible. Is there something within WebView which can be enabled to allow the rtsp video stream to be played?

Thanks!

like image 940
CPess Avatar asked Jul 12 '11 16:07

CPess


1 Answers

I used this code:

public boolean shouldOverrideUrlLoading(WebView view, String url) {
         view.loadUrl(url);

         if (url.contains("rtsp")) {
                Uri uri = Uri.parse(url);
                    Intent intent = new Intent(Intent.ACTION_VIEW, uri);

                    startActivity(intent);
         }

       return true;
    }
like image 52
TheLD Avatar answered Nov 01 '22 03:11

TheLD