Create thumbnail from video file via file input

后端 未结 4 1781
悲&欢浪女
悲&欢浪女 2020-12-04 14:19

I am attempting to create a thumbnail preview from a video file (mp4,3gp) from a form input type=\'file\'. Many have said that this can be done server side onl

4条回答
  •  一生所求
    2020-12-04 14:49

    Canvas.drawImage must be based on html content.

    source

    here is a simplier jsfiddle

    //and code
    function capture(){
        var canvas = document.getElementById('canvas');
        var video = document.getElementById('video');
        canvas.getContext('2d').drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
    }
    

    The advantage of this solution is that you can select the thumbnail you want based on the time of the video.

提交回复
热议问题