0
votes

I want use a webView for include Twitch WebPlayer. But when i launch my app, the player doesn't want launch (twitch define if we need to use flash or HTML5 player). My app launch HTML5 player but she loading, loading, loading... She can't launch stream.

 wv = (WebView) rootView.findViewById(R.id.webView);
        WebSettings webSettings = wv.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webSettings.setUseWideViewPort(true);
        webSettings.setLoadWithOverviewMode(true);

    // Load the Twitch Stream you want
    // Actually, this is the most important line if code
    // The "embed" searches for the suitable stream format
    wv.loadUrl("http://www.twitch.tv/MyChannel/embed");

(If you want try, channel exemple : OgamingLOL)

If i try with OgamingLoL, in my logcat i have :

08-24 15:30:00.546  19102-19102/com.xx I/chromium﹕ [INFO:CONSOLE(0)] "XMLHttpRequest cannot load chrome-extension://boadgeojelhgndaghljhdicfkmllpafd/cast_sender.js. Cross origin requests are only supported for protocol schemes: http, data, https.", source: http://www.twitch.tv/OgamingLoL/embed (0)
08-24 15:30:00.546  19102-19102/com.xx I/chromium﹕ [INFO:CONSOLE(0)] "XMLHttpRequest cannot load chrome-extension://dliochdbjfkdbacpmhlcpmleaejidimm/cast_sender.js. Cross origin requests are only supported for protocol schemes: http, data, https.", source: http://www.twitch.tv/OgamingLoL/embed (0)
08-24 15:30:00.547  19102-19102/com.xx I/chromium﹕ [INFO:CONSOLE(0)] "XMLHttpRequest cannot load chrome-extension://hfaagokkkhdbgiakmmlclaapfelnkoah/cast_sender.js. Cross origin requests are only supported for protocol schemes: http, data, https.", source: http://www.twitch.tv/OgamingLoL/embed (0)
08-24 15:30:00.547  19102-19102/com.xx I/chromium﹕ [INFO:CONSOLE(0)] "XMLHttpRequest cannot load chrome-extension://fmfcbgogabcbclcofgocippekhfcmgfj/cast_sender.js. Cross origin requests are only supported for protocol schemes: http, data, https.", source: http://www.twitch.tv/OgamingLoL/embed (0)
08-24 15:30:00.547  19102-19102/com.xx I/chromium﹕ [INFO:CONSOLE(0)] "XMLHttpRequest cannot load chrome-extension://enhhojjnijigcajfphajepfemndkmdlo/cast_sender.js. Cross origin requests are only supported for protocol schemes: http, data, https.", source: http://www.twitch.tv/OgamingLoL/embed (0)

I have try to get result, but i didn't saw it...

Can you help me pls =)

Thank you, have a good day :p

EDIT : http://ahmed.amayem.com/solution-to-chrome-cross-origin-requests-are-only-supported-for-protocol-schemes-http-data-chrome-chrome-extension-https-chrome-extension-resource/ (That doesn't help me)

1

1 Answers

1
votes

try this:

// settings for webview
mWebView = (WebView)findViewById(R.id.activity_main_webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setPluginState(PluginState.ON);
mWebView.getSettings().setAllowFileAccess(true);
mWebView.getSettings().setAllowContentAccess(true);
mWebView.getSettings().setAllowFileAccessFromFileURLs(true);
mWebView.getSettings().setAllowUniversalAccessFromFileURLs(true);

//load file
mWebView.loadUrl("file:///android_asset/www/index.html");

from XMLHttpRequest cannot load file from android asset folder on emulator