See Release Notes
Long Term Support Release
Differences Between: [Versions 39 and 310] [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 18 /** 19 * A script to embed vimeo videos via the site (so vimeo privacy restrictions by domain will work in the mobile app). 20 * 21 * The site is doing a double frame embedding: 22 * - First, the media player replaces the vimeo link with an iframe pointing to vimeo. 23 * - Second, the app replaces the previous iframe link with a link to this file that includes again the iframe to vimeo. 24 * Thanks to these changes, the video is embedded in a page in the site server so the privacy restrictions will work. 25 * 26 * Note 1: Vimeo privacy restrictions seems to be based on the Referer HTTP header. 27 * Note 2: This script works even if the plugin is disabled (some users could be using the vimeo embedding code). 28 * 29 * @package media_vimeo 30 * @copyright 2017 Juan Leyva 31 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 32 */ 33 34 define('NO_MOODLE_COOKIES', true); 35 36 require_once(__DIR__ . '/../../../config.php'); 37 require_once($CFG->dirroot . '/webservice/lib.php'); 38 39 $token = required_param('token', PARAM_ALPHANUM); 40 $video = required_param('video', PARAM_ALPHANUM); // Video ids are numeric, but it's more solid to expect things like 00001. 41 $width = optional_param('width', 0, PARAM_INT); 42 $height = optional_param('height', 0, PARAM_INT); 43 44 // Authenticate the user. 45 $webservicelib = new webservice(); 46 $webservicelib->authenticate_user($token); 47 48 if (empty($width) && empty($height)) { 49 // Use the full page. The video will keep the ratio. 50 $display = 'style="position:absolute; top:0; left:0; width:100%; height:100%;"'; 51 } else { 52 $display = "width=\"$width\" height=\"$height\""; 53 } 54 55 $output = <<<OET 56 <html> 57 <head> 58 <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 59 </head> 60 <body style="margin:0; padding:0"> 61 <iframe src="https://player.vimeo.com/video/$video" 62 $display frameborder="0" 63 webkitallowfullscreen mozallowfullscreen allowfullscreen> 64 </iframe> 65 </body> 66 </html> 67 OET; 68 echo $output;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body