videojs:如何获得源视频分辨率或方面?

时间:2014-09-05 03:10:25

标签: video.js

您是否了解或了解如何在videojs中获取源视频分辨率或方面?

我看过vjs.Player,但它只返回窗口大小,而不是原始视频大小。

谢谢, 安德烈

2 个答案:

答案 0 :(得分:0)

所以

  <video id="video0"

我们有

        var vid2 = document.getElementById('video0_flash_api');
        w = vid2.vjs_getProperty("videoWidth");
        h = vid2.vjs_getProperty("videoHeight");

答案 1 :(得分:0)

<video id="player" onplaying="onplaying()"></video>
<script>
var player = videojs('player', {
  autoplay: true,
  controls: false,
  poster: ''
});
player.src("http://your.video.src");

function onplaying(){
  console.log(player.videoHeight());
  console.log(player.videoWidth());
}
</script>