Create thumbnail from video file via file input

后端 未结 4 1779
悲&欢浪女
悲&欢浪女 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:56

    Recently needed this and did quite some testing and boiling it down to the bare minimum, see https://codepen.io/aertmann/pen/mAVaPx

    There are some limitations where it works, but fairly good browser support currently: Chrome, Firefox, Safari, Opera, IE10, IE11, Android (Chrome), iOS Safari (10+).

     video.preload = 'metadata';
     video.src = url;
     // Load video in Safari / IE11
     video.muted = true;
     video.playsInline = true;
     video.play();
    

提交回复
热议问题