@@ -70,8 +70,9 @@ const vimeo = {
70
70
// Set aspect ratio
71
71
// For Vimeo we have an extra 300% height <div> to hide the standard controls and UI
72
72
setAspectRatio ( input ) {
73
- const [ x , y ] = ( is . string ( input ) ? input : this . config . ratio ) . split ( ':' ) ;
73
+ const [ x , y ] = ( is . string ( input ) ? input : this . config . ratio ) . split ( ':' ) . map ( Number ) ;
74
74
const padding = ( 100 / x ) * y ;
75
+ vimeo . padding = padding ;
75
76
this . elements . wrapper . style . paddingBottom = `${ padding } %` ;
76
77
77
78
if ( this . supported . ui ) {
@@ -299,8 +300,8 @@ const vimeo = {
299
300
300
301
// Set aspect ratio based on video size
301
302
Promise . all ( [ player . embed . getVideoWidth ( ) , player . embed . getVideoHeight ( ) ] ) . then ( dimensions => {
302
- const ratio = getAspectRatio ( dimensions [ 0 ] , dimensions [ 1 ] ) ;
303
- vimeo . setAspectRatio . call ( this , ratio ) ;
303
+ vimeo . ratio = getAspectRatio ( dimensions [ 0 ] , dimensions [ 1 ] ) ;
304
+ vimeo . setAspectRatio . call ( this , vimeo . ratio ) ;
304
305
} ) ;
305
306
306
307
// Set autopause
@@ -404,6 +405,22 @@ const vimeo = {
404
405
triggerEvent . call ( player , player . media , 'error' ) ;
405
406
} ) ;
406
407
408
+ // Set height/width on fullscreen
409
+ player . on ( 'enterfullscreen exitfullscreen' , event => {
410
+ const { target } = player . fullscreen ;
411
+
412
+ // Ignore for iOS native
413
+ if ( target !== player . elements . container ) {
414
+ return ;
415
+ }
416
+
417
+ const toggle = event . type === 'enterfullscreen' ;
418
+ const [ x , y ] = vimeo . ratio . split ( ':' ) . map ( Number ) ;
419
+ const dimension = x > y ? 'width' : 'height' ;
420
+
421
+ target . style [ dimension ] = toggle ? `${ vimeo . padding } %` : null ;
422
+ } ) ;
423
+
407
424
// Rebuild UI
408
425
setTimeout ( ( ) => ui . build . call ( player ) , 0 ) ;
409
426
} ,
0 commit comments