我在安卓上的play() JavaScript方法遇到了问题,只有在谷歌Chrome上(它在火狐上工作得很好)。代码如下:
var video = document.getElementById('video');
if (video) {
window.onorientationchange = function() {
// if I'm on Android-Chrome the alert correctly comes up, but the video won't start
alert('x');
video.play();
}
}使用addEventListener()也不能正常工作。然而,这在Chrome上是有效的:
var video = document.getElementById('video');
if (video) {
document.body.onclick = function() {
video.play(); // video correctly starts
}
}发布于 2016-08-23 01:24:17
看起来Chrome不支持它,只有Firefox支持。
https://developer.mozilla.org/en-US/docs/Web/API/Screen/onorientationchange
https://stackoverflow.com/questions/39085291
复制相似问题