Commit 50219efd authored by Aaron Wells's avatar Aaron Wells Committed by Gerrit Code Review
Browse files

Update mahara-flashplayer to be based on flowplayer 3.2.18

Bug 1316375

Change-Id: Id5289bb6392a1e2d1f3d3d9b2dea91fba4298408
parent be08f86a
......@@ -447,11 +447,11 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
}
define('BLOCKTYPE_INTERNALMEDIA_JS_INCLUDED', true);
if ($asarray) {
return array(get_config('wwwroot').'artefact/file/blocktype/internalmedia/mahara-flashplayer/mahara-flashplayer-3.2.6.js',
return array(get_config('wwwroot').'artefact/file/blocktype/internalmedia/mahara-flashplayer/mahara-flashplayer.js',
get_config('wwwroot') . 'artefact/file/blocktype/internalmedia/swfobject.js',
);
}
return '<script src="'.get_config('wwwroot').'artefact/file/blocktype/internalmedia/mahara-flashplayer/mahara-flashplayer-3.2.6.js"></script>
return '<script src="'.get_config('wwwroot').'artefact/file/blocktype/internalmedia/mahara-flashplayer/mahara-flashplayer.js"></script>
<script src="' . get_config('wwwroot') . 'artefact/file/blocktype/internalmedia/swfobject.js" type="text/javascript"></script>';
}
......
......@@ -5,7 +5,7 @@ This is a modified version of FlowPlayer. In accordance with the FlowPlayer
GPL license, it has been renamed to "mahara-flashplayer" for distribution.
Website: https://gitorious.org/mahara/mahara-flashplayer
Version: 3.2.16dev
Version: 3.2.18
This flash video player is used by the Mahara internal media blocktype. The
primary modification made from the original project is that it has been
......
/**
* flowplayer.js 3.2.6. The Flowplayer API
*
* Copyright 2009 Flowplayer Oy
*
/*!
* flowplayer.js The Flowplayer API
*
* Copyright 2009-2011 Flowplayer Oy
*
* This file is part of Flowplayer.
*
*
* Flowplayer is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* Flowplayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with Flowplayer. If not, see <http://www.gnu.org/licenses/>.
*
* Date: 2010-08-25 12:48:46 +0000 (Wed, 25 Aug 2010)
* Revision: 575
*
*/
(function() {
/*
FEATURES
!function() {
/*
FEATURES
--------
- $f() and flowplayer() functions
- handling multiple instances
- Flowplayer programming API
- Flowplayer event model
- player loading / unloading
- $f() and flowplayer() functions
- handling multiple instances
- Flowplayer programming API
- Flowplayer event model
- player loading / unloading
- jQuery support
*/
*/
/*jslint glovar: true, browser: true */
/*global flowplayer, $f */
// {{{ private utility methods
function log(args) {
console.log("$f.fireEvent", [].slice.call(args));
console.log("$f.fireEvent", [].slice.call(args));
}
// thanks: http://keithdevens.com/weblog/archive/2007/Jun/07/javascript.clone
function clone(obj) {
if (!obj || typeof obj != 'object') { return obj; }
var temp = new obj.constructor();
for (var key in obj) {
function clone(obj) {
if (!obj || typeof obj != 'object') { return obj; }
var temp = new obj.constructor();
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
temp[key] = clone(obj[key]);
}
}
}
return temp;
}
// stripped from jQuery, thanks John Resig
// stripped from jQuery, thanks John Resig
function each(obj, fn) {
if (!obj) { return; }
var name, i = 0, length = obj.length;
// object
if (length === undefined) {
for (name in obj) {
if (fn.call(obj[name], name, obj[name]) === false) { break; }
}
// array
} else {
for (var value = obj[0];
i < length && fn.call( value, i, value ) !== false; value = obj[++i]) {
i < length && fn.call( value, i, value ) !== false; value = obj[++i]) {
}
}
return obj;
}
// convenience
function el(id) {
return document.getElementById(id);
}
return document.getElementById(id);
}
// used extensively. a very simple implementation.
// used extensively. a very simple implementation.
function extend(to, from, skipFuncs) {
if (typeof from != 'object') { return to; }
if (to && from) {
if (to && from) {
each(from, function(name, value) {
if (!skipFuncs || typeof value != 'function') {
to[name] = value;
to[name] = value;
}
});
}
return to;
}
// var arr = select("elem.className");
// var arr = select("elem.className");
function select(query) {
var index = query.indexOf(".");
var index = query.indexOf(".");
if (index != -1) {
var tag = query.slice(0, index) || "*";
var klass = query.slice(index + 1, query.length);
var els = [];
each(document.getElementsByTagName(tag), function() {
if (this.className && this.className.indexOf(klass) != -1) {
els.push(this);
els.push(this);
}
});
return els;
}
}
// fix event inconsistencies across browsers
function stopEvent(e) {
e = e || window.event;
if (e.preventDefault) {
e.stopPropagation();
e.preventDefault();
} else {
e.returnValue = false;
e.returnValue = false;
e.cancelBubble = true;
}
}
return false;
}
// push an event listener into existing array of listeners
function bind(to, evt, fn) {
to[evt] = to[evt] || [];
to[evt].push(fn);
to[evt].push(fn);
}
// escape & and = in config written into flashvars (issue #21)
function queryescape(url) {
return url.replace(/&amp;/g, '%26').replace(/&/g, '%26').replace(/=/g, '%3D');
}
// generates an unique id
function makeId() {
return "_" + ("" + Math.random()).slice(2, 10);
return "_" + ("" + Math.random()).slice(2, 10);
}
//}}}
//}}}
// {{{ Clip
var Clip = function(json, index, player) {
// private variables
var self = this,
cuepoints = {},
listeners = {};
self.index = index;
// instance variables
if (typeof json == 'string') {
json = {url:json};
json = {url:json};
}
extend(this, json, true);
// event handling
extend(this, json, true);
// event handling
each(("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop").split(","),
function() {
var evt = "on" + this;
// before event
if (evt.indexOf("*") != -1) {
evt = evt.slice(0, evt.length -1);
var before = "onBefore" + evt.slice(2);
evt = evt.slice(0, evt.length -1);
var before = "onBefore" + evt.slice(2);
self[before] = function(fn) {
bind(listeners, before, fn);
return self;
};
}
};
}
self[evt] = function(fn) {
bind(listeners, evt, fn);
return self;
};
// set common clip event listeners to player level
if (index == -1) {
if (self[before]) {
player[before] = self[before];
}
player[before] = self[before];
}
if (self[evt]) {
player[evt] = self[evt];
player[evt] = self[evt];
}
}
});
extend(this, {
onCuepoint: function(points, fn) {
});
extend(this, {
onCuepoint: function(points, fn) {
// embedded cuepoints
if (arguments.length == 1) {
cuepoints.embedded = [null, points];
return self;
}
if (typeof points == 'number') {
points = [points];
points = [points];
}
var fnId = makeId();
cuepoints[fnId] = [points, fn];
var fnId = makeId();
cuepoints[fnId] = [points, fn];
if (player.isLoaded()) {
player._api().fp_addCuepoints(points, index, fnId);
}
player._api().fp_addCuepoints(points, index, fnId);
}
return self;
},
update: function(json) {
extend(self, json);
if (player.isLoaded()) {
player._api().fp_updateClip(json, index);
player._api().fp_updateClip(json, index);
}
var conf = player.getConfig();
var conf = player.getConfig();
var clip = (index == -1) ? conf.clip : conf.playlist[index];
extend(clip, json, true);
},
// internal event for performing clip tasks. should be made private someday
_fireEvent: function(evt, arg1, arg2, target) {
if (evt == 'onLoad') {
_fireEvent: function(evt, arg1, arg2, target) {
if (evt == 'onLoad') {
each(cuepoints, function(key, val) {
if (val[0]) {
player._api().fp_addCuepoints(val[0], index, key);
player._api().fp_addCuepoints(val[0], index, key);
}
});
});
return false;
}
// target clip we are working against
target = target || self;
target = target || self;
if (evt == 'onCuepoint') {
var fn = cuepoints[arg1];
if (fn) {
return fn[1].call(player, target, arg2);
}
}
}
// 1. clip properties, 2-3. metadata, 4. updates, 5. resumes from nested clip
if (arg1 && "onBeforeBegin,onMetaData,onStart,onUpdate,onResume".indexOf(evt) != -1) {
//#148 add onMetaDataChange event to extend clip properties, this was needed to prevent regular updates during stream switching.
if (arg1 && "onBeforeBegin,onMetaData,onMetaDataChange,onStart,onUpdate,onResume".indexOf(evt) != -1) {
// update clip properties
extend(target, arg1);
extend(target, arg1);
if (arg1.metaData) {
if (!target.duration) {
target.duration = arg1.metaData.duration;
target.duration = arg1.metaData.duration;
} else {
target.fullDuration = arg1.metaData.duration;
}
target.fullDuration = arg1.metaData.duration;
}
}
}
}
var ret = true;
each(listeners[evt], function() {
ret = this.call(player, target, arg1, arg2);
});
return ret;
}
ret = this.call(player, target, arg1, arg2);
});
return ret;
}
});
// get cuepoints from config
if (json.onCuepoint) {
var arg = json.onCuepoint;
self.onCuepoint.apply(self, typeof arg == 'function' ? [arg] : arg);
delete json.onCuepoint;
}
}
// get other events
each(json, function(key, val) {
if (typeof val == 'function') {
bind(listeners, key, val);
delete json[key];
}
});
// setup common clip event callbacks for Player object too (shortcuts)
if (index == -1) {
player.onCuepoint = this.onCuepoint;
player.onCuepoint = this.onCuepoint;
}
};
......@@ -311,159 +314,159 @@
// {{{ Plugin
var Plugin = function(name, json, player, fn) {
var self = this,
listeners = {},
hasMethods = false;
if (fn) {
extend(listeners, fn);
}
extend(listeners, fn);
}
// custom callback functions in configuration
each(json, function(key, val) {
if (typeof val == 'function') {
listeners[key] = val;
delete json[key];
delete json[key];
}
});
// core plugin methods
});
// core plugin methods
extend(this, {
// speed and fn are optional
animate: function(props, speed, fn) {
animate: function(props, speed, fn) {
if (!props) {
return self;
return self;
}
if (typeof speed == 'function') {
fn = speed;
if (typeof speed == 'function') {
fn = speed;
speed = 500;
}
if (typeof props == 'string') {
var key = props;
props = {};
props[key] = speed;
speed = 500;
speed = 500;
}
if (fn) {
var fnId = makeId();
listeners[fnId] = fn;
}
if (speed === undefined) { speed = 500; }
json = player._api().fp_animate(name, props, speed, fnId);
json = player._api().fp_animate(name, props, speed, fnId);
return self;
},
css: function(props, val) {
if (val !== undefined) {
var css = {};
css[props] = val;
props = css;
props = css;
}
json = player._api().fp_css(name, props);
extend(self, json);
return self;
},
show: function() {
this.display = 'block';
player._api().fp_showPlugin(name);
return self;
},
hide: function() {
this.display = 'none';
player._api().fp_hidePlugin(name);
return self;
},
// toggle between visible / hidden state
toggle: function() {