播放youu.在videojs中的Be和vimeo视频



我在。net核心web应用程序中使用videojs库。我选择这个库的原因是它很容易定制。他们的网站提到我们也可以嵌入youtube和Vimeo的url。但是,当我试图做同样的事情时,它不起作用。我得到一个错误,"没有找到兼容的源代码"。这是我的代码:HTML:

<video-js id="my-player"
class="video-js"
controls
preload="auto"              
poster="../../../Images/bg_brooking.png"
>
<source src="https://www.youtube.com/watch?v=_BcBHTHvOVo" type="video/youtube"/></source>
<p class="vjs-no-js">
To view this video please enable JavaScript, and consider upgrading to a
web browser that
<a href="https://videojs.com/html5-video-support/" target="_blank">
supports HTML5 video
</a>
</p>
</video-js>

Javascript:

$(document).ready(function () {
var options = { responsive: true, fluid: true};
var player = videojs('my-player', options, function onPlayerReady() {
//videojs.log('Your player is ready!');
// In this context, `this` is the player that was created by Video.js.
this.fill(false);
this.seekButtons({
forward: 10,
back: 10
});
// How about an event listener?
this.on('ended', function () {
videojs.log('Awww...over so soon?!');
});
});
});

我使用的是videoJs 7.15.0。我也试过使用"videojs-youtube"插件。但它也不起作用。我找不到很多关于在videjs中播放youtube视频的数据。

如果这是不可能的,那么我应该使用哪个其他球员?

在项目的自述文件中有一个使用videojs-youtube的完整示例。值得注意的是,techOrder需要包含在设置选项中——上面的示例没有这个。techOrder决定将以何种顺序尝试哪些源。

var options = { responsive: true, fluid: true, techOrder: ['youtube']};
// or techOrder: ['youtube', 'html5']

videojs-vimeo的设置类似,使用vimeo技术。

最新更新