0

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)

0

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

You copied the answer from here stackoverflow.com/questions/23955050/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.