View RTSP video stream via WebView in Android app

My application has a WebView that loads simple html. However, this html refers to the rtsp real-time video stream, and WebView cannot load it, instead it returns the message "Webpage is not available." When I open the rtsp link in my own Android browser, it loads and works fine, so I know that the video stream is not incompatible. Is there anything in the webview that can be allowed to play the rtsp video stream?

Thanks!

+6
source share
1 answer

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; } 
+2
source

Source: https://habr.com/ru/post/892598/


All Articles