使用 javascript 响应时,videojs 播放按钮不起作用
videojs play button is not working while using on javascript response
这是我的代码,我尝试使用 vidoejs 但在响应 javascript 时播放按钮不起作用。我的文件中需要那种脚本。我试图找到但没有人给出正确的结果。你能帮我解决这个问题吗?
<link href="https://vjs.zencdn.net/7.6.6/video-js.css" rel="stylesheet" />
<!-- If you'd like to support IE8 (for Video.js versions prior to v7) -->
<script src="https://vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"></script>
<script src="https://vjs.zencdn.net/7.6.6/video.js"></script>
<video id="video_source"
class="video-js "
controls
preload="auto"
data-setup="{}"
style="width: 100%;height: auto;">
<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>
<script type="text/javascript">
$(function () {
var video_url = "videos/3D2EE6C8325B48068FF2F56FCE.mp4";
var video_src = '<source src="'+video_url+'" type="video/mp4" />';
$(".vjs-tech").html(video_src);
videojs("video_source");
});
</script>
要使用 videojs 以编程方式设置视频元素的来源,您可以使用 src(sourceopt)
:
$(function() {
var video_url = "SampleVideo.mp4";
videojs("video_source")
.src(video_url);
});
这是我的代码,我尝试使用 vidoejs 但在响应 javascript 时播放按钮不起作用。我的文件中需要那种脚本。我试图找到但没有人给出正确的结果。你能帮我解决这个问题吗?
<link href="https://vjs.zencdn.net/7.6.6/video-js.css" rel="stylesheet" />
<!-- If you'd like to support IE8 (for Video.js versions prior to v7) -->
<script src="https://vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"></script>
<script src="https://vjs.zencdn.net/7.6.6/video.js"></script>
<video id="video_source"
class="video-js "
controls
preload="auto"
data-setup="{}"
style="width: 100%;height: auto;">
<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>
<script type="text/javascript">
$(function () {
var video_url = "videos/3D2EE6C8325B48068FF2F56FCE.mp4";
var video_src = '<source src="'+video_url+'" type="video/mp4" />';
$(".vjs-tech").html(video_src);
videojs("video_source");
});
</script>
要使用 videojs 以编程方式设置视频元素的来源,您可以使用 src(sourceopt)
:
$(function() {
var video_url = "SampleVideo.mp4";
videojs("video_source")
.src(video_url);
});