From 86398b02c39f7423122fe3572b07089a464eceaa Mon Sep 17 00:00:00 2001 From: Albert Gasset Date: Fri, 26 Apr 2019 12:41:17 +0200 Subject: [PATCH] MOBILE-2960 format-text: Improve Vimeo embedding for 3.7 onwards --- src/directives/format-text.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/directives/format-text.ts b/src/directives/format-text.ts index d840c8a84..9dcb4c15f 100644 --- a/src/directives/format-text.ts +++ b/src/directives/format-text.ts @@ -590,7 +590,7 @@ export class CoreFormatTextDirective implements OnChanges { // Check if it's a Vimeo video. If it is, use the wsplayer script instead to make restricted videos work. const matches = iframe.src.match(/https?:\/\/player\.vimeo\.com\/video\/([0-9]+)/); if (matches && matches[1]) { - const newUrl = this.textUtils.concatenatePaths(site.getURL(), '/media/player/vimeo/wsplayer.php?video=') + + let newUrl = this.textUtils.concatenatePaths(site.getURL(), '/media/player/vimeo/wsplayer.php?video=') + matches[1] + '&token=' + site.getToken(); // Width and height are mandatory, we need to calculate them. @@ -614,8 +614,12 @@ export class CoreFormatTextDirective implements OnChanges { } } - // Always include the width and height in the URL. - iframe.src = newUrl + '&width=' + width + '&height=' + height; + // Width and height parameters are required in 3.6 and older sites. + if (!site.isVersionGreaterEqualThan('3.7')) { + newUrl += '&width=' + width + '&height=' + height; + } + iframe.src = newUrl; + if (!iframe.width) { iframe.width = width; }