Commit a6ecfba8 authored by Nigel McNie's avatar Nigel McNie
Browse files

Make all videos 250px in width and height by default.

This fixes issues we've seen in many browsers where the videos wouldn't be displayed properly. It seems that in most (but not all!) combinations of browser, flash version and operating system, a pixel width and/or height is necessary to force the video to display.

Whether it worked or not seemed to vary from computer to computer without too much pattern.
parent 4670e327
......@@ -37,6 +37,11 @@ defined('INTERNAL') || die();
*/
class PluginBlocktypeExternalvideo extends SystemBlocktype {
// Default width and height for video players
private static $default_width = 250;
private static $default_height = 250;
public static function get_title() {
return get_string('title', 'blocktype.externalvideo');
}
......@@ -53,8 +58,8 @@ class PluginBlocktypeExternalvideo extends SystemBlocktype {
$configdata = $instance->get('configdata');
$result = '';
$url = hsc(self::make_video_url($configdata['videoid']));
$width = (!empty($configdata['width'])) ? hsc($configdata['width']) : '100%';
$height = (!empty($configdata['height'])) ? hsc($configdata['height']) : '';
$width = (!empty($configdata['width'])) ? hsc($configdata['width']) : self::$default_width;
$height = (!empty($configdata['height'])) ? hsc($configdata['height']) : self::$default_height;
if (isset($configdata['videoid'])) {
$result = '<div class="center">';
......@@ -92,21 +97,25 @@ class PluginBlocktypeExternalvideo extends SystemBlocktype {
'type' => 'text',
'title' => get_string('width','blocktype.externalvideo'),
'size' => 3,
//'rules' => array(
// 'minvalue' => 100,
// 'maxvalue' => 800,
//),
'defaultvalue' => (isset($configdata['width'])) ? $configdata['width'] : '',
'rules' => array(
'required' => true,
'integer' => true,
'minvalue' => 100,
'maxvalue' => 800,
),
'defaultvalue' => (!empty($configdata['width'])) ? $configdata['width'] : self::$default_width,
),
'height' => array(
'type' => 'text',
'title' => get_string('height','blocktype.externalvideo'),
'size' => 3,
//'rules' => array(
// 'minvalue' => 100,
// 'maxvalue' => 800,
//),
'defaultvalue' => (isset($configdata['height'])) ? $configdata['height'] : '',
'rules' => array(
'required' => true,
'integer' => true,
'minvalue' => 100,
'maxvalue' => 800,
),
'defaultvalue' => (!empty($configdata['height'])) ? $configdata['height'] : self::$default_height,
),
);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment