From 5c502bcd997926fa2854c8bf2c1ac77837086681 Mon Sep 17 00:00:00 2001 From: Juan Leyva Date: Wed, 3 Apr 2019 15:16:05 +0200 Subject: [PATCH] MDL-65255 vimeo: Do not require width and height for iframe The script for embedding videos should work without forcing width and height. This will simplify the way we embed videos in the app. --- media/player/vimeo/wsplayer.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/media/player/vimeo/wsplayer.php b/media/player/vimeo/wsplayer.php index 61a19422f48..89a5dc00ce9 100644 --- a/media/player/vimeo/wsplayer.php +++ b/media/player/vimeo/wsplayer.php @@ -38,13 +38,20 @@ require_once($CFG->dirroot . '/webservice/lib.php'); $token = required_param('token', PARAM_ALPHANUM); $video = required_param('video', PARAM_ALPHANUM); // Video ids are numeric, but it's more solid to expect things like 00001. -$width = required_param('width', PARAM_INT); -$height = required_param('height', PARAM_INT); +$width = optional_param('width', 0, PARAM_INT); +$height = optional_param('height', 0, PARAM_INT); // Authenticate the user. $webservicelib = new webservice(); $webservicelib->authenticate_user($token); +if (empty($width) && empty($height)) { + // Use the full page. The video will keep the ratio. + $display = 'style="position:absolute; top:0; left:0; width:100%; height:100%;"'; +} else { + $display = "width=\"$width\" height=\"$height\""; +} + $output = << @@ -52,7 +59,7 @@ $output = <<