问题
I'm using JQuery and I tried this code
<video id="videoPopUp1" poster="img/xxx.png">
<source src="video/xxx.mp4" type="video/mp4">
</video>
$('#playBtn1').click(function () {
$("#playBtn1").hide();
$('#videoPopUp1').get(0).play();
});
$('#videoPopUp1').click(function () {
if (this.paused == false) {
this.pause();
$('#playBtn1').show()
} else {
this.play();
$('#playBtn1').hide()
}
});
but on Iphone (Safari, iOS 9.3.1) and Ipad (Safari, 8.1.2) it doesn't work. It works fine on all other browsers/devices (Chrome, Firefox, android, etc.).
回答1:
That does not work because autoplay (and preloading) is disabled in safari on iOS.
In Safari on iOS (for all devices, including iPad), where the user may be on a cellular network and be charged per data unit, preload and autoplay are disabled.
That means that you will always need "User Interaction" to start video playback.
来源:https://stackoverflow.com/questions/36739102/jquery-play-doesnt-work-on-mobile-safari