twitchdev / issues

Issue tracker for third party developers.
Apache License 2.0
74 stars 6 forks source link

Embedded Player does not work in Android WebView (in-app browser view) #149

Open danielcerny opened 4 years ago

danielcerny commented 4 years ago

Brief description Android WebView cannot render the Embedded player, because of JS runtime error. Android 10, Pixel 3 XL, all Emulators.

How to reproduce Open Twitch URL https://player.twitch.tv/?channel=desertheartsrecords&parent=example.com 1) in Android WebView 2) or try it using some WebView Testing App from Play store: https://play.google.com/store/apps/details?id=com.snc.test.webview2

This will end with JS error: I/chromium: [INFO:CONSOLE(1)] "Failed to get log level override from local storage.", source: https://static.twitchcdn.net/assets/player-main-99d0c0301716cd88a487.js (1)

Expected behavior Player is displayed.

Screenshots No errors are printed to the user. Just console errors.

jbulava commented 4 years ago

You cannot use the player.twitch.tv directly in a WebView because of the parent domain requirement. See this response in the forums for a longer explanation of embedding in mobile applications following this update.

https://discuss.dev.twitch.tv/t/how-will-twitch-embed-updates-affect-mobile-app-embeds/26008/41

Please let us know if you still receive the JS runtime error after adding a WebView with a URL pointing to your own domain.

vichuviswan commented 4 years ago

@jbulava I have similar issue, but not exactly the same. My use case is with twitch player on my website and showing it within the UWP WebView. I see it works when accessed it from a browser, but when tried to render the same website within the UWP WebView, I see a blank player area with loading animation. Also when I tried to debug it locally in the UWP application, I see a lots of JavaScript exceptions. Please find below the screenshot with some of those exception messages when tested with that website in localhost.

image

Actually, I did the exact same thing mentioned in the post you mentioned above, but didn't work for the UWP application. So not sure if there is something we need to do differently for UWP.

vichuviswan commented 4 years ago

@jbulava Just wanted to share an additional finding I have on this issue. I see that my published website works fine on both Chrome and the new Chromium-based Edge, but when I tried to load the website in the legacy Edge, I see the same issue that I see in the UWP WebView (which uses legacy Edge as its rendering engine). So it seems the issue might be with the logic compatibility of the embedded player scripts with legacy Edge.

It would be great if you can help us troubleshoot the issue and any solution