Videoplayer.Markers 不是函数错误
Videoplayer.Markers is Not a function error
我想动态地向我的 videojs 播放器添加标记。我正在尝试使用 videojs-markers 插件。但我得到错误
Videoplayer.markers is not a function
<video id="vEpisodePlayer"
class="video-js vjs-default-skin vjs-big-play-centered "
controls="controls"
preload="auto">
</video>
@section Scripts{
<script src="~/js/video.js" defer="defer"></script>
@*<script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-ads/6.9.0/videojs.ads.min.js" integrity="sha512-ff4Rc39SC+LyUOUEKUvQ5VW/BMtzy+p3/zN+zB/VloiEfFpkY4JseoJC2TtwJTnn2PrSsm+dvSW6S4yV6uADUA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>*@
<script src="~/js/videojs-seek-buttons.min.js" defer="defer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-markers/0.7.0/videojs-markers.js"></script>
<script src="~/js/Development/videoPlayer.js" asp-append-version="true"></script>
<script src="~/js/Development/videoDetail.js" asp-append-version="true"></script>
}
javascript:
Videoplayer = videojs("#vEpisodePlayer", options, function onPlayerReady() {
this.fill(false);
this.seekButtons({
forward: 10,
back: 10
});
});
Videoplayer.src({ type: 'video/mp4', src: source });
Videoplayer.markers({
markerStyle: {
'width': '190px',
'border-radius': '2px',
'background-color': 'orange'
}
});
如何修复此错误并向我的 videojs 播放器添加标记?
该错误表示Video.js插件尚未注册。您在某些脚本上使用了 defer
但没有在标记插件脚本上使用。您也应该推迟那个,否则它会在 videojs
存在之前执行,并且无法针对它注册插件。
我想动态地向我的 videojs 播放器添加标记。我正在尝试使用 videojs-markers 插件。但我得到错误
Videoplayer.markers is not a function
<video id="vEpisodePlayer"
class="video-js vjs-default-skin vjs-big-play-centered "
controls="controls"
preload="auto">
</video>
@section Scripts{
<script src="~/js/video.js" defer="defer"></script>
@*<script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-ads/6.9.0/videojs.ads.min.js" integrity="sha512-ff4Rc39SC+LyUOUEKUvQ5VW/BMtzy+p3/zN+zB/VloiEfFpkY4JseoJC2TtwJTnn2PrSsm+dvSW6S4yV6uADUA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>*@
<script src="~/js/videojs-seek-buttons.min.js" defer="defer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-markers/0.7.0/videojs-markers.js"></script>
<script src="~/js/Development/videoPlayer.js" asp-append-version="true"></script>
<script src="~/js/Development/videoDetail.js" asp-append-version="true"></script>
}
javascript:
Videoplayer = videojs("#vEpisodePlayer", options, function onPlayerReady() {
this.fill(false);
this.seekButtons({
forward: 10,
back: 10
});
});
Videoplayer.src({ type: 'video/mp4', src: source });
Videoplayer.markers({
markerStyle: {
'width': '190px',
'border-radius': '2px',
'background-color': 'orange'
}
});
如何修复此错误并向我的 videojs 播放器添加标记?
该错误表示Video.js插件尚未注册。您在某些脚本上使用了 defer
但没有在标记插件脚本上使用。您也应该推迟那个,否则它会在 videojs
存在之前执行,并且无法针对它注册插件。