Search code examples
androidiframewebviewstreaminglive

How to play the live streaming url in webview android using iframe


How to load the URL streaming video in webview using iframe. This is what I have tried

private WebView webview;

@SuppressWarnings("deprecation")
@SuppressLint("SetJavaScriptEnabled")
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    webview=(WebView)findViewById(R.id.webView1);
    WebSettings webViewSettings = webview.getSettings();
    webViewSettings.setBuiltInZoomControls(true);
    webViewSettings.setPluginState(PluginState.ON);
    webview.loadUrl("file:///android_asset/frame.html");
}

Manifest File Permission:

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

Hardware acceleration enabled using

android:hardwareAccelerated="true"

HTML CODE USED IFRAME

<html><body><iframe src="http://puthiyathalaimurai.tv/"></iframe></body</html>

Video is playing in html page But not playing in android application , can any one tell me whats the error. or whats the problem


Solution

  • Android lacks support for HLS, if that is what you are looking for. For detailed information on HLS Streaming support in different devices look at http://www.longtailvideo.com/html5/hls/

    I am not sure using what protocol your source URL is streaming, its better if you can provide more clarity.

    If you are looking at streaming HLS in android, you can search for some alternative 3rd party libraries or players to do the same for you or you can build your own player using FFMPEG.