Here is stream video from justin.com or twitch.tv this CHANNEL
Go to here and choose any live stream, get from them url and add html://.../hls
in screen appears
Guys told me that:
Android is weird in that it will not work on Android Chrome but will work in the stock Android browser (well, previous stock Android browser now that Chrome is the stock browser). It'll also work on all Safari browsers.
I've implemented this code
stream = (WebView) findViewById(R.id.webView1);
stream.getSettings().setJavaScriptEnabled(true);
stream.getSettings().setPluginsEnabled(true);
stream.setBackgroundColor(Color.parseColor("#000000"));
stream.getSettings().setUseWideViewPort(true);
stream.setWebViewClient(new HelloWebViewClient());
stream.getSettings().setAppCacheEnabled(true);
stream.getSettings().setDomStorageEnabled(true);
stream.getSettings().setSaveFormData(true);
stream.getSettings().setLoadWithOverviewMode(true);
stream.getSettings().setUseWideViewPort(true);
stream.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
stream.setScrollbarFadingEnabled(false);
stream.loadUrl("http://www.twitch.tv/arteezy/hls");
stream.setVisibility(View.VISIBLE);
private class HelloWebViewClient extends WebViewClient
{
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
view.loadUrl(url);
return true;
}
}
But it opens first picture from video and stop caching... it seems like WebView doesn't cache video... What is wrong?
UPDATED
after following code stream plays only 2 sec and then stops
stream = (WebView) findViewById(R.id.webView1);
stream.getSettings().setJavaScriptEnabled(true);
stream.getSettings().setJavaScriptEnabled(true);
stream.getSettings().setPluginsEnabled(true);
stream.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
stream.setBackgroundColor(Color.parseColor("#000000"));
stream.getSettings().setUseWideViewPort(true);
// mWebView.loadUrl("data/game.swf");
//mWebViewChat.getSettings().setBuiltInZoomControls(true);
// mWebView.loadUrl("file:///android_asset/live.swf?channel=d2l");
stream.setWebViewClient(new HelloWebViewClient());
final Activity MyActivity = this;
stream.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress)
{
MyActivity.setTitle("Loading...");
MyActivity.setProgress(progress * 100);
if (progress*100 == 100){
stream.clearFormData();
stream.clearHistory();
stream.clearCache(true);
}
}
});
stream.getSettings().setAppCacheEnabled(true);
stream.getSettings().setDomStorageEnabled(true);
stream.getSettings().setSaveFormData(true);
stream.getSettings().setLoadWithOverviewMode(true);
stream.getSettings().setUseWideViewPort(true);
stream.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
stream.setScrollbarFadingEnabled(false);
stream.clearFormData();
stream.clearHistory();
stream.clearCache(true);
stream.getSettings().setAppCacheEnabled(true);
stream.getSettings().setDatabaseEnabled(true);
stream.getSettings().setDomStorageEnabled(true);
stream.getSettings().setPluginsEnabled(true);
stream.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
stream.getSettings().setPluginState(PluginState.ON);
stream.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);// no need I think
stream.getSettings().setLoadWithOverviewMode(true);
stream.getSettings().setUseWideViewPort(true);
stream.getSettings().setBuiltInZoomControls(true);
stream.setInitialScale(1);
stream.setWebChromeClient(new WebChromeClient());
stream.getSettings().setJavaScriptEnabled(true);
stream.getSettings().setPluginsEnabled(true);
stream.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
stream.setBackgroundColor(Color.parseColor("#000000"));
stream.getSettings().setUseWideViewPort(true);
// mWebView.loadUrl("data/game.swf");
//mWebViewChat.getSettings().setBuiltInZoomControls(true);
// mWebView.loadUrl("file:///android_asset/live.swf?channel=d2l");
stream.setWebViewClient(new HelloWebViewClient());
stream.getSettings().setAppCacheEnabled(true);
stream.getSettings().setDomStorageEnabled(true);
stream.getSettings().setSaveFormData(true);
stream.getSettings().setLoadWithOverviewMode(true);
stream.getSettings().setUseWideViewPort(true);
stream.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
stream.setScrollbarFadingEnabled(false);
stream.clearFormData();
stream.clearHistory();
stream.clearCache(true);
stream.getSettings().setAppCacheEnabled(true);
stream.getSettings().setDatabaseEnabled(true);
stream.getSettings().setDomStorageEnabled(true);
stream.loadUrl("http://www.twitch.tv/arteezy/hls");