Browse Source

improve video aspect

master
filesite 5 months ago
parent
commit
7c1b822d90
  1. 7
      www/js/beauty.js

7
www/js/beauty.js

@ -269,12 +269,13 @@ if ($('#my-player').length > 0 && typeof(videojs) != 'undefined') { @@ -269,12 +269,13 @@ if ($('#my-player').length > 0 && typeof(videojs) != 'undefined') {
myPlayer.one('play', function() {
myPlayer.pause();
var height = myPlayer.videoHeight(), width = myPlayer.videoWidth(),
aspect = height / width;
var canvas = document.createElement('canvas');
var video = $('video.vjs-tech').get(0);
//360p
canvas.width = 640;
canvas.height = 360;
canvas.width = Math.ceil(360/aspect);
canvas.height = 360; //360p
var ctx = canvas.getContext('2d');
ctx.drawImage( video, 0, 0, canvas.width, canvas.height );

Loading…
Cancel
Save