<audio id=example-video preload="auto" class="video-js vjs-default-skin" type="audio/wav" hidden="hidden">
<script type="text/javascript" th:src="@{/js/jquery3.4.1.js}"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/video.js/7.6.4/video.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/video.js/7.6.4/lang/zh-CN.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-hls/5.15.0/videojs-contrib-hls.min.js"></script>
<script src="https://cdn.bootcss.com/layer/2.3/layer.js"></script>
<link href="https://cdn.bootcss.com/layer/2.3/skin/layer.css" rel="stylesheet">
<audio id=example-video preload="auto" class="video-js vjs-default-skin" type="audio/wav" hidden="hidden">
<span>音量</span><input type="range" min="10" max="100" id="volume" step="1" value="50"/><span id="volumeLabel">50%</span>
function(){
var volume = $(this).val();
$("#volumeLabel").text("x"+volume+"%");
});
var player = videojs('example-video');
player.ready(function() {
var _this = this
//速率
var playbackRate = $("#playbackRate").val();
var speed = parseFloat(playbackRate);
var volume = parseFloat($("#volume").val()/100.0);
setTimeout(function() {
_this.volume(volume);
//笔者在测试播放视频控件的demo里发现volume是一个属性,不是函数
},20);
});
...
player.play();