Getting the real HTML5 video width and height

前端 未结 4 1423
鱼传尺愫
鱼传尺愫 2021-01-31 18:50

I have a video element:

var video = window.content.document.createElement(\"video\");
video.width = width;
video.height = height; 
video.style.backgroundColor =          


        
4条回答
  •  一个人的身影
    2021-01-31 19:16

    "loadeddata" should only fire once. It's better to use "timeupdate" to repeatedly check if the video width and height have been set, in particular with getUserMedia where you don't really pause the video, but go straight into playback.

提交回复
热议问题