我想知道如何在打字稿中显示视频源的尺寸,即分辨率(例如1200 x 720)? 我有一个HTML脚本,例如
<video id="videoPlayer" src="some_video.mp4">
<source type="video/mp4">
</video>
,我想获取some_video.mp4的分辨率。任何帮助将不胜感激
答案 0 :(得分:0)
HTML
<video id="videoPlayer" src="some_video.mp4">
<source type="video/mp4">
</video>
脚本
<Script>
var vid = document.getElementById("videoPlayer");
var videoHeight = vid.videoHeight;
var videoWidth = vid.videoWidth;
</Script>