--- a/src/js/init.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/js/init.js Mon Sep 17 00:17:06 2012 +0900
@@ -18,8 +18,7 @@
_container.innerHTML = '<h3 class="Ldt-Loader">Loading... Chargement...</h3>';
this.sourceManager = new IriSP.Model.Directory();
this.config = config;
- this.callbackQueue = [];
- this.isLoaded = false;
+ this.__events = {};
this.loadLibs();
}
@@ -27,26 +26,18 @@
return 'Metadataplayer in #' + this.config.gui.container;
}
-IriSP.Metadataplayer.prototype.deferCallback = function(_callback) {
- var _this = this;
- IriSP._.defer(function() {
- _callback.call(_this);
- });
+IriSP.Metadataplayer.prototype.on = function(_event, _callback) {
+ if (typeof this.__events[_event] === "undefined") {
+ this.__events[_event] = [];
+ }
+ this.__events[_event].push(_callback);
}
-IriSP.Metadataplayer.prototype.handleCallbacks = function() {
- this.isLoaded = true;
- while (this.callbackQueue.length) {
- this.deferCallback(this.callbackQueue.splice(0,1)[0]);
- }
-}
-
-IriSP.Metadataplayer.prototype.onLoad = function(_callback) {
- if (this.isLoaded) {
- this.deferCallback(_callback);
- } else {
- this.callbackQueue.push(_callback);
- }
+IriSP.Metadataplayer.prototype.trigger = function(_event, _data) {
+ var _element = this;
+ IriSP._(this.__events[_event]).each(function(_callback) {
+ _callback.call(_element, _data);
+ });
}
IriSP.Metadataplayer.prototype.loadLibs = function() {
@@ -100,7 +91,7 @@
IriSP.loadCss(IriSP.getLib("cssjQueryUI"));
IriSP.loadCss(this.config.gui.css);
- this.videoData = this.loadMetadata(this.config.player.metadata);
+// this.videoData = this.loadMetadata(this.config.player.metadata);
this.$ = IriSP.jQuery('#' + this.config.gui.container);
this.$.css({
"width": this.config.gui.width,
@@ -110,10 +101,19 @@
this.$.css("height", this.config.gui.height);
}
+ this.widgets = [];
var _this = this;
+ for(var i = 0; i < this.config.gui.widgets.length; i++) {
+ this.loadWidget(this.config.gui.widgets[i], function(_widget) {
+ _this.widgets.push(_widget)
+ });
+ };
+ this.$.find('.Ldt-Loader').detach();
+/*
this.videoData.onLoad(function() {
_this.onVideoDataLoaded();
});
+*/
}
IriSP.Metadataplayer.prototype.loadMetadata = function(_metadataInfo) {
@@ -130,6 +130,7 @@
}
}
+// TODO: REMOVE !
IriSP.Metadataplayer.prototype.onVideoDataLoaded = function() {
/* Setting default media from metadata */
@@ -318,7 +319,6 @@
});
};
this.$.find('.Ldt-Loader').detach();
- this.handleCallbacks();
}
IriSP.Metadataplayer.prototype.loadWidget = function(_widgetConfig, _callback) {
@@ -380,3 +380,5 @@
return [newDiv, spacerDiv];
};
+
+IriSP.Metadataplayer.prototype.on
--- a/src/js/model.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/js/model.js Mon Sep 17 00:17:06 2012 +0900
@@ -364,7 +364,7 @@
this.contents = new IriSP.Model.List(this.source.directory);
this.contents.addIds(this.id);
} else {
- this.contents = this.source.directory.getElement(this.id);
+ this.contents = this.source.getElement(this.id);
}
}
@@ -450,6 +450,23 @@
IriSP.Model.Media.prototype = new IriSP.Model.Element();
+/* Default functions to be overriden by players */
+
+IriSP.Model.Media.prototype.getCurrentTime = function() { return 0; }
+
+IriSP.Model.Media.prototype.getVolume = function() { return .5; }
+
+IriSP.Model.Media.prototype.getPaused = function() { return true; }
+
+IriSP.Model.Media.prototype.getMuted = function() { return false; }
+
+IriSP.Model.Media.prototype.setCurrentTime
+ = IriSP.Model.Media.prototype.setVolume
+ = IriSP.Model.Media.prototype.setMuted
+ = IriSP.Model.Media.prototype.play
+ = IriSP.Model.Media.prototype.pause
+ = function() {}
+
IriSP.Model.Media.prototype.setDuration = function(_durationMs) {
this.duration.setMilliseconds(_durationMs);
}
@@ -768,6 +785,26 @@
}
}
+IriSP.Model.Source.prototype.getCurrentMedia = function(_opts) {
+ if (typeof _opts === "undefined") {
+ var _opts = {};
+ }
+ if (typeof this.currentMedia === "undefined" || _opts.override) {
+ if (_opts.mashup) {
+ var _mashups = this.getMashups();
+ if (_mashups.length) {
+ this.currentMedia = _mashups[0];
+ }
+ } else {
+ var _medias = this.getMedias();
+ if (_medias.length) {
+ _media = _medias[0];
+ }
+ }
+ }
+ return this.currentMedia;
+}
+
IriSP.Model.Source.prototype.merge = function(_source) {
var _this = this;
_source.forEach(function(_value, _key) {
--- a/src/js/players/player.allocine.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/js/players/player.allocine.js Mon Sep 17 00:17:06 2012 +0900
@@ -1,3 +1,5 @@
+//TODO: Remove and replace by Player Widget
+
/* To wrap a player the develop should create a new class derived from
the IriSP.PopcornReplacement.player and defining the correct functions */
--- a/src/js/players/player.dailymotion.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/js/players/player.dailymotion.js Mon Sep 17 00:17:06 2012 +0900
@@ -1,3 +1,5 @@
+//TODO: Remove and replace by Player Widget
+
/* To wrap a player the develop should create a new class derived from
the IriSP.PopcornReplacement.player and defining the correct functions */
--- a/src/js/players/player.jwplayer.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/js/players/player.jwplayer.js Mon Sep 17 00:17:06 2012 +0900
@@ -1,3 +1,5 @@
+//TODO: Remove and replace by Player Widget
+
/* To wrap a player the develop should create a new class derived from
the IriSP.PopcornReplacement.player and defining the correct functions */
--- a/src/js/players/player.mashup-html.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/js/players/player.mashup-html.js Mon Sep 17 00:17:06 2012 +0900
@@ -1,3 +1,5 @@
+//TODO: Remove and replace by Player Widget
+
/* To wrap a player the develop should create a new class derived from
the IriSP.PopcornReplacement.player and defining the correct functions */
--- a/src/js/players/player.mashup.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/js/players/player.mashup.js Mon Sep 17 00:17:06 2012 +0900
@@ -1,3 +1,5 @@
+//TODO: Remove and replace by Player Widget
+
/* To wrap a player the develop should create a new class derived from
the IriSP.PopcornReplacement.player and defining the correct functions */
--- a/src/js/pop.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/js/pop.js Mon Sep 17 00:17:06 2012 +0900
@@ -1,3 +1,5 @@
+//TODO: Remove Popcorn replacement, replace it by Media Events
+
/* wrapper that simulates popcorn.js because
popcorn is a bit unstable at the time */
--- a/src/js/serializers/ldt.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/js/serializers/ldt.js Mon Sep 17 00:17:06 2012 +0900
@@ -208,7 +208,7 @@
}
if (typeof _data.meta !== "undefined" && typeof _data.meta.main_media !== "undefined" && typeof _data.meta.main_media["id-ref"] !== "undefined") {
- _source.mainMedia = _data.meta.main_media["id-ref"];
+ _source.currentMedia = _source.getElement(_data.meta.main_media["id-ref"]);
}
}
}
--- a/src/js/widgets.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/js/widgets.js Mon Sep 17 00:17:06 2012 +0900
@@ -47,6 +47,7 @@
/* Call draw when loaded */
this.source.onLoad(function() {
+ _this.media = this.getCurrentMedia();
_this.draw();
});
@@ -88,21 +89,38 @@
return _function.apply(_this, Array.prototype.slice.call(arguments, 0));
}
} else {
- console.log("Error, Unknown function IriSP." + this.type + "." + _name)
+ console.log("Error, Unknown function IriSP.Widgets" + this.type + "." + _name)
+ }
+}
+
+IriSP.Widgets.Widget.prototype.getFunctionOrName = function(_functionOrName) {
+ switch (typeof _functionOrName) {
+ case "function":
+ return _functionOrName;
+ case "string":
+ return this.functionWrapper(_functionOrName);
+ default:
+ return undefined;
}
}
-IriSP.Widgets.Widget.prototype.bindPopcorn = function(_popcornEvent, _functionName) {
- this.player.popcorn.listen(_popcornEvent, this.functionWrapper(_functionName))
+IriSP.Widgets.Widget.prototype.onMdpEvent = function(_eventName, _functionOrName) {
+ this.player.on(_eventName, this.getFunctionOrName(_functionOrName));
+}
+
+IriSP.Widgets.Widget.prototype.onMediaEvent = function(_eventName, _functionOrName) {
+ if (typeof this.media === "undefined" || typeof this.media.on === "undefined") {
+ console.log("Error on widget "+this.type, this.media);
+ }
+ this.media.on(_eventName, this.getFunctionOrName(_functionOrName));
}
IriSP.Widgets.Widget.prototype.getWidgetAnnotations = function() {
- var _curmedia = this.source.currentMedia;
- return typeof this.annotation_type !== "undefined" && this.annotation_type ? _curmedia.getAnnotationsByTypeTitle(this.annotation_type) : _curmedia.getAnnotations();
+ return typeof this.annotation_type !== "undefined" && this.annotation_type ? this.media.getAnnotationsByTypeTitle(this.annotation_type) : this.media.getAnnotations();
}
IriSP.Widgets.Widget.prototype.getWidgetAnnotationsAtTime = function() {
- var _time = Math.floor(this.player.popcorn.currentTime() * 1000);
+ var _time = this.media.getCurrentTime();
return this.getWidgetAnnotations().filter(function(_annotation) {
return _annotation.begin <= _time && _annotation.end > _time;
});
--- a/src/widgets/Annotation.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Annotation.js Mon Sep 17 00:17:06 2012 +0900
@@ -51,37 +51,36 @@
IriSP.Widgets.Annotation.prototype.draw = function() {
this.renderTemplate();
this.insertSubwidget(this.$.find(".Ldt-Annotation-Social"), "socialWidget", { type: "Social" });
- this.bindPopcorn("timeupdate","onTimeupdate");
- this.bindPopcorn("IriSP.Annotation.hide","hide");
- this.bindPopcorn("IriSP.Annotation.show","show");
- this.bindPopcorn("IriSP.Annotation.minimize","minimize");
- this.bindPopcorn("IriSP.Annotation.maximize","maximize");
- this.bindPopcorn("IriSP.Annotation.getBounds","sendBounds");
+ this.onMediaEvent("timeupdate","onTimeupdate");
+ this.onMdpEvent("Annotation.hide","hide");
+ this.onMdpEvent("Annotation.show","show");
+ this.onMdpEvent("Annotation.minimize","minimize");
+ this.onMdpEvent("Annotation.maximize","maximize");
+ this.onMdpEvent("Annotation.getBounds","sendBounds");
this.$.find(".Ldt-Annotation-MaxMinButton").click(this.functionWrapper("toggleSize"));
this.onTimeupdate();
}
-IriSP.Widgets.Annotation.prototype.onTimeupdate = function() {
- var _time = Math.floor(this.player.popcorn.currentTime() * 1000),
- _list = this.getWidgetAnnotationsAtTime();
+IriSP.Widgets.Annotation.prototype.onTimeupdate = function(_time) {
+ var _list = this.getWidgetAnnotationsAtTime();
if (_list.length) {
if (_list[0].id !== this.lastAnnotation) {
this.drawAnnotation(_list[0]);
this.bounds = [ _list[0].begin.valueOf(), _list[0].end.valueOf() ];
}
- this.player.popcorn.trigger("IriSP.Arrow.updatePosition",{widget: this.type, time: ( _list[0].begin + _list[0].end ) / 2});
+ this.player.trigger("Arrow.updatePosition",{widget: this.type, time: ( _list[0].begin + _list[0].end ) / 2});
}
else {
this.lastAnnotation = false;
this.$.find(".Ldt-Annotation-Inner").addClass("Ldt-Annotation-Empty");
- this.player.popcorn.trigger("IriSP.Arrow.updatePosition",{widget: this.type, time: _time});
+ this.player.trigger("Arrow.updatePosition",{widget: this.type, time: _time});
this.bounds = [ _time, _time ];
}
this.sendBounds();
}
IriSP.Widgets.Annotation.prototype.sendBounds = function() {
- this.player.popcorn.trigger("IriSP.Annotation.boundsChanged",this.bounds);
+ this.player.trigger("Annotation.boundsChanged",this.bounds);
}
IriSP.Widgets.Annotation.prototype.drawAnnotation = function(_annotation) {
@@ -107,7 +106,7 @@
});
this.$.find('.Ldt-Annotation-TagLabel').click(function() {
- _this.player.popcorn.trigger("IriSP.search.triggeredSearch", IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,''));
+ _this.player.trigger("search.triggeredSearch", IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,''));
});
} else {
this.$.find(".Ldt-Annotation-Tags-Block").addClass("Ldt-Annotation-EmptyBlock");
--- a/src/widgets/AnnotationsList.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/AnnotationsList.js Mon Sep 17 00:17:06 2012 +0900
@@ -79,9 +79,9 @@
var _n = this.refresh(true);
if (this.searchString) {
if (_n) {
- this.player.popcorn.trigger("IriSP.search.matchFound");
+ this.player.trigger("search.matchFound");
} else {
- this.player.popcorn.trigger("IriSP.search.noMatchFound");
+ this.player.trigger("search.noMatchFound");
}
}
}
@@ -89,11 +89,8 @@
//obj.url = this.project_url + "/" + media + "/" + annotations[i].meta.project + "/" + annotations[i].meta["id-ref"] + '#id=' + annotations[i].id;
IriSP.Widgets.AnnotationsList.prototype.ajaxSource = function() {
- var _currentTime = this.player.popcorn.currentTime(),
- _duration = this.source.getDuration();
- if (typeof _currentTime == "undefined") {
- _currentTime = 0;
- }
+ var _currentTime = this.media.getCurrentTime(),
+ _duration = this.media.duration;
this.lastAjaxQuery = _currentTime;
_currentTime = Math.floor(1000 * _currentTime);
var _url = Mustache.to_html(this.ajax_url, {
@@ -107,11 +104,8 @@
}
IriSP.Widgets.AnnotationsList.prototype.ajaxMashup = function() {
- var _currentTime = this.player.popcorn.currentTime();
- if (typeof _currentTime == "undefined") {
- _currentTime = 0;
- }
- var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime * 1000);
+ var _currentTime = this.media.getCurrentTime();
+ var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime);
if (typeof _currentAnnotation !== "undefined" && _currentAnnotation.id !== this.lastMashupAnnotation) {
this.lastMashupAnnotation = _currentAnnotation.id;
var _currentMedia = _currentAnnotation.getMedia(),
@@ -132,13 +126,10 @@
return 0;
}
var _this = this,
- _currentTime = this.player.popcorn.currentTime();
- if (typeof _currentTime == "undefined") {
- _currentTime = 0;
- }
+ _currentTime = this.media.getCurrentTime();
var _list = this.annotation_type ? this.currentSource.getAnnotationsByTypeTitle(this.annotation_type) : this.currentSource.getAnnotations();
if (this.mashupMode) {
- var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime * 1000);
+ var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime);
if (typeof _currentAnnotation !== "undefined") {
_currentTime = _currentTime - _currentAnnotation.begin.getSeconds() + _currentAnnotation.annotation.begin.getSeconds();
var _mediaId = _currentAnnotation.getMedia().id;
@@ -246,7 +237,7 @@
});
this.$.find('.Ldt-AnnotationsList-Tag-Li').click(function() {
- _this.player.popcorn.trigger("IriSP.search.triggeredSearch", IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,''));
+ _this.player.trigger("search.triggeredSearch", IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,''));
})
if(this.searchString) {
@@ -276,10 +267,10 @@
this.list_$ = this.$.find(".Ldt-AnnotationsList-ul");
- this.bindPopcorn("IriSP.search", "onSearch");
- this.bindPopcorn("IriSP.search.closed", "onSearch");
- this.bindPopcorn("IriSP.search.cleared", "onSearch");
- this.bindPopcorn("IriSP.AnnotationsList.refresh","refresh");
+ this.onMdpEvent("search", "onSearch");
+ this.onMdpEvent("search.closed", "onSearch");
+ this.onMdpEvent("search.cleared", "onSearch");
+ this.onMdpEvent("AnnotationsList.refresh","refresh");
var _this = this;
@@ -299,14 +290,14 @@
}, this.refresh_interval);
}
+ this.onMdpEvent("createAnnotationWidget.addedAnnotation");
var _events = [
- "IriSP.createAnnotationWidget.addedAnnotation",
"timeupdate",
"seeked",
"loadedmetadata"
];
for (var _i = 0; _i < _events.length; _i++) {
- this.player.popcorn.listen(_events[_i], this.throttledRefresh);
+ this.onMediaEvent(_events[_i], this.throttledRefresh);
}
this.throttledRefresh();
--- a/src/widgets/Arrow.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Arrow.js Mon Sep 17 00:17:06 2012 +0900
@@ -33,9 +33,9 @@
fill: this.fill_url ? ( 'url(' + this.fill_url + ')' ) : this.fill_color
});
this.moveTo(0);
- this.bindPopcorn("IriSP.Arrow.updatePosition","onUpdatePosition");
- this.bindPopcorn("IriSP.Arrow.takeover","onTakeover");
- this.bindPopcorn("IriSP.Arrow.release","onRelease");
+ this.onMdpEvent("Arrow.updatePosition","onUpdatePosition");
+ this.onMdpEvent("Arrow.takeover","onTakeover");
+ this.onMdpEvent("Arrow.release","onRelease");
}
IriSP.Widgets.Arrow.prototype.drawAt = function(_x) {
--- a/src/widgets/Controller.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Controller.js Mon Sep 17 00:17:06 2012 +0900
@@ -87,22 +87,21 @@
this.$volumeBar = this.$.find(".Ldt-Ctrl-Volume-Bar");
// handle events
- this.bindPopcorn("play","playButtonUpdater");
- this.bindPopcorn("pause","playButtonUpdater");
- this.bindPopcorn("volumechange","volumeUpdater");
- this.bindPopcorn("timeupdate","timeDisplayUpdater");
- this.bindPopcorn("loadedmetadata","timeDisplayUpdater");
- this.bindPopcorn("loadedmetadata","volumeUpdater");
- this.bindPopcorn("IriSP.search.matchFound","searchMatch");
- this.bindPopcorn("IriSP.search.noMatchFound","searchNoMatch");
- this.bindPopcorn("IriSP.search.triggeredSearch","triggeredSearch");
- this.bindPopcorn("IriSP.search.cleared","hideSearchBlock");
+ this.onMediaEvent("play","playButtonUpdater");
+ this.onMediaEvent("pause","playButtonUpdater");
+ this.onMediaEvent("volumechange","volumeUpdater");
+ this.onMediaEvent("timeupdate","timeDisplayUpdater");
+ this.onMediaEvent("loadedmetadata","volumeUpdater");
+ this.onMdpEvent("search.matchFound","searchMatch");
+ this.onMdpEvent("search.noMatchFound","searchNoMatch");
+ this.onMdpEvent("search.triggeredSearch","triggeredSearch");
+ this.onMdpEvent("search.cleared","hideSearchBlock");
// handle clicks
this.$playButton.click(this.functionWrapper("playHandler"));
this.$.find(".Ldt-Ctrl-Annotate").click(function() {
- _this.player.popcorn.trigger("IriSP.CreateAnnotation.toggle");
+ _this.player.trigger("CreateAnnotation.toggle");
});
this.$.find(".Ldt-Ctrl-SearchBtn").click(this.functionWrapper("searchButtonHandler"));
@@ -143,7 +142,7 @@
this.$volumeBar.slider({
slide: function(event, ui) {
_this.$volumeBar.attr("title",_this.l10n.volume+': ' + ui.value + '%');
- _this.player.popcorn.volume(ui.value / 100);
+ _this.media.setVolume(ui.value / 100);
},
stop: this.functionWrapper("volumeUpdater")
});
@@ -151,33 +150,27 @@
// trigger an IriSP.Player.MouseOver to the widgets that are interested (i.e : sliderWidget)
this.$.hover(
function() {
- _this.player.popcorn.trigger("IriSP.Player.MouseOver");
+ _this.player.trigger("Player.MouseOver");
},
function() {
- _this.player.popcorn.trigger("IriSP.Player.MouseOut");
+ _this.player.trigger("Player.MouseOut");
});
+
+ this.timeDisplayUpdater(0);
/* some players - including jwplayer - save the state of the mute button between sessions */
-
+ //TODO: MOVE TO THE PLAYER/
window.setTimeout(this.functionWrapper("volumeUpdater"), 1000);
};
/* Update the elasped time div */
-IriSP.Widgets.Controller.prototype.timeDisplayUpdater = function() {
- var _curTime = this.player.popcorn.roundTime();
- if (typeof this._previousSecond !== "undefined" && _curTime === this._previousSecond) {
- return;
- }
+IriSP.Widgets.Controller.prototype.timeDisplayUpdater = function(_time) {
// we get it at each call because it may change.
- var _totalTime = this.source.getDuration(),
- _elapsedTime = new IriSP.Model.Time();
+ var _totalTime = this.media.duration;
- _elapsedTime.setSeconds(_curTime);
-
- this.$.find(".Ldt-Ctrl-Time-Elapsed").html(_elapsedTime.toString());
+ this.$.find(".Ldt-Ctrl-Time-Elapsed").html(_time.toString());
this.$.find(".Ldt-Ctrl-Time-Total").html(_totalTime.toString());
- this._previousSecond = _curTime;
};
/* update the icon of the button - separate function from playHandler
@@ -185,10 +178,7 @@
the jwplayer window) we have to change the icon without playing/pausing
*/
IriSP.Widgets.Controller.prototype.playButtonUpdater = function() {
-
- var status = this.player.popcorn.media.paused;
-
- if (status) {
+ if (this.media.getPaused()) {
/* the background sprite is changed by adding/removing the correct classes */
this.$playButton
.attr("title", this.l10n.play)
@@ -204,23 +194,24 @@
IriSP.Widgets.Controller.prototype.playHandler = function() {
-
- var status = this.player.popcorn.media.paused;
-
- if (status) {
- this.player.popcorn.play();
+ if (this.media.getPaused()) {
+ this.media.play();
} else {
- this.player.popcorn.pause();
+ this.media.pause();
}
};
IriSP.Widgets.Controller.prototype.muteHandler = function() {
- this.player.popcorn.muted(!this.player.popcorn.muted());
+ if (this.media.getMuted()) {
+ this.media.unmute();
+ } else {
+ this.media.mute();
+ }
};
IriSP.Widgets.Controller.prototype.volumeUpdater = function() {
- var _muted = this.player.popcorn.muted(),
- _vol = this.player.popcorn.volume();
+ var _muted = this.media.getMuted(),
+ _vol = this.media.getVolume();
if (_vol === false) {
_vol = .5;
}
@@ -249,13 +240,13 @@
this._positiveMatch = false;
// tell the world the field is open
- this.player.popcorn.trigger("IriSP.search.open");
+ this.player.trigger("search.open");
};
IriSP.Widgets.Controller.prototype.hideSearchBlock = function() {
this.$searchBlock.animate( { width: 0 }, 200);
this._positiveMatch = false;
- this.player.popcorn.trigger("IriSP.search.closed");
+ this.player.trigger("search.closed");
};
/** react to clicks on the search button */
@@ -264,7 +255,7 @@
this.showSearchBlock();
var _val = this.$searchInput.val();
if (_val) {
- this.player.popcorn.trigger("IriSP.search", _val); // trigger the search to make it more natural.
+ this.player.trigger("search", _val); // trigger the search to make it more natural.
}
} else {
this.hideSearchBlock();
@@ -284,9 +275,9 @@
// do nothing if the search field is empty, instead of highlighting everything.
if (_val !== this.lastSearchValue) {
if (_val) {
- this.player.popcorn.trigger("IriSP.search", _val);
+ this.player.trigger("search", _val);
} else {
- this.player.popcorn.trigger("IriSP.search.cleared");
+ this.player.trigger("search.cleared");
this.$searchInput.css('background-color','');
}
}
@@ -314,7 +305,7 @@
IriSP.Widgets.Controller.prototype.triggeredSearch = function(searchString) {
this.showSearchBlock();
this.$searchInput.attr('value', searchString);
- this.player.popcorn.trigger("IriSP.search", searchString); // trigger the search to make it more natural.
+ this.player.trigger("search", searchString); // trigger the search to make it more natural.
};
--- a/src/widgets/CreateAnnotation.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/CreateAnnotation.js Mon Sep 17 00:17:06 2012 +0900
@@ -163,8 +163,8 @@
this.hide();
}
- this.bindPopcorn("IriSP.CreateAnnotation.toggle","toggle");
- this.bindPopcorn("IriSP.Slice.boundsChanged","onBoundsChanged");
+ this.onMdpEvent("CreateAnnotation.toggle","toggle");
+ this.onMdpEvent("Slice.boundsChanged","onBoundsChanged");
this.begin = new IriSP.Model.Time();
this.end = this.source.getDuration();
this.$.find("form").submit(this.functionWrapper("onSubmit"));
@@ -188,9 +188,9 @@
this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").removeClass("selected");
this.$.slideDown();
if (this.minimize_annotation_widget) {
- this.player.popcorn.trigger("IriSP.Annotation.minimize");
+ this.player.trigger("Annotation.minimize");
}
- this.player.popcorn.trigger("IriSP.Slice.show");
+ this.player.trigger("Slice.show");
}
IriSP.Widgets.CreateAnnotation.prototype.hide = function() {
@@ -198,9 +198,9 @@
this.visible = false;
this.$.slideUp();
if (this.minimize_annotation_widget) {
- this.player.popcorn.trigger("IriSP.Annotation.maximize");
+ this.player.trigger("Annotation.maximize");
}
- this.player.popcorn.trigger("IriSP.Slice.hide");
+ this.player.trigger("Slice.hide");
}
}
@@ -234,8 +234,8 @@
}
IriSP.Widgets.CreateAnnotation.prototype.pauseOnWrite = function() {
- if (this.pause_on_write && !this.player.popcorn.media.paused) {
- this.player.popcorn.pause();
+ if (this.pause_on_write && !this.media.getPaused()) {
+ this.media.pause();
}
}
@@ -344,10 +344,10 @@
_export.getAnnotations().removeElement(_annotation, true); /* Pour éviter les doublons, on supprime l'annotation qui a été envoyée */
_export.deSerialize(_data); /* On désérialise les données reçues pour les réinjecter */
_this.source.merge(_export); /* On récupère les données réimportées dans l'espace global des données */
- if (_this.pause_on_write && _this.player.popcorn.media.paused) {
- _this.player.popcorn.play();
+ if (_this.pause_on_write && _this.media.getPaused()) {
+ _this.media.play();
}
- _this.player.popcorn.trigger("IriSP.AnnotationsList.refresh"); /* On force le rafraîchissement du widget AnnotationsList */
+ _this.player.trigger("AnnotationsList.refresh"); /* On force le rafraîchissement du widget AnnotationsList */
},
error: function(_xhr, _error, _thrown) {
IriSP.log("Error when sending annotation", _thrown);
--- a/src/widgets/MediaList.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/MediaList.js Mon Sep 17 00:17:06 2012 +0900
@@ -49,15 +49,15 @@
var _n = this.refresh(true);
if (this.searchString) {
if (_n) {
- this.player.popcorn.trigger("IriSP.search.matchFound");
+ this.player.trigger("search.matchFound");
} else {
- this.player.popcorn.trigger("IriSP.search.noMatchFound");
+ this.player.trigger("search.noMatchFound");
}
}
}
IriSP.Widgets.MediaList.prototype.draw = function() {
- this.bindPopcorn("timeupdate","onTimeupdate");
+ this.onMediaEvent("timeupdate","onTimeupdate");
this.$.addClass("Ldt-MediaListWidget")
this.renderTemplate();
this.redraw();
@@ -124,10 +124,10 @@
}
};
-IriSP.Widgets.MediaList.prototype.onTimeupdate = function() {
+IriSP.Widgets.MediaList.prototype.onTimeupdate = function(_time) {
var _media = this.source.currentMedia;
if (_media.elementType === "mashup") {
- _media = _media.getMediaAtTime(this.player.popcorn.currentTime() * 1000);
+ _media = _media.getMediaAtTime(_time);
}
if (typeof _media !== "undefined" && _media.id !== this.lastMedia) {
this.lastMedia = _media.id;
--- a/src/widgets/Mediafragment.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Mediafragment.js Mon Sep 17 00:17:06 2012 +0900
@@ -10,15 +10,15 @@
}
})
};
- this.bindPopcorn("pause","setHashToTime");
- this.bindPopcorn("seeked","setHashToTime");
- this.bindPopcorn("IriSP.Mediafragment.setHashToAnnotation","setHashToAnnotation");
+ this.onMdpEvent("Mediafragment.setHashToAnnotation","setHashToAnnotation");
this.blocked = false;
}
IriSP.Widgets.Mediafragment.prototype = new IriSP.Widgets.Widget();
IriSP.Widgets.Mediafragment.prototype.draw = function() {
+ this.onMediaEvent("pause","setHashToTime");
+ this.onMediaEvent("seeked","setHashToTime");
this.goToHash();
}
@@ -52,11 +52,11 @@
if (this.last_hash_key == "id") {
var _annotation = this.source.getElement(this.last_hash_value);
if (typeof _annotation !== "undefined") {
- this.player.popcorn.currentTime(_annotation.begin.getSeconds());
+ this.media.setCurrentTime(_annotation.begin);
}
}
if (this.last_hash_key == "t") {
- this.player.popcorn.currentTime(this.last_hash_value);
+ this.media.setCurrentTime(1000*this.last_hash_value);
}
break;
}
@@ -68,10 +68,8 @@
this.setHash( 'id', _annotationId );
}
-IriSP.Widgets.Mediafragment.prototype.setHashToTime = function(_time) {
- if (_time !== NaN) {
- this.setHash( 't', this.player.popcorn.currentTime() );
- }
+IriSP.Widgets.Mediafragment.prototype.setHashToTime = function() {
+ this.setHash( 't', this.media.getCurrentTime().getSeconds() );
}
IriSP.Widgets.Mediafragment.prototype.setHash = function(_key, _value) {
@@ -100,5 +98,5 @@
window.clearTimeout(this.blockTimeout);
}
this.blocked = true;
- this.blockTimeout = window.setTimeout(this.functionWrapper("unblock"), 1000);
+ this.blockTimeout = window.setTimeout(this.functionWrapper("unblock"), 1500);
}
--- a/src/widgets/Polemic.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Polemic.js Mon Sep 17 00:17:06 2012 +0900
@@ -76,16 +76,16 @@
});
if (this.searchString) {
if (_found) {
- this.player.popcorn.trigger("IriSP.search.matchFound");
+ this.player.trigger("search.matchFound");
} else {
- this.player.popcorn.trigger("IriSP.search.noMatchFound");
+ this.player.trigger("search.noMatchFound");
}
}
}
IriSP.Widgets.Polemic.prototype.draw = function() {
- this.bindPopcorn("timeupdate", "onTimeupdate");
+ this.onMediaEvent("timeupdate", "onTimeupdate");
this.$zone = IriSP.jQuery('<div>');
this.$zone.addClass("Ldt-Polemic");
this.$.append(this.$zone);
@@ -168,8 +168,8 @@
}).mouseout(function() {
_annotation.trigger("unselect");
}).click(function() {
- _this.player.popcorn.trigger("IriSP.Mediafragment.setHashToAnnotation", _annotation.id);
- _this.player.popcorn.trigger("IriSP.Tweet.show", _annotation.id);
+ _this.player.trigger("Mediafragment.setHashToAnnotation", _annotation.id);
+ _this.player.trigger("Tweet.show", _annotation.id);
});
_annotation.on("select", function() {
_this.tooltip.show(
@@ -214,9 +214,9 @@
this.$tweets = this.$.find(".Ldt-Polemic-TweetDiv");
- this.bindPopcorn("IriSP.search", "onSearch");
- this.bindPopcorn("IriSP.search.closed", "onSearch");
- this.bindPopcorn("IriSP.search.cleared", "onSearch");
+ this.onMdpEvent("search", "onSearch");
+ this.onMdpEvent("search.closed", "onSearch");
+ this.onMdpEvent("search.cleared", "onSearch");
} else {
this.$zone.hide();
@@ -303,7 +303,7 @@
this.$zone.click(function(_e) {
var _x = _e.pageX - _this.$zone.offset().left;
- _this.player.popcorn.currentTime(_this.source.getDuration().getSeconds() * _x / _this.width);
+ _this.media.setCurrentTime(_this.media.duration * _x / _this.width);
});
this.$.append('<div class="Ldt-Polemic-Tooltip"></div>');
@@ -311,8 +311,8 @@
this.insertSubwidget(this.$.find(".Ldt-Polemic-Tooltip"), "tooltip", { type: "Tooltip" });
}
-IriSP.Widgets.Polemic.prototype.onTimeupdate = function() {
- var _x = Math.floor( this.width * this.player.popcorn.currentTime() / this.source.getDuration().getSeconds());
+IriSP.Widgets.Polemic.prototype.onTimeupdate = function(_time) {
+ var _x = Math.floor( this.width * _time / this.media.duration);
this.$elapsed.css({
width: _x + "px"
});
--- a/src/widgets/Renkan.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Renkan.js Mon Sep 17 00:17:06 2012 +0900
@@ -82,27 +82,26 @@
}
});
_node.on("click", function() {
- _this.player.popcorn.currentTime(_ann.begin.getSeconds());
- _this.player.popcorn.trigger("IriSP.Mediafragment.setHashToAnnotation", _ann.id);
+ _this.media.setCurrentTime(_ann.begin);
+ _this.player.trigger("Mediafragment.setHashToAnnotation", _ann.id);
});
});
}
var _tagmatch = _uri.match(_this.tag_regexp);
if (_tagmatch) {
_node.on("select", function() {
- _this.player.popcorn.trigger("IriSP.search.triggeredSearch",_tagmatch[1]);
+ _this.player.trigger("search.triggeredSearch",_tagmatch[1]);
})
_node.on("unselect", function() {
- _this.player.popcorn.trigger("IriSP.search.cleared");
+ _this.player.trigger("search.cleared");
})
}
});
})
- this.bindPopcorn("timeupdate","onTimeupdate");
+ this.onMediaEvent("timeupdate","onTimeupdate");
}
-IriSP.Widgets.Renkan.prototype.onTimeupdate = function() {
- var _time = 1000 * this.player.popcorn.currentTime();
+IriSP.Widgets.Renkan.prototype.onTimeupdate = function(_time) {
IriSP._(this.node_times).each(function(_nt) {
if (_nt.begin <= _time && _nt.end >= _time) {
if (!_nt.selected) {
--- a/src/widgets/Segments.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Segments.js Mon Sep 17 00:17:06 2012 +0900
@@ -23,10 +23,10 @@
IriSP.Widgets.Segments.prototype.draw = function() {
- this.bindPopcorn("IriSP.search", "onSearch");
- this.bindPopcorn("IriSP.search.closed", "onSearch");
- this.bindPopcorn("IriSP.search.cleared", "onSearch");
- this.bindPopcorn("timeupdate", "onTimeupdate");
+ this.onMdpEvent("search", "onSearch");
+ this.onMdpEvent("search.closed", "onSearch");
+ this.onMdpEvent("search.cleared", "onSearch");
+ this.onMediaEvent("timeupdate", "onTimeupdate");
this.renderTemplate();
@@ -44,8 +44,7 @@
var _left = _annotation.begin * _scale,
_width = ( _annotation.getDuration() ) * _scale,
_center = Math.floor( _left + _width / 2 ),
- _fulltext = _annotation.title + ( _annotation.description ? ( '<br/>' + _annotation.description ) : '' ),
- _beginseconds = _annotation.begin.getSeconds();
+ _fulltext = _annotation.title + ( _annotation.description ? ( '<br/>' + _annotation.description ) : '' );
var _data = {
color : ( typeof _annotation.color !== "undefined" && _annotation.color ? _annotation.color : _this.colors[_k % _this.colors.length] ),
text: _fulltext.replace(/(\n|\r|\r\n)/mg,' ').replace(/(^.{120,140})[\s].+$/m,'$1…'),
@@ -63,8 +62,8 @@
_annotation.trigger("unselect");
})
.click(function() {
- _this.player.popcorn.currentTime(_beginseconds);
- _this.player.popcorn.trigger("IriSP.Mediafragment.setHashToAnnotation", _data.id);
+ _this.media.setCurrentTime(_annotation.begin);
+ _this.player.trigger("Mediafragment.setHashToAnnotation", _data.id);
})
.appendTo(_this.list_$)
_annotation.on("select", function() {
@@ -96,17 +95,17 @@
}
});
if (_found) {
- this.player.popcorn.trigger("IriSP.search.matchFound");
+ this.player.trigger("search.matchFound");
} else {
- this.player.popcorn.trigger("IriSP.search.noMatchFound");
+ this.player.trigger("search.noMatchFound");
}
} else {
this.$segments.removeClass("found unfound");
}
}
-IriSP.Widgets.Segments.prototype.onTimeupdate = function() {
- var _x = Math.floor( this.width * this.player.popcorn.currentTime() / this.source.getDuration().getSeconds());
+IriSP.Widgets.Segments.prototype.onTimeupdate = function(_time) {
+ var _x = Math.floor( this.width * _time / this.media.duration);
this.$.find('.Ldt-Segments-Position').css({
left: _x + "px"
})
--- a/src/widgets/Slice.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Slice.js Mon Sep 17 00:17:06 2012 +0900
@@ -40,28 +40,28 @@
min: 0,
max: this.max,
change: function(event, ui) {
- _this.player.popcorn.trigger("IriSP.Arrow.updatePosition",{
+ _this.player.trigger("Arrow.updatePosition",{
widget:_this.type,
time:Math.floor((ui.values[0]+ui.values[1])/2)
});
- _this.player.popcorn.trigger("IriSP.Slice.boundsChanged",[ui.values[0], ui.values[1]]);
+ _this.player.trigger("Slice.boundsChanged",[ui.values[0], ui.values[1]]);
},
start: function() {
_this.sliding = true;
- if (!_this.player.popcorn.media.paused) {
- _this.player.popcorn.pause();
+ if (!_this.media.getPaused) {
+ _this.media.pause();
}
- _currentTime = _this.player.popcorn.currentTime();
+ _currentTime = _this.media.getCurrentTime();
},
slide: function(event, ui) {
if (!_this.override_bounds && (ui.value < _this.min || ui.value > _this.max)) {
return false;
}
- _this.player.popcorn.currentTime(ui.value / 1000);
+ _this.media.setCurrentTime(ui.value);
},
stop: function() {
_this.sliding = false;
- _this.player.popcorn.currentTime(_currentTime);
+ _this.media.setCurrentTime(_currentTime);
}
});
this.$slider.find(".ui-slider-handle:first").addClass("Ldt-Slice-left-handle");
@@ -71,25 +71,25 @@
} else {
this.hide();
}
- this.bindPopcorn("IriSP.Slice.show","show");
- this.bindPopcorn("IriSP.Slice.hide","hide");
- this.bindPopcorn("IriSP.Annotation.boundsChanged","storeBounds");
- this.player.popcorn.trigger("IriSP.Annotation.getBounds");
+ this.onMdpEvent("Slice.show","show");
+ this.onMdpEvent("Slice.hide","hide");
+ this.onMdpEvent("Annotation.boundsChanged","storeBounds");
+ this.player.trigger("Annotation.getBounds");
};
IriSP.Widgets.Slice.prototype.show = function() {
this.$slider.show();
- this.player.popcorn.trigger("IriSP.Arrow.takeover",this.type);
+ this.player.trigger("Arrow.takeover",this.type);
this.$slider.slider("values", [this.min, this.max]);
}
IriSP.Widgets.Slice.prototype.hide = function() {
this.$slider.hide();
- this.player.popcorn.trigger("IriSP.Arrow.release");
+ this.player.trigger("Arrow.release");
}
IriSP.Widgets.Slice.prototype.storeBounds = function(_values) {
- if (!this.player.popcorn.media.paused && (this.min != _values[0] || this.max != _values[1])) {
+ if (!this.media.getPaused() && (this.min != _values[0] || this.max != _values[1])) {
this.min = _values[0];
this.max = _values[1];
if (this.live_update && !this.sliding) {
--- a/src/widgets/Slider.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Slider.js Mon Sep 17 00:17:06 2012 +0900
@@ -30,16 +30,16 @@
min: 0,
max: this.source.getDuration().milliseconds,
slide: function(event, ui) {
- _this.player.popcorn.currentTime(ui.value / 1000);
- _this.player.popcorn.trigger("IriSP.Mediafragment.setHashToTime");
+ _this.media.setCurrentTime(ui.value);
+ _this.player.trigger("Mediafragment.setHashToTime");
}
});
this.$handle = this.$slider.find('.ui-slider-handle');
- this.bindPopcorn("timeupdate","onTimeupdate");
- this.bindPopcorn("IriSP.PlayerWidget.MouseOver","onMouseover");
- this.bindPopcorn("IriSP.PlayerWidget.MouseOut","onMouseout");
+ this.onMediaEvent("timeupdate","onTimeupdate");
+ this.onMdpEvent("PlayerWidget.MouseOver","onMouseover");
+ this.onMdpEvent("PlayerWidget.MouseOut","onMouseout");
if (this.minimize_timeout) {
this.$slider.css(this.calculateSliderCss(this.minimized_height));
@@ -54,10 +54,9 @@
}
};
-IriSP.Widgets.Slider.prototype.onTimeupdate = function() {
- var _time = 1000 * this.player.popcorn.currentTime();
+IriSP.Widgets.Slider.prototype.onTimeupdate = function(_time) {
this.$slider.slider("value",_time);
- this.player.popcorn.trigger("IriSP.Arrow.updatePosition",{widget: this.type, time: _time});
+ this.player.trigger("Arrow.updatePosition",{widget: this.type, time: _time});
}
IriSP.Widgets.Slider.prototype.onMouseover = function() {
--- a/src/widgets/Slideshare.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Slideshare.js Mon Sep 17 00:17:06 2012 +0900
@@ -42,12 +42,12 @@
} else {
this.renderTemplate();
this.$container = this.$.find(".Ldt-SlideShare-Container");
- this.bindPopcorn("timeupdate","onTimeupdate");
- this.onTimeupdate();
+ this.onMediaEvent("timeupdate","onTimeupdate");
+ this.onTimeupdate(0);
}
}
-IriSP.Widgets.Slideshare.prototype.onTimeupdate = function() {
+IriSP.Widgets.Slideshare.prototype.onTimeupdate = function(_time) {
var _list = this.getWidgetAnnotationsAtTime();
if (_list.length) {
var _description = _list[0].description,
--- a/src/widgets/Sparkline.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Sparkline.js Mon Sep 17 00:17:06 2012 +0900
@@ -1,6 +1,5 @@
IriSP.Widgets.Sparkline = function(player, config) {
IriSP.Widgets.Widget.call(this, player, config);
- //this.bindPopcorn("timeupdate", "onTimeupdate");
};
IriSP.Widgets.Sparkline.prototype = new IriSP.Widgets.Widget();
@@ -68,14 +67,14 @@
this.$.click(function(_e) {
var _x = _e.pageX - _this.$.offset().left;
- _this.player.popcorn.currentTime(_this.source.getDuration().getSeconds() * _x / _this.width);
+ _this.media.setCurrentTime(_this.media.duration * _x / _this.width);
});
- this.bindPopcorn("timeupdate","onTimeupdate");
+ this.onMediaEvent("timeupdate","onTimeupdate");
}
-IriSP.Widgets.Sparkline.prototype.onTimeupdate = function() {
- var _x = Math.floor( this.width * this.player.popcorn.currentTime() / this.source.getDuration().getSeconds());
+IriSP.Widgets.Sparkline.prototype.onTimeupdate = function(_time) {
+ var _x = Math.floor( this.width * _time / this.media.duration);
this.rectangleProgress.attr({
"width" : _x
});
--- a/src/widgets/Tagcloud.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Tagcloud.js Mon Sep 17 00:17:06 2012 +0900
@@ -39,20 +39,19 @@
}
IriSP.Widgets.Tagcloud.prototype.draw = function() {
- this.bindPopcorn("IriSP.search", "onSearch");
- this.bindPopcorn("IriSP.search.closed", "onSearch");
- this.bindPopcorn("IriSP.search.cleared", "onSearch");
+ this.onMdpEvent("search", "onSearch");
+ this.onMdpEvent("search.closed", "onSearch");
+ this.onMdpEvent("search.cleared", "onSearch");
if (this.segment_annotation_type) {
- this.bindPopcorn("timeupdate","onTimeupdate");
+ this.onMediaEvent("timeupdate","onTimeupdate");
} else {
this.redraw();
}
}
-IriSP.Widgets.Tagcloud.prototype.onTimeupdate = function() {
- var _time = Math.floor(this.player.popcorn.currentTime() * 1000),
- _list = this.source.getAnnotationsByTypeTitle(this.segment_annotation_type).filter(function(_annotation) {
+IriSP.Widgets.Tagcloud.prototype.onTimeupdate = function(_time) {
+ var _list = this.source.getAnnotationsByTypeTitle(this.segment_annotation_type).filter(function(_annotation) {
return _annotation.begin <= _time && _annotation.end > _time;
});
if (_list.length) {
@@ -117,7 +116,7 @@
this.$.html(Mustache.to_html(this.template, {words: _words }));
this.$.find(".Ldt-Tagcloud-item").click(function() {
var _txt = IriSP.jQuery(this).attr("content");
- _this.player.popcorn.trigger("IriSP.search.triggeredSearch", _txt);
+ _this.player.trigger("search.triggeredSearch", _txt);
});
}
--- a/src/widgets/Tagger.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Tagger.js Mon Sep 17 00:17:06 2012 +0900
@@ -130,7 +130,7 @@
_this.player.popcorn.play();
}
/* On force le rafraîchissement du widget AnnotationsList */
- _this.player.popcorn.trigger("IriSP.AnnotationsList.refresh");
+ _this.player.trigger("AnnotationsList.refresh");
},
error: function(_xhr, _error, _thrown) {
console.log("Error when sending annotation", _thrown);
--- a/src/widgets/Tooltip.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Tooltip.js Mon Sep 17 00:17:06 2012 +0900
@@ -1,6 +1,6 @@
/* this widget displays a small tooltip */
-IriSP.Widgets.Tooltip = function(Popcorn, config, Serializer) {
- IriSP.Widgets.Widget.call(this, Popcorn, config, Serializer);
+IriSP.Widgets.Tooltip = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
};
IriSP.Widgets.Tooltip.prototype = new IriSP.Widgets.Widget();
--- a/src/widgets/Trace.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Trace.js Mon Sep 17 00:17:06 2012 +0900
@@ -22,15 +22,17 @@
return;
}
var _this = this,
- _listeners = {
- "IriSP.search.open" : 0,
- "IriSP.search.closed" : 0,
- "IriSP.search" : 0,
- "IriSP.search.cleared" : 0,
- "IriSP.search.matchFound" : 0,
- "IriSP.search.noMatchFound" : 0,
- "IriSP.search.triggeredSearch" : 0,
- "IriSP.TraceWidget.MouseEvents" : 0,
+ _mdplisteners = {
+ "search.open" : 0,
+ "search.closed" : 0,
+ "search" : 0,
+ "search.cleared" : 0,
+ "search.matchFound" : 0,
+ "search.noMatchFound" : 0,
+ "search.triggeredSearch" : 0,
+ "TraceWidget.MouseEvents" : 0
+ }
+ _medialisteners = {
"play" : 0,
"pause" : 0,
"volumechange" : 0,
@@ -39,14 +41,23 @@
"pause" : 0,
"timeupdate" : 2000
};
- IriSP._(_listeners).each(function(_ms, _listener) {
+ IriSP._(_mdplisteners).each(function(_ms, _listener) {
var _f = function(_arg) {
_this.eventHandler(_listener, _arg);
}
if (_ms) {
_f = IriSP._.throttle(_f, _ms);
}
- _this.player.popcorn.listen(_listener, _f);
+ _this.onMdpEvent(_listener, _f);
+ });
+ IriSP._(_medialisteners).each(function(_ms, _listener) {
+ var _f = function(_arg) {
+ _this.eventHandler(_listener, _arg);
+ }
+ if (_ms) {
+ _f = IriSP._.throttle(_f, _ms);
+ }
+ _this.media.on(_listener, _f);
});
if (!this.tracer) {
@@ -91,7 +102,7 @@
switch(_e.type) {
case "mouseover":
if (_this.lastTarget != _lastTarget) {
- _this.player.popcorn.trigger('IriSP.TraceWidget.MouseEvents', _data);
+ _this.player.trigger('TraceWidget.MouseEvents', _data);
} else {
if (typeof _this.moTimeout != "undefined") {
clearTimeout(_this.moTimeout);
@@ -105,12 +116,12 @@
}
_this.moTimeout = setTimeout(function() {
if (_lastTarget != _this.lastTarget) {
- _this.player.popcorn.trigger('IriSP.TraceWidget.MouseEvents', _data);
+ _this.player.trigger('TraceWidget.MouseEvents', _data);
}
},100);
break;
default:
- _this.player.popcorn.trigger('IriSP.TraceWidget.MouseEvents', _data);
+ _this.player.trigger('TraceWidget.MouseEvents', _data);
}
_this.lastTarget = _lastTarget;
});
@@ -133,13 +144,13 @@
case 'timeupdate':
case 'play':
case 'pause':
- _arg.time = this.player.popcorn.currentTime() * 1000;
+ _arg.time = this.player.getCurrentTime().milliseconds;
case 'seeked':
case 'volumechange':
- _traceName += 'Popcorn_' + _listener;
+ _traceName += 'media_' + _listener;
break;
default:
- _traceName += _listener.replace('IriSP.','').replace('.','_');
+ _traceName += _listener.replace('.','_');
}
this.lastEvent = _traceName;
if (typeof this.extend === "object" && this.extend) {
--- a/src/widgets/Tweet.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Tweet.js Mon Sep 17 00:17:06 2012 +0900
@@ -66,7 +66,7 @@
IriSP.Widgets.Tweet.prototype.draw = function() {
this.renderTemplate();
- this.bindPopcorn("IriSP.Tweet.show","show");
+ this.onMdpEvent("Tweet.show","show");
this.pinned = this.pin_at_start;
var _this = this;
this.$.find(".Ldt-Tweet-Pin").click(function() {
@@ -170,7 +170,7 @@
this.$.find(".Ldt-Tweet-Retweet").attr("href", "https://twitter.com/intent/retweet?tweet_id=" + _tweet.source.id_str);
this.$.find(".Ldt-Tweet-Reply").attr("href", "https://twitter.com/intent/tweet?in_reply_to=" + _tweet.source.id_str);
this.$.find(".Ldt-Tweet-Original").attr("href", "https://twitter.com/" + _tweet.source.user.screen_name + "/status/" + _tweet.source.id_str);
- this.player.popcorn.trigger("IriSP.Annotation.minimize");
+ this.player.trigger("Annotation.minimize");
this.$.slideDown();
this.cancelTimeout();
if (!this.pinned) {
@@ -182,7 +182,7 @@
}
IriSP.Widgets.Tweet.prototype.hide = function() {
- this.player.popcorn.trigger("IriSP.Annotation.maximize");
+ this.player.trigger("Annotation.maximize");
this.$.slideUp();
this.cancelTimeout();
}
--- a/test/oggvideo.htm Fri Sep 14 10:38:04 2012 +0900
+++ b/test/oggvideo.htm Mon Sep 17 00:17:06 2012 +0900
@@ -15,7 +15,51 @@
<div id="LdtPlayer"></div>
<div id="AnnotationsListContainer"></div>
<script type="text/javascript">
- testConfig('json/ldt-ogv.json', true);
+IriSP.libFiles.defaultDir = "libs/";
+IriSP.widgetsDir = "metadataplayer";
+var _metadata = {
+ url: "json/ldt-ogv.json",
+ format: 'ldt'
+};
+var _config = {
+ gui: {
+ width : 620,
+ container : 'LdtPlayer',
+ default_options: {
+ metadata: _metadata
+ },
+ css : 'metadataplayer/LdtPlayer-core.css',
+ widgets: [
+ { type: "PopcornPlayer"},
+ { type: "Sparkline" },
+ { type: "Slider" },
+ { type: "Controller" },
+ { type: "Polemic" },
+ { type: "Segments" },
+ { type: "Slice" },
+ { type: "Arrow" },
+ { type: "Annotation" },
+ { type: "CreateAnnotation" },
+ { type: "Tweet" },
+ { type: "Tagcloud" },
+ {
+ type: "AnnotationsList",
+ container: "AnnotationsListContainer"
+ },
+ { type: "Mediafragment"}
+ ]
+ },
+ player:{
+ type:'auto',
+ live: true,
+ height: 350,
+ width: 620,
+ provider: "rtmp",
+ autostart: true,
+ metadata: _metadata
+ }
+};
+_myPlayer = new IriSP.Metadataplayer(_config);
</script>
</body>
</html>