[英]No Video on HLS Stream Android 4.4.2 Samsung Galaxy S5
The HLS streams do not play video, but they do play audio. HLS流不会播放视频,但是会播放音频。
Device information: 设备信息:
Samsung Galaxy S5
三星Galaxy S5
Android 4.4.2 / Build KOT49H
Android 4.4.2 / Build KOT49H
Chrome 36.0.1985.131
铬36.0.1985.131
HLS Streams that play on other Android builds and devices: 在其他Android版本和设备上播放的HLS流:
Using the browser application "Internet" on the Samsung S5, it will play the video for an HLS stream, which made me think this could possibly be an issue with Chrome, however, when tested on a Nexus 5 device with the exact same Chrome build (except Android 4.4.4) and the video plays fine. 使用三星S5上的浏览器应用程序“ Internet”,它将播放HLS流的视频,这使我认为Chrome可能是一个问题,但是,当在具有完全相同的Chrome版本的Nexus 5设备上进行测试时(Android 4.4.4除外),并且视频可以正常播放。
Android Issue Queue has Issue 63810: No video in HLS live streaming on Android KitKat and I have contributed what I can. Android Issue Queue的问题为63810:HLS上没有视频在Android KitKat上进行实时流传输 ,我已尽力而为 。
What can I do to get more information about the nature of the problem? 我该怎么做才能获得有关问题性质的更多信息?
Is this a legitimate bug with the Android 4.4.2 Samsung S5? 这是Android 4.4.2 Samsung S5的合法错误吗?
I've noticed this behavior among other issues on 4.4.2 with issues seeming to vary by device and manufacturer. 我注意到此行为在4.4.2的其他问题中,其问题似乎因设备和制造商而异。 Through experimentation I've noticed the following:
通过实验,我注意到了以下几点:
Our product works essentially on a playlist -- when the ended
event triggers for one video we change the video src
and call .load()
and .play()
to go to the next one. 我们的产品主要适用于播放列表-当
ended
事件的一个视频触发我们改变了视频src
和调用.load()
和.play()
去下一个。 On some devices if the first src
is HLS video plays fine, but if the first src
is mp4 or webm then switching to HLS causes you to lose video. 在某些设备上,如果第一个
src
是HLS,则视频可以正常播放,但是如果第一个src
是mp4或webm,则切换到HLS会使您丢失视频。 On other devices it's the opposite behavior -- starting in HLS fails but switching to it succeeds. 在其他设备上,这是相反的行为-在HLS中启动失败,但切换成功。 On some devices HLS has video if you enter full screen before it starts to play, on others it only has video if you enter full screen after it starts to play.
在某些设备上,如果你进入全屏开始播放之前,对别人,如果你进入全屏开始播放后,它不仅具有视频HLS具有视频。 On some devices the full screen button disappears after you start to play.
在某些设备上,开始播放后,全屏按钮消失 。
It's not ideal and it's honestly very hacky, but I've come up with this ugly solution: 这不是理想的,而且老实说很hacky,但是我想出了一个丑陋的解决方案:
// 1.
video.addEventListener('click', requestFullScreen);
// 2.
function requestFullScreen() {
video.removeEventListener('click', requestFullScreen);
video.webkitRequestFullScreen();
}
// 3.
function reloadVideo() {
var ext = video.src.substr( video.src.lastIndexOf('.') ).toLowerCase();
if( ext == '.m3u8' ) {
video.load();
video.play();
}
}
// 4.
video.addEventListener('webkitbeginfullscreen', reloadVideo, false);
video.addEventListener('webkitendfullscreen', reloadVideo, false);
// 5.
video.addEventListener('webkitfullscreenchange', reloadVideo, false);
There are a number of other hacks I've had to implement, as well. 我还必须实现许多其他技巧。 For instance, the stock Internet browser on the Galaxy S4 does not always throw an
ended
event when reaching the end of a video. 例如,当到达视频结尾时,Galaxy S4上的常规Internet浏览器并不总是引发
ended
事件。 For this reason I have a setInterval
checking every 1 second. 因此,我每隔1秒进行一次
setInterval
检查。 If the video has moved less than 0.5 seconds in the last 1 seconds and it was never paused (I have a flag that's set in the resume
and pause
events) then assume you've hit the end. 如果视频在过去1秒钟内移动的时间少于0.5秒钟, 并且从未暂停过(我在“
resume
和“ pause
事件中设置了一个标志),则假定您已经结束了。
I've had success using preload="none"
. 我已经成功使用
preload="none"
。 Switching to auto
will only play audio, using none
will play both video and audio properly. 切换到
auto
只能播放音频,使用none
将播放视频和音频正常。 This was tested on a Samsung S3, Android 4.4.2. 已在Samsung S3 Android 4.4.2上进行了测试。
EDIT: autoplay
also contributes to the problem. 编辑:
autoplay
也会导致该问题。 Removing it appears necessary. 删除它似乎很有必要。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.