# HG changeset patch
# User veltr
# Date 1347889499 -32400
# Node ID 2aa7fdb0762aefc41da54fc625f54b1a5e1dc053
# Parent 4da0a5740b6cbbbb925d849cda34e909692acf52
Commit before branch switch (for tests)
diff -r 4da0a5740b6c -r 2aa7fdb0762a doc/eventslist.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/eventslist.txt Mon Sep 17 22:44:59 2012 +0900
@@ -0,0 +1,8 @@
+Event Name Published by Subscribed by
+============================== ============================== ==============================
+Annotation.hide Annotation
+Annotation.show Annotation
+Annotation.minimize Annotation
+Annotation.maximize Annotation
+Annotation.getBounds Annotation
+Arrow.updatePosition Annotation
\ No newline at end of file
diff -r 4da0a5740b6c -r 2aa7fdb0762a src/js/defaults.js
--- a/src/js/defaults.js Mon Sep 17 00:17:06 2012 +0900
+++ b/src/js/defaults.js Mon Sep 17 22:44:59 2012 +0900
@@ -42,6 +42,14 @@
IriSP.widgetsDir = 'widgets';
IriSP.widgetsRequirements = {
+ PopcornPlayer: {
+ noCss: true,
+ requires: [ "popcorn" ]
+ },
+ JwpPlayer: {
+ noCss: true,
+ requires: [ "swfObject", "jwplayer" ]
+ },
Sparkline: {
noCss: true,
requires: [ "raphael" ]
diff -r 4da0a5740b6c -r 2aa7fdb0762a src/js/init.js
--- a/src/js/init.js Mon Sep 17 00:17:06 2012 +0900
+++ b/src/js/init.js Mon Sep 17 22:44:59 2012 +0900
@@ -1,4 +1,4 @@
-/* init.js - initialization and configuration of Popcorn and the widgets
+/* init.js - initialization and configuration of the widgets
*/
if (typeof window.IriSP === "undefined") {
@@ -10,11 +10,11 @@
IriSP.Metadataplayer = function(config) {
IriSP.log("IriSP.Metadataplayer constructor");
for (var key in IriSP.guiDefaults) {
- if (IriSP.guiDefaults.hasOwnProperty(key) && !config.gui.hasOwnProperty(key)) {
- config.gui[key] = IriSP.guiDefaults[key]
+ if (IriSP.guiDefaults.hasOwnProperty(key) && !config.hasOwnProperty(key)) {
+ config[key] = IriSP.guiDefaults[key]
}
}
- var _container = document.getElementById(config.gui.container);
+ var _container = document.getElementById(config.container);
_container.innerHTML = '
')
.attr("id",newDiv)
.css({
- width: this.config.gui.width + "px",
+ width: this.config.width + "px",
position: "relative",
clear: "both"
}),
spacerHtml = IriSP.jQuery('
')
.attr("id",spacerDiv)
.css({
- width: this.config.gui.width + "px",
- height: this.config.gui.spacer_div_height + "px",
+ width: this.config.width + "px",
+ height: this.config.spacer_div_height + "px",
position: "relative",
clear: "both"
});
diff -r 4da0a5740b6c -r 2aa7fdb0762a src/js/players/player.jwplayer.js
--- a/src/js/players/player.jwplayer.js Mon Sep 17 00:17:06 2012 +0900
+++ b/src/js/players/player.jwplayer.js Mon Sep 17 22:44:59 2012 +0900
@@ -13,7 +13,7 @@
this.trigger("play");
}
- var _player = jwplayer(this.container),
+ var _player = jwplayer(this.$[0]),
_this = this,
_seekPause = false;
diff -r 4da0a5740b6c -r 2aa7fdb0762a src/js/widgets.js
--- a/src/js/widgets.js Mon Sep 17 00:17:06 2012 +0900
+++ b/src/js/widgets.js Mon Sep 17 22:44:59 2012 +0900
@@ -26,7 +26,7 @@
/* Setting all the configuration options */
var _type = config.type,
- _config = IriSP._.defaults({}, config, player.config.gui.default_options, this.defaults),
+ _config = IriSP._.defaults({}, config, player.config.default_options, this.defaults),
_this = this;
IriSP._(_config).forEach(function(_value, _key) {
@@ -34,7 +34,7 @@
});
if (typeof this.width === "undefined") {
- this.width = player.config.gui.width;
+ this.width = player.config.width;
}
/* Setting this.player at the end in case it's been overriden
diff -r 4da0a5740b6c -r 2aa7fdb0762a src/widgets/JwpPlayer.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/widgets/JwpPlayer.js Mon Sep 17 22:44:59 2012 +0900
@@ -0,0 +1,120 @@
+IriSP.Widgets.JwpPlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.JwpPlayer.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.JwpPlayer.prototype.defaults = {
+}
+
+IriSP.Widgets.JwpPlayer.prototype.draw = function() {
+
+ var _opts = {},
+ _player = jwplayer("#" + this.container),
+ _seekPause = false,
+ _pauseState = true,
+ _props = [ "live", "provider", "autostart" ];
+
+ if (typeof this.video === "undefined") {
+ this.video = this.media.video;
+ }
+
+ if (typeof this.streamer === "function") {
+ this.streamer = this.streamer(this.video);
+ }
+
+ if (typeof this.streamer === "string") {
+ this.video = this.video.replace(this.streamer,"");
+ _opts.streamer = this.streamer;
+ }
+
+ _opts.file = this.video;
+ _opts.flashplayer = IriSP.getLib("jwPlayerSWF");
+ _opts["controlbar.position"] = "none";
+
+ for (var i = 0; i < _props.length; i++) {
+ if (typeof this[_props[i]] !== "undefined") {
+ _opts[_props[i]] = this[_props[i]];
+ }
+ }
+
+ if (this.autostart) {
+ _pauseState = false;
+ this.media.trigger("play");
+ }
+ // Binding functions to jwplayer
+
+ this.media.getCurrentTime = function() {
+ return new IriSP.Model.Time(1000*_player.getPosition());
+ }
+ this.media.getVolume = function() {
+ return _player.getVolume() / 100;
+ }
+ this.media.getPaused = function() {
+ return _pauseState;
+ }
+ this.media.getMuted = function() {
+ return _player.getMute();
+ }
+ this.media.setCurrentTime = function(_milliseconds) {
+ _seekPause = _pauseState;
+ return _player.seek(_milliseconds / 1000);
+ }
+ this.media.setVolume = function(_vol) {
+ return _player.setVolume(Math.floor(_vol*100));
+ }
+ this.media.mute = function() {
+ return _player.setMute(true);
+ }
+ this.media.unmute = function() {
+ return _player.setMute(false);
+ }
+ this.media.play = function() {
+ return _player.play(true);
+ }
+ this.media.pause = function() {
+ return _player.pause(true);
+ }
+
+ // Binding jwplater events to media
+
+ var _media = this.media;
+
+ _opts.events = {
+ onReady: function() {
+ _media.trigger("loadedmetadata");
+ },
+ onTime: function() {
+ if (_seekPause) {
+ _player.pause(true);
+ _seekPause = false;
+ } else {
+ if (_pauseState && _player.getState() === "PLAYING") {
+ _pauseState = false;
+ _media.trigger("play");
+ }
+ }
+ _this.trigger("timeupdate", _media.getCurrentTime());
+ },
+ onPlay: function() {
+ if (!_seekPause) {
+ _pauseState = false;
+ _media.trigger("play");
+ }
+ },
+ onPause: function() {
+ _pauseState = true;
+ _media.trigger("pause");
+ },
+ onSeek: function() {
+ _media.trigger("seeked");
+ }
+ }
+ console.log("Before Setup", _opts);
+ _player.setup(_opts);
+
+ console.log("OK");
+
+ this.jwplayer = _player;
+
+}
\ No newline at end of file
diff -r 4da0a5740b6c -r 2aa7fdb0762a src/widgets/PopcornPlayer.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/widgets/PopcornPlayer.js Mon Sep 17 22:44:59 2012 +0900
@@ -0,0 +1,88 @@
+IriSP.Widgets.PopcornPlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.PopcornPlayer.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.PopcornPlayer.prototype.defaults = {
+}
+
+IriSP.Widgets.PopcornPlayer.prototype.draw = function() {
+ var _tmpId = Popcorn.guid("video"),
+ _videoEl = IriSP.jQuery('