Skip to content

Instantly share code, notes, and snippets.

@oott123
Created November 8, 2017 11:51
Show Gist options
  • Save oott123/c5fc3fa96e3a5037144555608290a83f to your computer and use it in GitHub Desktop.
Save oott123/c5fc3fa96e3a5037144555608290a83f to your computer and use it in GitHub Desktop.
Safari 16 videos bug
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<title>safari 16 videos bug</title>
</head>
<body>
<div id="count"></div>
<div id="hello"></div>
<button style="width: 300px; height: 200px; border: solid; font-size: 40px" onclick="test()">测试!</button>
<script>
var i = 0;
function test () {
i++;
hello.innerHTML = '';
count.innerHTML = '第 ' + i + ' 次播放。';
var src = 'https://cdn.rawgit.com/mediaelement/mediaelement-files/4d21a042/big_buck_bunny.mp4';
hello.innerHTML = '<video id="video" webkit-playsinline playsinline controls src="' + src + '">';
setTimeout(function () {
document.getElementById('video').play();
}, 500);
}
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment