我正在尝试使用video.js来阻止快进,但允许倒回Moodle网站上的mp4视频.它在Chrome和Opera中正常工作,但是当我在Safari中尝试时,我收到以下错误消息:
VIDEOJS: (4)
"ERROR:"
"(CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED)"
"The media could not be loaded, either because the server or network failed or because the format is not supported."
Run Code Online (Sandbox Code Playgroud)
我见过一个建议改变的Content-Type头的MP4,但由于某种原因,我iframe不会生成head所有代码(仅在Safari;在所有其他浏览器,iframe包含html有两个标签head和body).而且,事实证明,我被阻止将head标签添加到iframe html.我试着把它扔进一个meta标签,但这对错误信息没有影响
以下是我用来防止快进的脚本:
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<link href="https://vjs.zencdn.net/5.0/video-js.min.css" rel="stylesheet">
<script src="https://vjs.zencdn.net/5.0/video.min.js"></script>
<script>
window.onload = function() {
if ($('iframe').length > 0) {
$('iframe').ready(function() {
if ($('iframe').contents().find('head').length === 0) {
console.log("*********************");
console.log("In the if!");
$('iframe').contents().find('html').prepend("<head><meta name='viewport' content='width=device-width' …Run Code Online (Sandbox Code Playgroud)