Browse Source

improve video aspect

master
filesite 4 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') {
myPlayer.one('play', function() { myPlayer.one('play', function() {
myPlayer.pause(); myPlayer.pause();
var height = myPlayer.videoHeight(), width = myPlayer.videoWidth(),
aspect = height / width;
var canvas = document.createElement('canvas'); var canvas = document.createElement('canvas');
var video = $('video.vjs-tech').get(0); var video = $('video.vjs-tech').get(0);
//360p canvas.width = Math.ceil(360/aspect);
canvas.width = 640; canvas.height = 360; //360p
canvas.height = 360;
var ctx = canvas.getContext('2d'); var ctx = canvas.getContext('2d');
ctx.drawImage( video, 0, 0, canvas.width, canvas.height ); ctx.drawImage( video, 0, 0, canvas.width, canvas.height );

Loading…
Cancel
Save