猿问

video.js无法获取视频总时长

        var options = {

            // controls: 'control',

            controls: false,

            preload: 'auto',

            playsinline: true,

            poster: "http://shortmeetadmin.oss-cn-beijing.aliyuncs.com/1515394799463",

        };


        var player = videojs('video', options, function onPlayerReady() {

            videojs.log('Your player is ready!');

            this.play();

          

            console.log(this.duration())    //总是 NaN

        });

https://github.com/videojs/vi...

http://docs.videojs.com/tutor...


LEATH
浏览 3120回答 2
2回答

慕盖茨4494581

var player = videojs('my-video');player.on('loadedmetadata', function () {    var videoLength = player.duration();    console.log(videoLength)});
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答