简体   繁体   English

如何在 android WebView 或视频播放器中加载 Twitch 直播 stream

[英]How to load Twitch live stream in android WebView Or Video player

I am trying to play live stream video from Twitch, inside webview but getting issue, when streaming was started after page load then it is not showing in video.我正在尝试在 webview 中播放来自 Twitch 的实时 stream 视频,但出现问题,当页面加载后开始流式传输时,它没有显示在视频中。 i have to load it manually.我必须手动加载它。

I am using this below url to load video in side android webView:我在 url 下面使用它来加载 android webView 侧的视频:

https://player.twitch.tv/?autoplay=true&channel=x2twins&parent=streamernews.example.com https://player.twitch.tv/?autoplay=true&channel=x2twins&parent=streamernews.example.com

What is the best way to play video in android, so that if streaming starts after page load then, streaming video starts autometically在 android 中播放视频的最佳方式是什么,这样如果在页面加载后开始流式传输,流式视频会自动开始

You should use VideoView instead of WebView If you want the stream to start playing automatically when the activity opens, call the play method in onCreate Also save the latest states at onPause in savedInstanceState and read it again in onResume你应该使用 VideoView 而不是 WebView 如果你想让 stream 在 Activity 打开时自动开始播放,在 onCreate 中调用 play 方法 同时在 savedInstanceState 中保存 onPause 的最新状态,并在 onResume 中再次读取

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM