2
* flowplayer.js 3.2.12. The Flowplayer API
4
* Copyright 2009-2011 Flowplayer Oy
6
* This file is part of Flowplayer.
8
* Flowplayer is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (at your option) any later version.
13
* Flowplayer is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with Flowplayer. If not, see <http://www.gnu.org/licenses/>.
22
* Revision: ${revision}
26
console.log("$f.fireEvent", [].slice.call(p))
30
if (!r || typeof r != "object") {
33
var p = new r.constructor();
35
if (r.hasOwnProperty(q)) {
46
var p, q = 0, s = u.length;
47
if (s === undefined) {
49
if (r.call(u[p], p, u[p]) === false) {
54
for (var t = u[0]; q < s && r.call(t, q, t) !== false; t = u[++q]) {
61
return document.getElementById(p)
65
if (typeof q != "object") {
69
n(q, function (s, t) {
70
if (!p || typeof t != "function") {
79
var r = t.indexOf(".");
81
var q = t.slice(0, r) || "*";
82
var p = t.slice(r + 1, t.length);
84
n(document.getElementsByTagName(q), function () {
85
if (this.className && this.className.indexOf(p) != -1) {
94
p = p || window.event;
95
if (p.preventDefault) {
99
p.returnValue = false;
100
p.cancelBubble = true
105
function k(r, p, q) {
111
return p.replace(/&/g, "%26").replace(/&/g, "%26").replace(/=/g, "%3D")
115
return"_" + ("" + Math.random()).slice(2, 10)
118
var i = function (u, s, t) {
119
var r = this, q = {}, v = {};
121
if (typeof u == "string") {
125
n(("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop").split(","), function () {
127
if (w.indexOf("*") != -1) {
128
w = w.slice(0, w.length - 1);
129
var x = "onBefore" + w.slice(2);
130
r[x] = function (y) {
135
r[w] = function (y) {
148
j(this, {onCuepoint: function (y, x) {
149
if (arguments.length == 1) {
150
q.embedded = [null, y];
153
if (typeof y == "number") {
159
t._api().fp_addCuepoints(y, s, w)
162
}, update: function (x) {
165
t._api().fp_updateClip(x, s)
167
var w = t.getConfig();
168
var y = (s == -1) ? w.clip : w.playlist[s];
170
}, _fireEvent: function (w, z, x, B) {
172
n(q, function (C, D) {
174
t._api().fp_addCuepoints(D[0], s, C)
180
if (w == "onCuepoint") {
183
return A[1].call(t, B, x)
186
if (z && "onBeforeBegin,onMetaData,onStart,onUpdate,onResume".indexOf(w) != -1) {
190
B.duration = z.metaData.duration
192
B.fullDuration = z.metaData.duration
197
n(v[w], function () {
198
y = this.call(t, B, z, x)
203
var p = u.onCuepoint;
204
r.onCuepoint.apply(r, typeof p == "function" ? [p] : p);
207
n(u, function (w, x) {
208
if (typeof x == "function") {
214
t.onCuepoint = this.onCuepoint
217
var m = function (q, s, r, u) {
218
var p = this, t = {}, v = false;
222
n(s, function (w, x) {
223
if (typeof x == "function") {
228
j(this, {animate: function (z, A, y) {
232
if (typeof A == "function") {
236
if (typeof z == "string") {
246
if (A === undefined) {
249
s = r._api().fp_animate(q, z, A, w);
251
}, css: function (x, y) {
252
if (y !== undefined) {
257
s = r._api().fp_css(q, x);
260
}, show: function () {
261
this.display = "block";
262
r._api().fp_showPlugin(q);
264
}, hide: function () {
265
this.display = "none";
266
r._api().fp_hidePlugin(q);
268
}, toggle: function () {
269
this.display = r._api().fp_togglePlugin(q);
271
}, fadeTo: function (z, y, x) {
272
if (typeof y == "function") {
280
this.display = r._api().fp_fadeTo(q, z, y, w);
283
}, fadeIn: function (x, w) {
284
return p.fadeTo(1, x, w)
285
}, fadeOut: function (x, w) {
286
return p.fadeTo(0, x, w)
287
}, getName: function () {
289
}, getPlayer: function () {
291
}, _fireEvent: function (x, w, y) {
292
if (x == "onUpdate") {
293
var A = r._api().fp_getPlugin(q);
300
n(A.methods, function () {
303
var D = [].slice.call(arguments);
304
var E = r._api().fp_invoke(q, C, D);
305
return E === "undefined" || E === undefined ? p : E
313
var z = B.apply(p, w);
314
if (x.slice(0, 1) == "_") {
323
function b(r, H, u) {
324
var x = this, w = null, E = false, v, t, G = [], z = {}, y = {}, F, s, q, D, p, B;
325
j(x, {id: function () {
327
}, isLoaded: function () {
328
return(w !== null && w.fp_play !== undefined && !E)
329
}, getParent: function () {
331
}, hide: function (I) {
333
r.style.height = "0px"
336
w.style.height = "0px"
339
}, show: function () {
340
r.style.height = B + "px";
342
w.style.height = p + "px"
345
}, isHidden: function () {
346
return x.isLoaded() && parseInt(w.style.height, 10) === 0
347
}, load: function (K) {
348
if (!x.isLoaded() && x._fireEvent("onBeforeLoad") !== false) {
349
var I = function () {
350
if (v && !flashembed.isSupported(H.version)) {
357
flashembed(r, H, {config: u})
361
this.unload(function (L) {
362
if (++J == a.length) {
369
}, unload: function (K) {
370
if (v.replace(/\s/g, "") !== "") {
371
if (x._fireEvent("onBeforeUnload") === false) {
380
if (w.fp_isFullscreen()) {
381
w.fp_toggleFullscreen()
384
x._fireEvent("onUnload")
388
var J = function () {
396
if (/WebKit/i.test(navigator.userAgent) && !/Chrome/i.test(navigator.userAgent)) {
407
}, getClip: function (I) {
408
if (I === undefined) {
412
}, getCommonClip: function () {
414
}, getPlaylist: function () {
416
}, getPlugin: function (I) {
418
if (!K && x.isLoaded()) {
419
var J = x._api().fp_getPlugin(I);
426
}, getScreen: function () {
427
return x.getPlugin("screen")
428
}, getControls: function () {
429
return x.getPlugin("controls")._fireEvent("onUpdate")
430
}, getLogo: function () {
432
return x.getPlugin("logo")._fireEvent("onUpdate")
435
}, getPlay: function () {
436
return x.getPlugin("play")._fireEvent("onUpdate")
437
}, getConfig: function (I) {
439
}, getFlashParams: function () {
441
}, loadPlugin: function (L, K, N, M) {
442
if (typeof N == "function") {
446
var J = M ? f() : "_";
447
x._api().fp_loadPlugin(L, K, N, J);
450
var O = new m(L, null, x, I);
453
}, getState: function () {
454
return x.isLoaded() ? w.fp_getState() : -1
455
}, play: function (J, I) {
456
var K = function () {
457
if (J !== undefined) {
458
x._api().fp_play(J, I)
467
setTimeout(function () {
477
}, getVersion: function () {
478
var J = "flowplayer.js 3.2.12";
480
var I = w.fp_getVersion();
485
}, _api: function () {
487
throw"Flowplayer " + x.id() + " not loaded when calling an API method"
490
}, setClip: function (I) {
491
n(I, function (J, K) {
492
if (typeof K == "function") {
496
if (J == "onCuepoint") {
497
$f(r).getCommonClip().onCuepoint(I[J][0], I[J][1])
503
}, getIndex: function () {
505
}, bufferAnimate: function (I) {
506
w.fp_bufferAnimate(I === undefined || I);
508
}, _swfHeight: function () {
509
return w.clientHeight
511
n(("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,ClipAdd,Fullscreen*,FullscreenExit,Error,MouseOver,MouseOut").split(","), function () {
513
if (I.indexOf("*") != -1) {
514
I = I.slice(0, I.length - 1);
515
var J = "onBefore" + I.slice(2);
516
x[J] = function (K) {
521
x[I] = function (K) {
526
n(("pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,toggleFullscreen,reset,close,setPlaylist,addClip,playFeed,setKeyboardShortcutsEnabled,isKeyboardShortcutsEnabled").split(","), function () {
528
x[I] = function (K, J) {
533
if (K !== undefined && J !== undefined) {
534
L = w["fp_" + I](K, J)
536
L = (K === undefined) ? w["fp_" + I]() : w["fp_" + I](K)
538
return L === "undefined" || L === undefined ? x : L
541
x._fireEvent = function (R) {
542
if (typeof R == "string") {
545
var S = R[0], P = R[1], N = R[2], M = R[3], L = 0;
549
if (!x.isLoaded() && S == "onLoad" && P == "player") {
553
this._fireEvent("onLoad")
555
n(z, function (T, U) {
556
U._fireEvent("onUpdate")
558
t._fireEvent("onLoad")
560
if (S == "onLoad" && P != "player") {
563
if (S == "onError") {
564
if (typeof P == "string" || (typeof P == "number" && typeof N == "number")) {
569
if (S == "onContextMenu") {
570
n(u.contextMenu[P], function (T, U) {
575
if (S == "onPluginEvent" || S == "onBeforePluginEvent") {
579
J._fireEvent("onUpdate", P);
580
return J._fireEvent(N, R.slice(3))
584
if (S == "onPlaylistReplace") {
588
G.push(new i(this, O++, x))
591
if (S == "onClipAdd") {
597
for (L = N + 1; L < G.length; L++) {
602
if (typeof P == "number" && P < G.length) {
606
Q = K._fireEvent(S, N, M)
608
if (!K || Q !== false) {
609
Q = t._fireEvent(S, N, M, K)
612
n(y[S], function () {
613
Q = this.call(x, P, N);
625
r.innerHTML=''; // Moodle hack - we do not want splashscreens, unfortunately there is not switch to disable them
627
$f(r).getParent().innerHTML = "";
628
q = $f(r).getIndex();
634
B = parseInt(r.style.height, 10) || r.clientHeight;
635
F = r.id || "fp" + f();
636
s = H.id || F + "_api";
639
if (typeof u == "string") {
643
u.clip = u.clip || {};
644
if (r.getAttribute("href", 2) && !u.clip.url) {
645
u.clip.url = r.getAttribute("href", 2)
648
u.clip.url = e(u.clip.url)
650
t = new i(u.clip, -1, x);
651
u.playlist = u.playlist || [u.clip];
653
n(u.playlist, function () {
655
if (typeof M == "object" && M.length) {
661
n(u.clip, function (N, O) {
662
if (O !== undefined && M[N] === undefined && typeof O != "function") {
671
n(u, function (M, N) {
672
if (typeof N == "function") {
681
n(u.plugins, function (M, N) {
683
z[M] = new m(M, N, x)
686
if (!u.plugins || u.plugins.controls === undefined) {
687
z.controls = new m("controls", null, x)
689
z.canvas = new m("canvas", null, x);
692
if (/iPad|iPhone|iPod/i.test(navigator.userAgent) && !/.flv$/i.test(G[0].url) && !K()) {
695
if (!x.isLoaded() && x._fireEvent("onBeforeClick") !== false) {
702
return x.hasiPadSupport && x.hasiPadSupport()
706
if (v.replace(/\s/g, "") !== "") {
707
if (r.addEventListener) {
708
r.addEventListener("click", L, false)
711
r.attachEvent("onclick", L)
715
if (r.addEventListener && !K()) {
716
r.addEventListener("click", g, false)
725
if (typeof r == "string") {
728
throw"Flowplayer cannot access element: " + r
740
this.length = p.length;
741
this.each = function (r) {
744
this.size = function () {
748
for (name in b.prototype) {
749
q[name] = function () {
752
this[name].apply(this, r)
758
window.flowplayer = window.$f = function () {
760
var p = arguments[0];
761
if(!flashembed.isSupported([6, 65])){return null;} // Moodle hack - we do not want the missing flash hints - we need the original links for accessibility and incompatible browsers
762
if (!arguments.length) {
764
if (this.isLoaded()) {
771
if (arguments.length == 1) {
772
if (typeof p == "number") {
779
if (this.id() == p.id || this.id() == p || this.getParent() == p) {
787
if (arguments.length > 1) {
788
var u = arguments[1], r = (arguments.length == 3) ? arguments[2] : {};
789
if (typeof u == "string") {
792
u = j({bgcolor: "#000000", version: [10, 1], expressInstall: "http://releases.flowplayer.org/swf/expressinstall.swf", cachebusting: false}, u);
793
if (typeof p == "string") {
794
if (p.indexOf(".") != -1) {
796
n(o(p), function () {
797
t.push(new b(this, l(u), l(r)))
802
return new b(s !== null ? s : l(p), l(u), l(r))
806
return new b(p, l(u), l(r))
812
j(window.$f, {fireEvent: function () {
813
var q = [].slice.call(arguments);
815
return r ? r._fireEvent(q.slice(1)) : null
816
}, addPlugin: function (p, q) {
819
}, each: n, extend: j});
820
if (typeof jQuery == "function") {
821
jQuery.fn.flowplayer = function (r, q) {
822
if (!arguments.length || typeof arguments[0] == "number") {
824
this.each(function () {
830
return arguments.length ? p[arguments[0]] : new d(p)
832
return this.each(function () {
833
$f(this, l(r), q ? l(q) : {})
839
var h = document.all, j = "http://get.adobe.com/flashplayer", c = typeof jQuery == "function", e = /(\d+)[^\d]+(\d+)[^\d]*(\d*)/, b = {width: "100%", height: "100%", id: "_" + ("" + Math.random()).slice(9), allowfullscreen: true, allowscriptaccess: "always", quality: "high", version: [3, 0], onFail: null, expressInstall: null, w3c: false, cachebusting: false};
840
if (window.attachEvent) {
841
window.attachEvent("onbeforeunload", function () {
842
__flash_unloadHandler = function () {
844
__flash_savedUnloadHandler = function () {
851
if (l.hasOwnProperty(f)) {
862
if (f.hasOwnProperty(l)) {
869
window.flashembed = function (f, m, l) {
870
if (typeof f == "string") {
871
f = document.getElementById(f.replace("#", ""))
876
if (typeof m == "string") {
879
return new d(f, i(i({}, b), m), l)
881
var g = i(window.flashembed, {conf: b, getVersion: function () {
884
f = navigator.plugins["Shockwave Flash"].description.slice(16)
887
m = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
888
f = m && m.GetVariable("$version")
891
m = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
892
f = m && m.GetVariable("$version")
898
return f ? [1 * f[1], 1 * f[(f[1] * 1 > 9 ? 2 : 3)] * 1] : [0, 0]
899
}, asString: function (l) {
900
if (l === null || l === undefined) {
904
if (f == "object" && l.push) {
909
l = l.replace(new RegExp('(["\\\\])', "g"), "\\$1");
910
l = l.replace(/^\s?(\d+\.?\d*)%/, "$1pct");
913
return"[" + a(l,function (o) {
917
return'"function()"';
921
if (l.hasOwnProperty(n)) {
922
m.push('"' + n + '":' + g.asString(l[n]))
925
return"{" + m.join(",") + "}"
927
return String(l).replace(/\s/g, " ").replace(/\'/g, '"')
928
}, getHTML: function (o, l) {
930
var n = '<object width="' + o.width + '" height="' + o.height + '" id="' + o.id + '" name="' + o.id + '"';
931
if (o.cachebusting) {
932
o.src += ((o.src.indexOf("?") != -1 ? "&" : "?") + Math.random())
935
n += ' data="' + o.src + '" type="application/x-shockwave-flash"'
937
n += ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
941
n += '<param name="movie" value="' + o.src + '" />'
943
o.width = o.height = o.id = o.w3c = o.src = null;
944
o.onFail = o.version = o.expressInstall = null;
947
n += '<param name="' + m + '" value="' + o[m] + '" />'
955
p += f + "=" + (/function|object/.test(typeof q) ? g.asString(q) : q) + "&"
959
n += '<param name="flashvars" value=\'' + p + "' />"
963
}, isSupported: function (f) {
964
return k[0] > f[0] || k[0] == f[0] && k[1] >= f[1]
966
var k = g.getVersion();
968
function d(f, n, m) {
969
if (g.isSupported(n.version)) {
970
f.innerHTML = g.getHTML(n, m)
972
if (n.expressInstall && g.isSupported([6, 65])) {
973
f.innerHTML = g.getHTML(i(n, {src: n.expressInstall}), {MMredirectURL: encodeURIComponent(location.href), MMplayerType: "PlugIn", MMdoctitle: document.title})
975
if (!f.innerHTML.replace(/\s/g, "")) {
976
f.innerHTML = "<h2>Flash version " + n.version + " or greater is required</h2><h3>" + (k[0] > 0 ? "Your version is " + k : "You have no flash plugin installed") + "</h3>" + (f.tagName == "A" ? "<p>Click here to download latest version</p>" : "<p>Download latest version from <a href='" + j + "'>here</a></p>");
977
if (f.tagName == "A" || f.tagName == "DIV") {
978
f.onclick = function () {
984
var l = n.onFail.call(this);
985
if (typeof l == "string") {
992
window[n.id] = document.getElementById(n.id)
994
i(this, {getRoot: function () {
996
}, getOptions: function () {
998
}, getConf: function () {
1000
}, getApi: function () {
1006
jQuery.tools = jQuery.tools || {version: "3.2.12"};
1007
jQuery.tools.flashembed = {conf: b};
1008
jQuery.fn.flashembed = function (l, f) {
1009
return this.each(function () {
1010
$(this).data("flashembed", flashembed(this, l, f))
b'\\ No newline at end of file'