Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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