Is there any way to natively play a Twitch stream-video in my Android app? I couldn't find any information about this on the internet.
This is how I open up a twitch video at the moment in WebView (twitch.html):
<a href="https://twitch.tv/'+element.channel.name+'/embed"> ...
But this leads to some errors when I change my device from vertical to horizontal view. Then the video sound will be played without showing the video anymore, etc.
I was thinking of a workaround-fix, if you can call that and just seperately open up the twitch-channel in the app browser by the Android user, but how can I add this exception in my code? This is in my MainActivity.java:
private class MyWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (Uri.parse(url).getHost().equals("www.example.com")) {
// This is my web site, so do not override; let my WebView load the page
return false;
}
// Otherwise, the link is not for a page on my site, so launch another Activity that handles URLs
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
return true;
}
}
It's from the official Android developer page and prevents that links will be opened up in another browser app. How could I add a exception just for "twitch.tv"?