Merge pull request #1879 from albertgasset/MOBILE-2960

MOBILE-2960 format-text: Improve Vimeo embedding for 3.7 onwards
main
Juan Leyva 2019-05-02 15:39:56 +02:00 committed by GitHub
commit 09ad315b9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -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. // 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]+)/); const matches = iframe.src.match(/https?:\/\/player\.vimeo\.com\/video\/([0-9]+)/);
if (matches && matches[1]) { 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(); matches[1] + '&token=' + site.getToken();
// Width and height are mandatory, we need to calculate them. // 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. // Width and height parameters are required in 3.6 and older sites.
iframe.src = newUrl + '&width=' + width + '&height=' + height; if (!site.isVersionGreaterEqualThan('3.7')) {
newUrl += '&width=' + width + '&height=' + height;
}
iframe.src = newUrl;
if (!iframe.width) { if (!iframe.width) {
iframe.width = width; iframe.width = width;
} }