--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html Wed Sep 19 01:53:14 2012 +0900
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html Wed Sep 19 15:03:51 2012 +0900
@@ -18,94 +18,90 @@
url: '{{ json_url }}',
format: 'ldt'
};
-var _config = {
- gui: {
- width: '{{ player_width }}',
- container: '{{ player_id }}_embed',
- css: '{{WEB_URL}}{{LDT_MEDIA_PREFIX}}metadataplayer/LdtPlayer-core.css',
- default_options: {
- metadata: _metadata
+var _config = {
+ width: '{{ player_width }}',
+ container: '{{ player_id }}_embed',
+ css: '{{WEB_URL}}{{LDT_MEDIA_PREFIX}}metadataplayer/LdtPlayer-core.css',
+ default_options: {
+ metadata: _metadata
+ },
+ widgets: [
+ {
+ {% if external_url %}
+ type: "AutoPlayer",
+ video: "{{ external_url }}",
+ {% else %}
+ type: "JwpPlayer",
+ streamer: function(_url) {
+ var _matches = _url.match(/^[^\/]+\/\/[^\/]+\/[^\/]+\//);
+ if (_matches) {
+ return _matches[0];
+ } else {
+ return _url;
+ }
+ },
+ live: true,
+ provider: "rtmp",
+ {% endif %}
+ height: 300,
+ autostart: true
},
- widgets: [
- {
- type: "Polemic"
- },{
- type: "Sparkline"
- },{
- type: "Slider"
- },{
- type: "AnnotationsList",
- container: "AnnotationsList_ext",
- ajax_url: "{% url segment_api_empty %}{% templatetag openvariable %}media{% templatetag closevariable %}/{% templatetag openvariable %}begin{% templatetag closevariable %}/{% templatetag openvariable %}end{% templatetag closevariable %}",
- ajax_granularity : 300000,
- default_thumbnail : "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}css/imgs/video_sequence.png"
- },{
- type: "Controller"
- },{
- type: "Segments",
- annotation_type: ["chap","découpage"]
- },{
- type: "Slice",
- start_visible : false,
- live_update : true
- },{
- type: "Arrow",
- base_height: 3
- },{
- type: "Annotation",
- start_minimized: true,
- site_name : "Lignes de Temps",
- annotation_type: ["chap","découpage"]
- },{
- type: "Tweet",
- hide_timeout: 5000
- },{
- type: "CreateAnnotation",
- api_endpoint_template: "{% url annotation_api_empty %}{% templatetag openvariable %}id{% templatetag closevariable %}.json",
- api_method: "PUT",
- after_send_timeout: 8000,
- close_after_send: false,
- tag_titles: ["#amateur", "#digital-humanities"],
- creator_name: '{{request.user.username}}',
- creator_avatar: '{% thumbnail request.user.get_profile.image "48x48" format="PNG" crop="center" as im %}{{WEB_URL}}{{ im.url }}{% endthumbnail %}' || "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png"
- },{
- type: "Slideshare",
- container: "Slideshare_ext",
- embed_width: 400,
- embed_height: 334,
- annotation_type: "slide"
- },{
- type: "Mediafragment"
- },{
- type: "Social",
- container: "Social_ext",
- url: document.location.href.replace(/#.*$/,""),
- text: document.title
- }
- ]
- },
- player: {
- {% if external_url %}
- video: '{{ external_url }}',
- type: 'auto',
- {% else %}
- streamer: function(_url) {
- var _matches = _url.match(/^[^\/]+\/\/[^\/]+\/[^\/]+\//);
- if (_matches) {
- return _matches[0];
- } else {
- return _url;
- }
- },
- type: 'jwplayer',
- live: true,
- provider: "rtmp",
- {% endif %}
- height: 300,
- width: '{{ player_width }}',
- autostart: true,
- metadata: _metadata
- }
+ {
+ type: "Polemic"
+ },{
+ type: "Sparkline"
+ },{
+ type: "Slider"
+ },{
+ type: "AnnotationsList",
+ container: "AnnotationsList_ext",
+ ajax_url: "{% url segment_api_empty %}{% templatetag openvariable %}media{% templatetag closevariable %}/{% templatetag openvariable %}begin{% templatetag closevariable %}/{% templatetag openvariable %}end{% templatetag closevariable %}",
+ ajax_granularity : 300000,
+ default_thumbnail : "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}css/imgs/video_sequence.png"
+ },{
+ type: "Controller"
+ },{
+ type: "Segments",
+ annotation_type: ["chap","découpage"]
+ },{
+ type: "Slice",
+ start_visible : false,
+ live_update : true
+ },{
+ type: "Arrow",
+ base_height: 3
+ },{
+ type: "Annotation",
+ start_minimized: true,
+ site_name : "Lignes de Temps",
+ annotation_type: ["chap","découpage"]
+ },{
+ type: "Tweet",
+ hide_timeout: 5000
+ },{
+ type: "CreateAnnotation",
+ api_endpoint_template: "{% url annotation_api_empty %}{% templatetag openvariable %}id{% templatetag closevariable %}.json",
+ api_method: "PUT",
+ after_send_timeout: 8000,
+ close_after_send: false,
+ tag_titles: ["#amateur", "#digital-humanities"],
+ creator_name: '{{request.user.username}}',
+ creator_avatar: '{% thumbnail request.user.get_profile.image "48x48" format="PNG" crop="center" as im %}{{WEB_URL}}{{ im.url }}{% endthumbnail %}' || "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png"
+ },{
+ type: "Slideshare",
+ container: "Slideshare_ext",
+ embed_width: 400,
+ embed_height: 334,
+ annotation_type: "slide"
+ },{
+ type: "Mediafragment"
+ },{
+ type: "Social",
+ container: "Social_ext",
+ url: document.location.href.replace(/#.*$/,""),
+ text: document.title
+ }
+ ]
};
_myPlayer = new IriSP.Metadataplayer(_config);
--- a/src/ldt/ldt/static/ldt/metadataplayer/Annotation.js Wed Sep 19 01:53:14 2012 +0900
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Annotation.js Wed Sep 19 15:03:51 2012 +0900
@@ -50,38 +50,37 @@
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.insertSubwidget(this.$.find(".Ldt-Annotation-Social"), { type: "Social" }, "socialWidget");
+ 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/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.js Wed Sep 19 01:53:14 2012 +0900
+++ b/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.js Wed Sep 19 15:03:51 2012 +0900
@@ -6,7 +6,6 @@
this.throttledRefresh = IriSP._.throttle(function() {
_this.refresh(false);
}, 1500);
- this.mashupMode = (this.source.currentMedia.elementType === "mashup");
};
IriSP.Widgets.AnnotationsList.prototype = new IriSP.Widgets.Widget();
@@ -79,9 +78,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,13 +88,9 @@
//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, {
media : this.source.currentMedia.id,
begin : Math.max(0, _currentTime - this.ajax_granularity),
@@ -107,11 +102,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 +124,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 +235,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) {
@@ -262,7 +251,7 @@
if (this.mashupMode) {
this.ajaxMashup();
} else {
- if (Math.abs(_currentTime - this.lastAjaxQuery) > (this.ajax_granularity / 2000)) {
+ if (Math.abs(_currentTime - this.lastAjaxQuery) > (this.ajax_granularity)) {
this.ajaxSource();
}
}
@@ -272,14 +261,16 @@
IriSP.Widgets.AnnotationsList.prototype.draw = function() {
+ this.mashupMode = (this.media.elementType === "mashup");
+
this.renderTemplate();
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/ldt/ldt/static/ldt/metadataplayer/Arrow.js Wed Sep 19 01:53:14 2012 +0900
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Arrow.js Wed Sep 19 15:03:51 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) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/static/ldt/metadataplayer/AutoPlayer.js Wed Sep 19 15:03:51 2012 +0900
@@ -0,0 +1,57 @@
+IriSP.Widgets.AutoPlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.AutoPlayer.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.AutoPlayer.prototype.defaults = {
+ default_type: "JwpPlayer"
+}
+
+IriSP.Widgets.AutoPlayer.prototype.draw = function() {
+
+ if (typeof this.video === "undefined") {
+ this.video = this.media.video;
+ }
+
+ var _props = [ "live", "provider", "autostart", "streamer", "video", "height", "width", "url_transform" ],
+ _opts = {},
+ _types = [
+ {
+ regexp: /\.(ogg|ogv|webm)$/,
+ type: "PopcornPlayer"
+ },
+ {
+ regexp: /^(https?:\/\/)?(www\.)?youtube\.com/,
+ type: "PopcornPlayer"
+ },
+ {
+ regexp: /^(https?:\/\/)?(www\.)?vimeo\.com/,
+ type: "PopcornPlayer"
+ },
+ {
+ regexp: /^(https?:\/\/)?(www\.)?dailymotion\.com/,
+ type: "DailymotionPlayer"
+ }
+ ];
+
+ for (var i = 0; i < _types.length; i++) {
+ if (_types[i].regexp.test(this.video)) {
+ _opts.type = _types[i].type
+ }
+ }
+
+ if (typeof _opts.type === "undefined") {
+ _opts.type = this.default_type
+ }
+
+ for (var i = 0; i < _props.length; i++) {
+ if (typeof this[_props[i]] !== "undefined") {
+ _opts[_props[i]] = this[_props[i]];
+ }
+ }
+
+
+ this.insertSubwidget(this.$, _opts);
+
+}
\ No newline at end of file
--- a/src/ldt/ldt/static/ldt/metadataplayer/Controller.css Wed Sep 19 01:53:14 2012 +0900
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Controller.css Wed Sep 19 15:03:51 2012 +0900
@@ -9,7 +9,7 @@
}
.Ldt-Ctrl-Left {
- float:left;
+ float:left; width: 300px;
}
.Ldt-Ctrl-Right {
@@ -82,13 +82,12 @@
}
.Ldt-Ctrl-Search {
- display: none;
- width: 165px;
- height: 25px;
- border: 1px;
- border-color: #CFCFCF;
- float: left;
- text-align: center;
+ width: 0; float: left; overflow: hidden;
+}
+
+input.Ldt-Ctrl-SearchInput {
+ width: 145px; height: 13px; margin: 2px; padding: 3px;
+ border: 1px solid #8080a0; border-radius: 3px; font-size: 13px;
}
.Ldt-Ctrl-Time {
--- a/src/ldt/ldt/static/ldt/metadataplayer/Controller.js Wed Sep 19 01:53:14 2012 +0900
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Controller.js Wed Sep 19 15:03:51 2012 +0900
@@ -1,16 +1,16 @@
/* Displays Play and Pause buttons, Search Button and Form, Volume Control */
IriSP.Widgets.Controller = function(player, config) {
- IriSP.Widgets.Widget.call(this, player, config);
-
- this._searchLastValue = "";
+ IriSP.Widgets.Widget.call(this, player, config);
+ this.lastSearchValue = "";
};
IriSP.Widgets.Controller.prototype = new IriSP.Widgets.Widget();
IriSP.Widgets.Controller.prototype.defaults = {
disable_annotate_btn: false,
- disable_search_btn: false
+ disable_search_btn: false,
+ disable_ctrl_f: false
}
IriSP.Widgets.Controller.prototype.template =
@@ -87,25 +87,25 @@
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.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"));
- this.$searchInput.keyup(this.functionWrapper("searchHandler") );
+ this.$searchInput.keyup(this.functionWrapper("searchHandler"));
var _volctrl = this.$.find(".Ldt-Ctrl-Volume-Control");
this.$.find('.Ldt-Ctrl-Sound')
@@ -121,13 +121,28 @@
}).mouseout(function() {
_volctrl.hide();
});
-
+
+ // Handle CTRL-F
+ if (!this.disable_ctrl_f) {
+ var _fKey = "F".charCodeAt(0),
+ _lastCtrlFTime = 0;
+ IriSP.jQuery(document).keydown(function(_event) {
+ if (_event.keyCode === _fKey && (_event.ctrlKey || _event.metaKey)) {
+ var _time = IriSP.jQuery.now();
+ if (_time - _lastCtrlFTime > 2000) {
+ _this.searchButtonHandler();
+ }
+ _lastCtrlFTime = _time;
+ return false;
+ }
+ });
+ }
// Allow Volume Cursor Dragging
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")
});
@@ -135,33 +150,26 @@
// 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(new IriSP.Model.Time(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();
-
- _elapsedTime.setSeconds(_curTime);
-
- this.$.find(".Ldt-Ctrl-Time-Elapsed").html(_elapsedTime.toString());
+ var _totalTime = this.media.duration;
+ 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
@@ -169,10 +177,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)
@@ -188,23 +193,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;
}
@@ -221,7 +227,7 @@
};
IriSP.Widgets.Controller.prototype.showSearchBlock = function() {
- this.$searchBlock.show("blind", { direction: "horizontal"}, 100);
+ this.$searchBlock.animate({ width:"160px" }, 200);
this.$searchInput.css('background-color','#fff');
this.$searchInput.focus();
@@ -233,25 +239,23 @@
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._searchLastValue = this.$searchInput.val();
- this.$searchInput.val('');
- this.$searchBlock.hide("blind", { direction: "horizontal"}, 75);
-
+ 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 */
IriSP.Widgets.Controller.prototype.searchButtonHandler = function() {
- if ( this.$searchBlock.is(":hidden") ) {
+ if ( !this.$searchBlock.width() ) {
this.showSearchBlock();
- this.$searchInput.val(this._searchLastValue);
- this.player.popcorn.trigger("IriSP.search", this._searchLastValue); // trigger the search to make it more natural.
+ var _val = this.$searchInput.val();
+ if (_val) {
+ this.player.trigger("search", _val); // trigger the search to make it more natural.
+ }
} else {
this.hideSearchBlock();
}
@@ -260,16 +264,23 @@
/** this handler is called whenever the content of the search
field changes */
IriSP.Widgets.Controller.prototype.searchHandler = function() {
- this._searchLastValue = this.$searchInput.val();
+ if ( !this.$searchBlock.width() ) {
+ this.$searchBlock.css({ width:"160px" });
+ this.$searchInput.css('background-color','#fff');
+ }
+ var _val = this.$searchInput.val();
this._positiveMatch = false;
-
+
// do nothing if the search field is empty, instead of highlighting everything.
- if (this._searchLastValue == "") {
- this.player.popcorn.trigger("IriSP.search.cleared");
- this.$searchInput.css('background-color','');
- } else {
- this.player.popcorn.trigger("IriSP.search", this._searchLastValue);
+ if (_val !== this.lastSearchValue) {
+ if (_val) {
+ this.player.trigger("search", _val);
+ } else {
+ this.player.trigger("search.cleared");
+ this.$searchInput.css('background-color','');
+ }
}
+ this.lastSearchValue = _val;
};
/**
@@ -293,7 +304,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/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.js Wed Sep 19 01:53:14 2012 +0900
+++ b/src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.js Wed Sep 19 15:03:51 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);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/static/ldt/metadataplayer/DailymotionPlayer.js Wed Sep 19 15:03:51 2012 +0900
@@ -0,0 +1,104 @@
+IriSP.Widgets.DailymotionPlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.DailymotionPlayer.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.DailymotionPlayer.prototype.defaults = {
+ aspect_ratio: 14/9
+}
+
+IriSP.Widgets.DailymotionPlayer.prototype.draw = function() {
+
+ if (typeof this.video === "undefined") {
+ this.video = this.media.video;
+ }
+
+ this.height = this.height || Math.floor(this.width / this.aspect_ratio);
+
+ var _media = this.media,
+ _this = this,
+ _pauseState = true;
+
+ /* Dailymotion utilise un système de fonctions référencées dans
+ * des variables globales pour la gestion des événements.
+ */
+
+ window.onDailymotionPlayerReady = function() {
+
+ var _player = document.getElementById(_this.container);
+
+ _media.getCurrentTime = function() {
+ return new IriSP.Model.Time(1000*_player.getCurrentTime());
+ }
+ _media.getVolume = function() {
+ return _player.getVolume() / 100;
+ }
+ _media.getPaused = function() {
+ return _pauseState;
+ }
+ _media.getMuted = function() {
+ return _player.isMuted();
+ }
+ _media.setCurrentTime = function(_milliseconds) {
+ _seekPause = _pauseState;
+ return _player.seekTo(_milliseconds / 1000);
+ }
+ _media.setVolume = function(_vol) {
+ return _player.setVolume(Math.floor(_vol*100));
+ }
+ _media.mute = function() {
+ return _player.mute();
+ }
+ _media.unmute = function() {
+ return _player.unMute();
+ }
+ _media.play = function() {
+ return _player.playVideo();
+ }
+ _media.pause = function() {
+ return _player.pauseVideo();
+ }
+
+ _player.addEventListener("onStateChange", "onDailymotionStateChange");
+ _player.addEventListener("onVideoProgress", "onDailymotionVideoProgress");
+
+ _player.cueVideoByUrl(_this.video);
+
+ _media.trigger("loadedmetadata");
+ }
+
+ window.onDailymotionStateChange = function(_state) {
+ switch(_state) {
+ case 1:
+ _media.trigger("play");
+ _pauseState = false;
+ break;
+
+ case 2:
+ _media.trigger("pause");
+ _pauseState = true;
+ break;
+
+ case 3:
+ _media.trigger("seeked");
+ break;
+ }
+ }
+
+ window.onDailymotionVideoProgress = function(_progress) {
+ _media.trigger("timeupdate", new IriSP.Model.Time(_progress.mediaTime * 1000));
+ }
+
+ var params = {
+ "allowScriptAccess" : "always",
+ "wmode": "opaque"
+ };
+
+ var atts = {
+ id : this.container
+ };
+
+ swfobject.embedSWF("http://www.dailymotion.com/swf?chromeless=1&enableApi=1", this.container, this.width, this.height, "8", null, null, params, atts);
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/static/ldt/metadataplayer/JwpPlayer.js Wed Sep 19 15:03:51 2012 +0900
@@ -0,0 +1,119 @@
+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.$[0]),
+ _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";
+ _opts.width = this.width;
+ _opts.height = this.height || Math.floor(.643*this.width);
+
+ 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() || 0);
+ }
+ 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(_progress) {
+ if (_seekPause) {
+ _player.pause(true);
+ _seekPause = false;
+ } else {
+ if (_pauseState && _player.getState() === "PLAYING") {
+ _pauseState = false;
+ _media.trigger("play");
+ }
+ }
+ _media.trigger("timeupdate", new IriSP.Model.Time(_progress.position * 1000));
+ },
+ onPlay: function() {
+ if (!_seekPause) {
+ _pauseState = false;
+ _media.trigger("play");
+ }
+ },
+ onPause: function() {
+ _pauseState = true;
+ _media.trigger("pause");
+ },
+ onSeek: function() {
+ _media.trigger("seeked");
+ }
+ }
+ _player.setup(_opts);
+
+ this.jwplayer = _player;
+
+}
\ No newline at end of file
--- a/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js Wed Sep 19 01:53:14 2012 +0900
+++ b/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js Wed Sep 19 15:03:51 2012 +0900
@@ -20,11 +20,11 @@
v2.0.3 (c) Kyle Simpson
MIT License
*/
-(function(o){var K=o.$LAB,y="UseLocalXHR",z="AlwaysPreserveOrder",u="AllowDuplicates",A="CacheBust",B="BasePath",C=/^[^?#]*\//.exec(location.href)[0],D=/^\w+\:\/\/\/?[^\/]+/.exec(C)[0],i=document.head||document.getElementsByTagName("head"),L=(o.opera&&Object.prototype.toString.call(o.opera)=="[object Opera]")||("MozAppearance"in document.documentElement.style),q=document.createElement("script"),E=typeof q.preload=="boolean",r=E||(q.readyState&&q.readyState=="uninitialized"),F=!r&&q.async===true,M=!r&&!F&&!L;function G(a){return Object.prototype.toString.call(a)=="[object Function]"}function H(a){return Object.prototype.toString.call(a)=="[object Array]"}function N(a,c){var b=/^\w+\:\/\//;if(/^\/\/\/?/.test(a)){a=location.protocol+a}else if(!b.test(a)&&a.charAt(0)!="/"){a=(c||"")+a}return b.test(a)?a:((a.charAt(0)=="/"?D:C)+a)}function s(a,c){for(var b in a){if(a.hasOwnProperty(b)){c[b]=a[b]}}return c}function O(a){var c=false;for(var b=0;b<a.scripts.length;b++){if(a.scripts[b].ready&&a.scripts[b].exec_trigger){c=true;a.scripts[b].exec_trigger();a.scripts[b].exec_trigger=null}}return c}function t(a,c,b,d){a.onload=a.onreadystatechange=function(){if((a.readyState&&a.readyState!="complete"&&a.readyState!="loaded")||c[b])return;a.onload=a.onreadystatechange=null;d()}}function I(a){a.ready=a.finished=true;for(var c=0;c<a.finished_listeners.length;c++){a.finished_listeners[c]()}a.ready_listeners=[];a.finished_listeners=[]}function P(d,f,e,g,h){setTimeout(function(){var a,c=f.real_src,b;if("item"in i){if(!i[0]){setTimeout(arguments.callee,25);return}i=i[0]}a=document.createElement("script");if(f.type)a.type=f.type;if(f.charset)a.charset=f.charset;if(h){if(r){e.elem=a;if(E){a.preload=true;a.onpreload=g}else{a.onreadystatechange=function(){if(a.readyState=="loaded")g()}}a.src=c}else if(h&&c.indexOf(D)==0&&d[y]){b=new XMLHttpRequest();b.onreadystatechange=function(){if(b.readyState==4){b.onreadystatechange=function(){};e.text=b.responseText+"\n//@ sourceURL="+c;g()}};b.open("GET",c);b.send()}else{a.type="text/cache-script";t(a,e,"ready",function(){i.removeChild(a);g()});a.src=c;i.insertBefore(a,i.firstChild)}}else if(F){a.async=false;t(a,e,"finished",g);a.src=c;i.insertBefore(a,i.firstChild)}else{t(a,e,"finished",g);a.src=c;i.insertBefore(a,i.firstChild)}},0)}function J(){var l={},Q=r||M,n=[],p={},m;l[y]=true;l[z]=false;l[u]=false;l[A]=false;l[B]="";function R(a,c,b){var d;function f(){if(d!=null){d=null;I(b)}}if(p[c.src].finished)return;if(!a[u])p[c.src].finished=true;d=b.elem||document.createElement("script");if(c.type)d.type=c.type;if(c.charset)d.charset=c.charset;t(d,b,"finished",f);if(b.elem){b.elem=null}else if(b.text){d.onload=d.onreadystatechange=null;d.text=b.text}else{d.src=c.real_src}i.insertBefore(d,i.firstChild);if(b.text){f()}}function S(c,b,d,f){var e,g,h=function(){b.ready_cb(b,function(){R(c,b,e)})},j=function(){b.finished_cb(b,d)};b.src=N(b.src,c[B]);b.real_src=b.src+(c[A]?((/\?.*$/.test(b.src)?"&_":"?_")+~~(Math.random()*1E9)+"="):"");if(!p[b.src])p[b.src]={items:[],finished:false};g=p[b.src].items;if(c[u]||g.length==0){e=g[g.length]={ready:false,finished:false,ready_listeners:[h],finished_listeners:[j]};P(c,b,e,((f)?function(){e.ready=true;for(var a=0;a<e.ready_listeners.length;a++){e.ready_listeners[a]()}e.ready_listeners=[]}:function(){I(e)}),f)}else{e=g[0];if(e.finished){j()}else{e.finished_listeners.push(j)}}}function v(){var e,g=s(l,{}),h=[],j=0,w=false,k;function T(a,c){a.ready=true;a.exec_trigger=c;x()}function U(a,c){a.ready=a.finished=true;a.exec_trigger=null;for(var b=0;b<c.scripts.length;b++){if(!c.scripts[b].finished)return}c.finished=true;x()}function x(){while(j<h.length){if(G(h[j])){try{h[j++]()}catch(err){}continue}else if(!h[j].finished){if(O(h[j]))continue;break}j++}if(j==h.length){w=false;k=false}}function V(){if(!k||!k.scripts){h.push(k={scripts:[],finished:true})}}e={script:function(){for(var f=0;f<arguments.length;f++){(function(a,c){var b;if(!H(a)){c=[a]}for(var d=0;d<c.length;d++){V();a=c[d];if(G(a))a=a();if(!a)continue;if(H(a)){b=[].slice.call(a);b.unshift(d,1);[].splice.apply(c,b);d--;continue}if(typeof a=="string")a={src:a};a=s(a,{ready:false,ready_cb:T,finished:false,finished_cb:U});k.finished=false;k.scripts.push(a);S(g,a,k,(Q&&w));w=true;if(g[z])e.wait()}})(arguments[f],arguments[f])}return e},wait:function(){if(arguments.length>0){for(var a=0;a<arguments.length;a++){h.push(arguments[a])}k=h[h.length-1]}else k=false;x();return e}};return{script:e.script,wait:e.wait,setOptions:function(a){s(a,g);return e}}}m={setGlobalDefaults:function(a){s(a,l);return m},setOptions:function(){return v().setOptions.apply(null,arguments)},script:function(){return v().script.apply(null,arguments)},wait:function(){return v().wait.apply(null,arguments)},queueScript:function(){n[n.length]={type:"script",args:[].slice.call(arguments)};return m},queueWait:function(){n[n.length]={type:"wait",args:[].slice.call(arguments)};return m},runQueue:function(){var a=m,c=n.length,b=c,d;for(;--b>=0;){d=n.shift();a=a[d.type].apply(null,d.args)}return a},noConflict:function(){o.$LAB=K;return m},sandbox:function(){return J()}};return m}o.$LAB=J();(function(a,c,b){if(document.readyState==null&&document[a]){document.readyState="loading";document[a](c,b=function(){document.removeEventListener(c,b,false);document.readyState="complete"},false)}})("addEventListener","DOMContentLoaded")})(this);/* init.js - initialization and configuration of Popcorn and the widgets
+(function(o){var K=o.$LAB,y="UseLocalXHR",z="AlwaysPreserveOrder",u="AllowDuplicates",A="CacheBust",B="BasePath",C=/^[^?#]*\//.exec(location.href)[0],D=/^\w+\:\/\/\/?[^\/]+/.exec(C)[0],i=document.head||document.getElementsByTagName("head"),L=(o.opera&&Object.prototype.toString.call(o.opera)=="[object Opera]")||("MozAppearance"in document.documentElement.style),q=document.createElement("script"),E=typeof q.preload=="boolean",r=E||(q.readyState&&q.readyState=="uninitialized"),F=!r&&q.async===true,M=!r&&!F&&!L;function G(a){return Object.prototype.toString.call(a)=="[object Function]"}function H(a){return Object.prototype.toString.call(a)=="[object Array]"}function N(a,c){var b=/^\w+\:\/\//;if(/^\/\/\/?/.test(a)){a=location.protocol+a}else if(!b.test(a)&&a.charAt(0)!="/"){a=(c||"")+a}return b.test(a)?a:((a.charAt(0)=="/"?D:C)+a)}function s(a,c){for(var b in a){if(a.hasOwnProperty(b)){c[b]=a[b]}}return c}function O(a){var c=false;for(var b=0;b<a.scripts.length;b++){if(a.scripts[b].ready&&a.scripts[b].exec_trigger){c=true;a.scripts[b].exec_trigger();a.scripts[b].exec_trigger=null}}return c}function t(a,c,b,d){a.onload=a.onreadystatechange=function(){if((a.readyState&&a.readyState!="complete"&&a.readyState!="loaded")||c[b])return;a.onload=a.onreadystatechange=null;d()}}function I(a){a.ready=a.finished=true;for(var c=0;c<a.finished_listeners.length;c++){a.finished_listeners[c]()}a.ready_listeners=[];a.finished_listeners=[]}function P(d,f,e,g,h){setTimeout(function(){var a,c=f.real_src,b;if("item"in i){if(!i[0]){setTimeout(arguments.callee,25);return}i=i[0]}a=document.createElement("script");if(f.type)a.type=f.type;if(f.charset)a.charset=f.charset;if(h){if(r){e.elem=a;if(E){a.preload=true;a.onpreload=g}else{a.onreadystatechange=function(){if(a.readyState=="loaded")g()}}a.src=c}else if(h&&c.indexOf(D)==0&&d[y]){b=new XMLHttpRequest();b.onreadystatechange=function(){if(b.readyState==4){b.onreadystatechange=function(){};e.text=b.responseText+"\n//@ sourceURL="+c;g()}};b.open("GET",c);b.send()}else{a.type="text/cache-script";t(a,e,"ready",function(){i.removeChild(a);g()});a.src=c;i.insertBefore(a,i.firstChild)}}else if(F){a.async=false;t(a,e,"finished",g);a.src=c;i.insertBefore(a,i.firstChild)}else{t(a,e,"finished",g);a.src=c;i.insertBefore(a,i.firstChild)}},0)}function J(){var l={},Q=r||M,n=[],p={},m;l[y]=true;l[z]=false;l[u]=false;l[A]=false;l[B]="";function R(a,c,b){var d;function f(){if(d!=null){d=null;I(b)}}if(p[c.src].finished)return;if(!a[u])p[c.src].finished=true;d=b.elem||document.createElement("script");if(c.type)d.type=c.type;if(c.charset)d.charset=c.charset;t(d,b,"finished",f);if(b.elem){b.elem=null}else if(b.text){d.onload=d.onreadystatechange=null;d.text=b.text}else{d.src=c.real_src}i.insertBefore(d,i.firstChild);if(b.text){f()}}function S(c,b,d,f){var e,g,h=function(){b.ready_cb(b,function(){R(c,b,e)})},j=function(){b.finished_cb(b,d)};b.src=N(b.src,c[B]);b.real_src=b.src+(c[A]?((/\?.*$/.test(b.src)?"&_":"?_")+~~(Math.random()*1E9)+"="):"");if(!p[b.src])p[b.src]={items:[],finished:false};g=p[b.src].items;if(c[u]||g.length==0){e=g[g.length]={ready:false,finished:false,ready_listeners:[h],finished_listeners:[j]};P(c,b,e,((f)?function(){e.ready=true;for(var a=0;a<e.ready_listeners.length;a++){e.ready_listeners[a]()}e.ready_listeners=[]}:function(){I(e)}),f)}else{e=g[0];if(e.finished){j()}else{e.finished_listeners.push(j)}}}function v(){var e,g=s(l,{}),h=[],j=0,w=false,k;function T(a,c){a.ready=true;a.exec_trigger=c;x()}function U(a,c){a.ready=a.finished=true;a.exec_trigger=null;for(var b=0;b<c.scripts.length;b++){if(!c.scripts[b].finished)return}c.finished=true;x()}function x(){while(j<h.length){if(G(h[j])){try{h[j++]()}catch(err){}continue}else if(!h[j].finished){if(O(h[j]))continue;break}j++}if(j==h.length){w=false;k=false}}function V(){if(!k||!k.scripts){h.push(k={scripts:[],finished:true})}}e={script:function(){for(var f=0;f<arguments.length;f++){(function(a,c){var b;if(!H(a)){c=[a]}for(var d=0;d<c.length;d++){V();a=c[d];if(G(a))a=a();if(!a)continue;if(H(a)){b=[].slice.call(a);b.unshift(d,1);[].splice.apply(c,b);d--;continue}if(typeof a=="string")a={src:a};a=s(a,{ready:false,ready_cb:T,finished:false,finished_cb:U});k.finished=false;k.scripts.push(a);S(g,a,k,(Q&&w));w=true;if(g[z])e.wait()}})(arguments[f],arguments[f])}return e},wait:function(){if(arguments.length>0){for(var a=0;a<arguments.length;a++){h.push(arguments[a])}k=h[h.length-1]}else k=false;x();return e}};return{script:e.script,wait:e.wait,setOptions:function(a){s(a,g);return e}}}m={setGlobalDefaults:function(a){s(a,l);return m},setOptions:function(){return v().setOptions.apply(null,arguments)},script:function(){return v().script.apply(null,arguments)},wait:function(){return v().wait.apply(null,arguments)},queueScript:function(){n[n.length]={type:"script",args:[].slice.call(arguments)};return m},queueWait:function(){n[n.length]={type:"wait",args:[].slice.call(arguments)};return m},runQueue:function(){var a=m,c=n.length,b=c,d;for(;--b>=0;){d=n.shift();a=a[d.type].apply(null,d.args)}return a},noConflict:function(){o.$LAB=K;return m},sandbox:function(){return J()}};return m}o.$LAB=J();(function(a,c,b){if(document.readyState==null&&document[a]){document.readyState="loading";document[a](c,b=function(){document.removeEventListener(c,b,false);document.readyState="complete"},false)}})("addEventListener","DOMContentLoaded")})(this);/* init.js - initialization and configuration of the widgets
*/
if (typeof window.IriSP === "undefined") {
- IriSP = {};
+ window.IriSP = {};
}
/* The Metadataplayer Object, single point of entry, replaces IriSP.init_player */
@@ -32,43 +32,34 @@
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 = '<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();
}
IriSP.Metadataplayer.prototype.toString = function() {
- return 'Metadataplayer in #' + this.config.gui.container;
-}
-
-IriSP.Metadataplayer.prototype.deferCallback = function(_callback) {
- var _this = this;
- IriSP._.defer(function() {
- _callback.call(_this);
- });
+ return 'Metadataplayer in #' + this.config.container;
}
-IriSP.Metadataplayer.prototype.handleCallbacks = function() {
- this.isLoaded = true;
- while (this.callbackQueue.length) {
- this.deferCallback(this.callbackQueue.splice(0,1)[0]);
+IriSP.Metadataplayer.prototype.on = function(_event, _callback) {
+ if (typeof this.__events[_event] === "undefined") {
+ this.__events[_event] = [];
}
+ this.__events[_event].push(_callback);
}
-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() {
@@ -76,8 +67,7 @@
var $L = $LAB
.script(IriSP.getLib("underscore"))
.script(IriSP.getLib("Mustache"))
- .script(IriSP.getLib("jQuery"))
- .script(IriSP.getLib("swfObject"));
+ .script(IriSP.getLib("jQuery"));
if (typeof JSON == "undefined") {
$L.script(IriSP.getLib("json"));
@@ -86,17 +76,9 @@
$L.wait()
.script(IriSP.getLib("jQueryUI"));
- if (this.config.player.type === "jwplayer" || this.config.player.type === "auto") {
- $L.script(IriSP.getLib("jwplayer"));
- }
-
- if (this.config.player.type !== "jwplayer" && this.config.player.type !== "allocine" && this.config.player.type !== "dailymotion") {
- $L.script(IriSP.getLib("popcorn"));
- }
-
/* widget specific requirements */
- for(var _i = 0; _i < this.config.gui.widgets.length; _i++) {
- var _t = this.config.gui.widgets[_i].type;
+ for(var _i = 0; _i < this.config.widgets.length; _i++) {
+ var _t = this.config.widgets[_i].type;
if (typeof IriSP.widgetsRequirements[_t] !== "undefined" && typeof IriSP.widgetsRequirements[_t].requires !== "undefined" ) {
for (var _j = 0; _j < IriSP.widgetsRequirements[_t].requires.length; _j++) {
$L.script(IriSP.getLib(IriSP.widgetsRequirements[_t].requires[_j]));
@@ -120,22 +102,25 @@
IriSP._ = window._;
}
IriSP.loadCss(IriSP.getLib("cssjQueryUI"));
- IriSP.loadCss(this.config.gui.css);
+ IriSP.loadCss(this.config.css);
- this.videoData = this.loadMetadata(this.config.player.metadata);
- this.$ = IriSP.jQuery('#' + this.config.gui.container);
+ this.$ = IriSP.jQuery('#' + this.config.container);
this.$.css({
- "width": this.config.gui.width,
+ "width": this.config.width,
"clear": "both"
});
- if (typeof this.config.gui.height !== "undefined") {
- this.$.css("height", this.config.gui.height);
+ if (typeof this.config.height !== "undefined") {
+ this.$.css("height", this.config.height);
}
+ this.widgets = [];
var _this = this;
- this.videoData.onLoad(function() {
- _this.onVideoDataLoaded();
- });
+ for(var i = 0; i < this.config.widgets.length; i++) {
+ this.loadWidget(this.config.widgets[i], function(_widget) {
+ _this.widgets.push(_widget)
+ });
+ };
+ this.$.find('.Ldt-Loader').detach();
}
IriSP.Metadataplayer.prototype.loadMetadata = function(_metadataInfo) {
@@ -152,197 +137,6 @@
}
}
-IriSP.Metadataplayer.prototype.onVideoDataLoaded = function() {
-
- /* Setting default media from metadata */
-
- if (typeof this.videoData !== "undefined") {
-
- var _media;
-
- if (typeof this.videoData.mainMedia !== "undefined") {
- _media = this.videoData.getElement(this.videoData.mainMedia);
- }
-
- if (this.config.player.type === "mashup" || this.config.player.type === "mashup-html") {
- if (typeof _media === "undefined" || _media.elementType !== "mashup") {
- var _mashups = this.videoData.getMashups();
- if (_mashups.length) {
- _media = _mashups[0];
- }
- }
- } else {
- if (typeof _media === "undefined" || _media.elementType !== "media") {
- var _medias = this.videoData.getMedias();
- if (_medias.length) {
- _media = _medias[0];
- }
- }
- }
-
- this.videoData.currentMedia = _media;
-
- /* Getting video URL from metadata if it's not in the player config options */
-
- if (typeof _media !== "undefined" && typeof _media.video !== "undefined" && typeof this.config.player.video === "undefined") {
- this.config.player.video = _media.video;
- if (typeof this.config.player.streamer == "undefined" && typeof _media.streamer !== "undefined") {
- this.config.player.streamer = _media.streamer;
- }
- }
-
- }
-
- if (typeof this.config.player.video === "string" && this.config.player.url_transform === "function") {
- this.config.player.video = this.config.player.url_transform(this.config.player.video);
- }
-
- var _pop,
- _divs = this.layoutDivs("video",this.config.player.height || undefined),
- containerDiv = _divs[0],
- spacerDiv = _divs[1],
- _this = this,
- _types = {
- "html5" : /\.(ogg|ogv|webm)$/,
- "youtube" : /^(https?:\/\/)?(www\.)?youtube\.com/,
- "vimeo" : /^(https?:\/\/)?(www\.)?vimeo\.com/,
- "dailymotion" : /^(https?:\/\/)?(www\.)?dailymotion\.com/
- };
-
- if (this.config.player.type === "auto") {
- this.config.player.type = "jwplayer";
- IriSP._(_types).each(function(_v, _k) {
- if (_v.test(_this.config.player.video)) {
- _this.config.player.type = _k
- }
- });
- }
-
- switch(this.config.player.type) {
- case "html5":
- var _tmpId = Popcorn.guid("video"),
- _videoEl = IriSP.jQuery('<video>');
-
- _videoEl.attr({
- "src" : this.config.player.video,
- "id" : _tmpId
- })
-
- if(this.config.player.hasOwnProperty("width")) {
- _videoEl.attr("width", this.config.player.width);
- }
- if(this.config.player.hasOwnProperty("height")) {
- _videoEl.attr("height", this.config.player.height);
- }
- IriSP.jQuery("#" + containerDiv).append(_videoEl);
- _pop = Popcorn("#" + _tmpId);
- break;
-
- case "html5-audio":
- var _tmpId = Popcorn.guid("audio"),
- _videoEl = IriSP.jQuery('<audio>');
-
- _videoEl.attr({
- "src" : this.config.player.video,
- "id" : _tmpId
- })
-
- if(this.config.player.hasOwnProperty("width")) {
- _videoEl.attr("width", this.config.player.width);
- }
- if(this.config.player.hasOwnProperty("height")) {
- _videoEl.attr("height", this.config.player.height);
- }
- IriSP.jQuery("#" + containerDiv).append(_videoEl);
- _pop = Popcorn("#" + _tmpId);
- break;
-
- case "jwplayer":
- var opts = IriSP.jQuery.extend({}, this.config.player);
- delete opts.container;
- delete opts.type;
- if (typeof opts.streamer === "function") {
- opts.streamer = opts.streamer(opts.video);
- }
- if (typeof opts.streamer === "string") {
- opts.video = opts.video.replace(opts.streamer,"");
- }
- opts.file = opts.video;
- delete opts.video;
- delete opts.metadata;
-
- if(!opts.hasOwnProperty("flashplayer")) {
- opts.flashplayer = IriSP.getLib("jwPlayerSWF");
- }
-
- if(!opts.hasOwnProperty("controlbar.position")) {
- opts["controlbar.position"] = "none";
- }
- _pop = new IriSP.PopcornReplacement.jwplayer("#" + containerDiv, opts);
- break;
-
- case "youtube":
- // Popcorn.youtube wants us to specify the size of the player in the style attribute of its container div.
- IriSP.jQuery("#" + containerDiv).css({
- width : this.config.player.width + "px",
- height : this.config.player.height + "px"
- });
- var _urlparts = this.config.player.video.split(/[?&]/),
- _params = {};
- for (var _j = 1; _j < _urlparts.length; _j++) {
- var _ppart = _urlparts[_j].split('=');
- _params[_ppart[0]] = decodeURIComponent(_ppart[1]);
- }
- _params.controls = 0;
- _params.modestbranding = 1;
- _url = _urlparts[0] + '?' + IriSP.jQuery.param(_params);
- _pop = Popcorn.youtube("#" + containerDiv, _url);
- break;
-
- case "vimeo":
- // Popcorn.vimeo wants us to specify the size of the player in the style attribute of its container div.
- IriSP.jQuery("#" + containerDiv).css({
- width : this.config.player.width + "px",
- height : this.config.player.height + "px"
- });
- _pop = Popcorn.vimeo("#" + containerDiv, this.config.player.video);
- break;
-
- case "dailymotion":
- _pop = new IriSP.PopcornReplacement.dailymotion("#" + containerDiv, this.config.player);
- break;
-
- case "mashup":
- _pop = new IriSP.PopcornReplacement.mashup("#" + containerDiv, this.config.player);
- break;
-
- case "allocine":
- _pop = new IriSP.PopcornReplacement.allocine("#" + containerDiv, this.config.player);
- break;
-
- case "mashup-html":
- _pop = new IriSP.PopcornReplacement.htmlMashup("#" + containerDiv, this.config.player, this.videoData);
- break;
-
- default:
- _pop = undefined;
- };
-
- this.popcorn = _pop;
-
- /* Now Loading Widgets */
-
- 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.handleCallbacks();
-}
-
IriSP.Metadataplayer.prototype.loadWidget = function(_widgetConfig, _callback) {
/* Creating containers if needed */
if (typeof _widgetConfig.container === "undefined") {
@@ -376,20 +170,20 @@
if (typeof(_name) === "undefined") {
_name = "";
}
- var newDiv = IriSP._.uniqueId(this.config.gui.container + "_widget_" + _name + "_"),
+ var newDiv = IriSP._.uniqueId(this.config.container + "_widget_" + _name + "_"),
spacerDiv = IriSP._.uniqueId("LdtPlayer_spacer_"),
divHtml = IriSP.jQuery('<div>')
.attr("id",newDiv)
.css({
- width: this.config.gui.width + "px",
+ width: this.config.width + "px",
position: "relative",
clear: "both"
}),
spacerHtml = IriSP.jQuery('<div>')
.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"
});
@@ -438,154 +232,7 @@
console.log.apply(console, arguments);
}
}
-/* wrapper that simulates popcorn.js because
- popcorn is a bit unstable at the time */
-
-/* Popcorn.code replacement has been disabled. It didn't work properly and was not even used */
-
-IriSP.PopcornReplacement = {
-};
-
-/** base class for our popcorn-compatible players.
- */
-IriSP.PopcornReplacement.player = function(container, options) {
-
- this.media = {
- "paused": true,
- "muted": false
- };
-
- this.container = container.replace(/^#/,''); //remove '#' at beginning
- this.msgPump = {}; /* dictionnary used to receive and send messages */
- this._options = options;
-
-};
-
-IriSP.PopcornReplacement.player.prototype.listen = function(msg, callback) {
- if (!this.msgPump.hasOwnProperty(msg)) {
- this.msgPump[msg] = [];
- }
- this.msgPump[msg].push(callback);
-};
-
-IriSP.PopcornReplacement.player.prototype.on = IriSP.PopcornReplacement.player.prototype.listen;
-
-IriSP.PopcornReplacement.player.prototype.trigger = function(msg, params) {
- if (!this.msgPump.hasOwnProperty(msg)) {
- return;
- }
- var d = this.msgPump[msg];
- for(var i = 0; i < d.length; i++) {
- d[i].call(window, params);
- }
-};
-
-IriSP.PopcornReplacement.player.prototype.emit = IriSP.PopcornReplacement.player.prototype.trigger;
-/*
-IriSP.PopcornReplacement.player.prototype.guid = function(prefix) {
- var str = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
- var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
- return v.toString(16);
- });
-
- return prefix + str;
-};
-
-/** init the api after that flash player has been setup - called by the callback
- defined by the embedded flash player
-
-IriSP.PopcornReplacement.player.prototype.__initApi = function() {
- this.trigger("loadedmetadata"); // we've done more than loading metadata of course,
- // but popcorn doesn't need to know more.
- this.media.muted = this.playerFns.getMute();
- /* some programmed segments are supposed to be run at the beginning
- var i = 0;
- for(i = 0; i < this.__codes.length; i++) {
- var c = this.__codes[i];
- if (0 == c.start) {
- c.onStart();
- }
-
- if (0 == c.end) {
- c.onEnd();
- }
- }
-
-};
-*/
-
-IriSP.PopcornReplacement.player.prototype.currentTime = function(time) {
- if (typeof(time) === "undefined") {
- return this.playerFns.getPosition();
- } else {
- var currentTime = +time;
- this.playerFns.seek(currentTime);
- return currentTime;
- }
-};
-
-IriSP.PopcornReplacement.player.prototype.play = function() {
- this.media.paused = false;
- this.trigger("play");
- this.playerFns.play();
-};
-
-IriSP.PopcornReplacement.player.prototype.pause = function() {
- this.media.paused = true;
- this.trigger("pause");
- this.playerFns.pause();
-};
-
-IriSP.PopcornReplacement.player.prototype.muted = function(val) {
- if (typeof(val) !== "undefined") {
-
- if (this.playerFns.getMute() !== val) {
- if (val) {
- this.playerFns.setMute(true);
- this.media.muted = true;
- } else {
- this.playerFns.setMute(false);
- this.media.muted = false;
- }
-
- this.trigger( "volumechange" );
- }
-
- return this.playerFns.getMute();
- } else {
- return this.playerFns.getMute();
- }
-};
-
-IriSP.PopcornReplacement.player.prototype.volume = function(val) {
- if (typeof this.playerFns.getVolume == "undefined" || typeof this.playerFns.setVolume == "undefined") {
- return false;
- }
- var _vol = this.playerFns.getVolume();
- if (typeof(val) !== "undefined" && parseFloat(val) !== NaN) {
- val = Math.max(0, Math.min(1, val));
- if (parseFloat(val) != parseFloat(_vol)) {
- this.playerFns.setVolume(val);
- this.trigger("volumechange");
- _vol = this.playerFns.getVolume();
- }
- }
- return _vol;
-};
-
-IriSP.PopcornReplacement.player.prototype.mute = function() {
- this.muted(true);
-}
-
-IriSP.PopcornReplacement.player.prototype.unmute = function() {
- this.muted(false);
-}
-
-
-IriSP.PopcornReplacement.player.prototype.roundTime = function() {
- var currentTime = this.currentTime();
- return Math.round(currentTime);
-};/* TODO: Separate Project-specific data from Source */
+/* TODO: Separate Project-specific data from Source */
/* model.js is where data is stored in a standard form, whatever the serializer */
@@ -951,7 +598,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);
}
}
@@ -1037,6 +684,23 @@
IriSP.Model.Media.prototype = new IriSP.Model.Element();
+/* Default functions to be overriden by players */
+
+IriSP.Model.Media.prototype.getCurrentTime = function() { return new IriSP.Model.Time(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);
}
@@ -1234,6 +898,23 @@
}
}
+/* Default functions to be overriden by players */
+
+IriSP.Model.Mashup.prototype.getCurrentTime = function() { return new IriSP.Model.Time(0); }
+
+IriSP.Model.Mashup.prototype.getVolume = function() { return .5; }
+
+IriSP.Model.Mashup.prototype.getPaused = function() { return true; }
+
+IriSP.Model.Mashup.prototype.getMuted = function() { return false; }
+
+IriSP.Model.Mashup.prototype.setCurrentTime
+ = IriSP.Model.Mashup.prototype.setVolume
+ = IriSP.Model.Mashup.prototype.setMuted
+ = IriSP.Model.Mashup.prototype.play
+ = IriSP.Model.Mashup.prototype.pause
+ = function() {}
+
/* */
IriSP.Model.Source = function(_config) {
@@ -1355,6 +1036,23 @@
}
}
+IriSP.Model.Source.prototype.getCurrentMedia = function(_opts) {
+ if (typeof this.currentMedia === "undefined") {
+ if (_opts.is_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) {
@@ -1462,6 +1160,18 @@
IriSP.widgetsDir = 'widgets';
IriSP.widgetsRequirements = {
+ PopcornPlayer: {
+ noCss: true,
+ requires: [ "popcorn" ]
+ },
+ JwpPlayer: {
+ noCss: true,
+ requires: [ "jwplayer" ]
+ },
+ DailymotionPlayer: {
+ noCss: true,
+ requires: [ "swfObject" ]
+ },
Sparkline: {
noCss: true,
requires: [ "raphael" ]
@@ -1477,7 +1187,7 @@
noCss: true,
requires: [ "tracemanager" ]
},
- SlideShare: {
+ Slideshare: {
requires: [ "swfObject" ]
},
Social: {
@@ -1521,7 +1231,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) {
@@ -1529,7 +1239,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
@@ -1542,6 +1252,15 @@
/* Call draw when loaded */
this.source.onLoad(function() {
+ if (_this.media_id) {
+ _this.media = this.getElement(_this.media_id);
+ } else {
+ var _mediaopts = {
+ is_mashup: _this.is_mashup || false
+ }
+ _this.media = this.getCurrentMedia(_mediaopts);
+ }
+
_this.draw();
});
@@ -1583,27 +1302,41 @@
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) {
+ 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;
});
}
-IriSP.Widgets.Widget.prototype.insertSubwidget = function(_selector, _propname, _widgetoptions) {
+IriSP.Widgets.Widget.prototype.insertSubwidget = function(_selector, _widgetoptions, _propname) {
var _id = _selector.attr("id"),
_this = this,
_type = _widgetoptions.type,
@@ -1620,7 +1353,9 @@
}
$L.wait(function() {
_this.player.loadWidget(_widgetoptions, function(_widget) {
- _this[_propname] = _widget;
+ if (_propname) {
+ _this[_propname] = _widget;
+ }
});
});
}
@@ -1630,653 +1365,6 @@
*/
IriSP.Widgets.Widget.prototype.draw = function() {
/* implemented by "sub-classes" */
-};/* To wrap a player the develop should create a new class derived from
-the IriSP.PopcornReplacement.player and defining the correct functions */
-
-/** allocine player wrapper */
-IriSP.PopcornReplacement.allocine = function(container, options) {
-// console.log("Calling allocine player");
- /* appel du parent pour initialiser les structures communes à tous les players */
- IriSP.PopcornReplacement.player.call(this, container, options);
-
- var _this = this;
-
- /* Définition des fonctions de l'API - */
-
- this.playerFns = {
- play : function() {
- return _this.apiCall("play");
- },
- pause : function() {
- return _this.apiCall("pause");
- },
- getPosition : function() {
- return _this.apiCall("getSeek","return") || 0;
- },
- seek : function(pos) {
- return _this.apiCall("seek",pos);
- },
- getMute : function() {
- return _this.apiCall("getMute","return");
- },
- setMute : function(p) {
- return _this.apiCall("setMute", p);
- }
- }
-
- window.onReady = function() {
- _this.ready();
- };
- window.onAllocineStateChange = function(_state) {
- _this.stateHandler(_state)
- }
- window.onTime = function(_progress) {
- _this.progressHandler(_progress)
- };
-
- var _flashVars = {
- "streamFMS" : true,
- "adVast" : false,
- "lg" : "fr_cinecast",
- "autoPlay" : options.autoPlay,
- "directVideoTitle" : "",
- "urlAcData" : options.urlAcData,
- "directVideoPath" : options.video,
- "host" : "http://allocine.fr"
- }
-
- if (typeof IriSP.__jsonMetadata["medias"][0].meta == "object" && typeof IriSP.__jsonMetadata["medias"][0].meta.subtitles == "string") {
- _flashVars.subTitlePath = IriSP.__jsonMetadata["medias"][0].meta.subtitles;
- }
-
-
- var params = {
- "allowScriptAccess" : "always",
- "wmode": "opaque",
- "flashvars" : IriSP.jQuery.param(_flashVars),
- "allowfullscreen" : true
- };
- var atts = {
- id : this.container
- };
- swfobject.embedSWF(options.acPlayerUrl, this.container, options.width, options.height, "10", null, null, params, atts);
-
-};
-
-IriSP.PopcornReplacement.allocine.prototype = new IriSP.PopcornReplacement.player("", {});
-
-IriSP.PopcornReplacement.allocine.prototype.ready = function() {
- this.player = document.getElementById(this.container);
- this.player.addEventListener("onStateChange", "onAllocineStateChange");
- this.player.cueVideoByUrl(this._options.video);
- this.trigger("loadedmetadata");
-};
-
-IriSP.PopcornReplacement.allocine.prototype.progressHandler = function(progressInfo) {
- this.trigger("timeupdate");
-}
-
-
-IriSP.PopcornReplacement.allocine.prototype.apiCall = function(_method, _arg) {
- if (this.player) {
- try {
- if (typeof _arg == "undefined") {
- return this.player.sendToActionScript(_method);
- } else {
- return this.player.sendToActionScript(_method, _arg);
- }
- } catch(e) {
- console.error('Exception while requesting AcPlayer for "' + _method + (typeof _arg == "undefined" ? '' : '" with argument "' + _arg ) + '"\n', e);
- return false;
- }
- } else {
- return false;
- }
-}
-
-IriSP.PopcornReplacement.allocine.prototype.stateHandler = function(state) {
- switch(state) {
- case 1:
- this.trigger("play");
- break;
-
- case 2:
- this.trigger("pause");
- break;
-
- case 3:
- this.trigger("seeked");
- break;
- }
-
-};/* To wrap a player the develop should create a new class derived from
-the IriSP.PopcornReplacement.player and defining the correct functions */
-
-/** jwplayer player wrapper */
-IriSP.PopcornReplacement.dailymotion = function(container, options) {
- /* Appel du constructeur de la classe parente */
- IriSP.PopcornReplacement.player.call(this, container, options);
-
- var _this = this;
-
- /* Définition des fonctions de commande :
- this.playerFns.play, .pause, .getPosition, .seek,
- .getMute, .setMute, .getVolume, .setVolume
- doivent être rattachés aux fonctions du player
- * */
-
- this.playerFns = {
- play : function() {
- if (_this.player) {
- return _this.player.playVideo();
- } else {
- return false;
- }
- },
- pause : function() {
- if (_this.player) {
- return _this.player.pauseVideo();
- } else {
- return false;
- }
- },
- getPosition : function() {
- if (_this.player) {
- return _this.player.getCurrentTime();
- } else {
- return 0;
- }
- },
- seek : function(pos) {
- if (_this.player) {
- return _this.player.seekTo(pos);
- } else {
- return false;
- }
- },
- getMute : function() {
- if (_this.player) {
- return _this.player.isMuted();
- } else {
- return false;
- }
- },
- setMute : function(p) {
- if (_this.player) {
- if (p) {
- _this.player.mute();
- }
- else {
- _this.player.unMute();
- }
- }
- },
- getVolume : function() {
- if (_this.player) {
- return _this.player.getVolume() / 100;
- } else {
- return false;
- }
- },
- setVolume : function(p) {
- if (_this.player) {
- _this.player.setVolume(Math.floor(100 * p));
- }
- },
- }
-
- /* Dailymotion utilise un système de fonctions référencées dans
- * des variables globales pour la gestion des événements.
- */
-
- window.onDailymotionPlayerReady = function() {
- _this.onReady();
- };
- window.onDailymotionStateChange = function(_state) {
- _this.onStateChange(_state);
- }
- window.onDailymotionVideoProgress = function(_progress) {
- _this.onProgress(_progress);
- }
-
- var params = {
- "allowScriptAccess" : "always",
- "wmode": "opaque"
- };
- var atts = {
- id : this.container
- };
- swfobject.embedSWF("http://www.dailymotion.com/swf?chromeless=1&enableApi=1", this.container, options.width, options.height, "8", null, null, params, atts);
-
-};
-
-IriSP.PopcornReplacement.dailymotion.prototype = new IriSP.PopcornReplacement.player("", {});
-
-IriSP.PopcornReplacement.dailymotion.prototype.onReady = function() {
-
- this.player = document.getElementById(this.container);
-
- this.player.addEventListener("onStateChange", "onDailymotionStateChange");
- this.player.addEventListener("onVideoProgress", "onDailymotionVideoProgress");
- this.player.cueVideoByUrl(this._options.video);
-
- this.trigger("loadedmetadata");
-};
-
-IriSP.PopcornReplacement.dailymotion.prototype.onProgress = function(progressInfo) {
- this.trigger("timeupdate");
-}
-
-IriSP.PopcornReplacement.dailymotion.prototype.onStateChange = function(state) {
-
- switch(state) {
- case 1:
- this.trigger("play");
- break;
-
- case 2:
- this.trigger("pause");
- break;
-
- case 3:
- this.trigger("seeked");
- break;
- }
-
-};/* To wrap a player the develop should create a new class derived from
- the IriSP.PopcornReplacement.player and defining the correct functions */
-
-/** jwplayer player wrapper */
-IriSP.PopcornReplacement.jwplayer = function(container, options) {
- /* appel du parent pour initialiser les structures communes à tous les players */
- IriSP.PopcornReplacement.player.call(this, container, options);
-
- if (options.autostart) {
- this.media.paused = false;
- this.trigger("play");
- }
-
- var _player = jwplayer(this.container),
- _this = this,
- _seekPause = false;
-
- /* Définition des fonctions de l'API - */
- this.playerFns = {
- play: function() { return _player.play(true); },
- pause: function() { return _player.pause(true); },
- getPosition: function() { return _player.getPosition(); },
- seek: function(pos) {
- _seekPause = _this.media.paused;
- return _player.seek(pos);
- },
- getMute: function() { return _player.getMute() },
- setMute: function(p) { return _player.setMute(p); },
- getVolume: function() { return _player.getVolume() / 100; },
- setVolume: function(p) { return _player.setVolume(Math.floor(100*p)); }
- }
-
- options.events = {
- onReady: function() {
- _this.trigger("loadedmetadata");
- },
- onTime: function() {
- if (_seekPause) {
- _player.pause(true);
- _seekPause = false;
- } else {
- if (_this.media.paused && _player.getState() === "PLAYING") {
- _this.media.paused = false;
- _this.trigger("play");
- }
- }
- _this.trigger("timeupdate");
- },
- onPlay: function() {
- if (!_seekPause) {
- _this.media.paused = false;
- _this.trigger("play");
- }
- },
- onPause: function() {
- _this.media.paused = true;
- _this.trigger("pause");
- },
- onSeek: function() {
- _this.trigger("seeked");
- }
- };
-
- _player.setup(options);
-};
-
-IriSP.PopcornReplacement.jwplayer.prototype = new IriSP.PopcornReplacement.player("", {});
-/* To wrap a player the develop should create a new class derived from
- the IriSP.PopcornReplacement.player and defining the correct functions */
-
-/** jwplayer player wrapper */
-IriSP.PopcornReplacement.htmlMashup = function(container, options, metadata) {
- /* appel du parent pour initialiser les structures communes à tous les players */
- IriSP.PopcornReplacement.player.call(this, container, options);
-
- this.mashup = metadata.currentMedia;
- this.$ = IriSP.jQuery(container);
-
- var _w = this.$.width(),
- _h = this.$.height(),
- _this = this;
-
- IriSP._(metadata.currentMedia.medias).each(function(_media) {
- var _tmpId = Popcorn.guid("video"),
- _videoEl = IriSP.jQuery('<video>'),
- _videoUrl = _media.video;
- if (typeof options.url_transform === "function") {
- _videoUrl = options.url_transform(_videoUrl);
- }
-
- _videoEl
- .attr({
- //src : _videoUrl,
- id : _tmpId,
- width : _w,
- height : _h
- })
- .css({
- position: "absolute",
- top: 0,
- left: 0
- });
-
- if(typeof _videoUrl === "string"){
- _videoEl.attr({src : _videoUrl});
- }
- else{
- // _videoUrl is an array of {src:"u",type:"m"}
- l = _videoUrl.length;
- for (var _i = 0; _i < l; _i++) {
- var srcNode = IriSP.jQuery('<source>');
- srcNode.attr({src:_videoUrl[_i]["src"], type:_videoUrl[_i]["type"]});
- _videoEl.append(srcNode);
- }
- }
- _this.$.append(_videoEl);
- _media.videoEl = _videoEl;
- _media.popcorn = Popcorn("#" + _tmpId);
- _media.loadedMetadata = false;
- _media.popcorn.on("loadedmetadata", function() {
- _media.loadedMetadata = true;
- var _allLoaded = true;
- for (var _i = 0; _i < metadata.currentMedia.medias.length; _i++) {
- _allLoaded = _allLoaded && metadata.currentMedia.medias[_i].loadedMetadata;
- }
- if (_allLoaded) {
- _this.changeCurrentAnnotation();
- _this.trigger("loadedmetadata");
- }
- });
- _media.popcorn.on("timeupdate", function() {
- if (!_this.media.paused && _media === _this.currentMedia) {
- var _time = Math.round( 1000 * _media.popcorn.currentTime() );
-// var _status = "Timeupdate from " + _media.id + " at time " + _time;
- if ( _time < _this.segmentEnd ) {
- if ( _time >= _this.segmentBegin ) {
- _this.timecode = _time - _this.timedelta;
-// _status += " within segment";
- } else {
- _this.timecode = _this.segmentBegin - _this.timedelta;
- _media.popcorn.currentTime(_this.segmentBegin / 1000);
-// _status += " before segment";
- }
- } else {
- _this.timecode = _this.segmentEnd - _this.timedelta;
- _media.popcorn.pause();
- _this.changeCurrentAnnotation();
-// _status += " after segment";
- }
-// _status += " (" + _this.segmentBegin + " to " + _this.segmentEnd + ")" + ", translated to " + _this.timecode;
-// console.log(_status);
- _this.trigger("timeupdate");
- }
- });
- });
-
- this.timecode = 0;
-
- /* Définition des fonctions de l'API */
- this.playerFns = {
- play: function() {
- _this.changeCurrentAnnotation();
- },
- pause: function() {
- _this.currentMedia.popcorn.pause();
- },
- getPosition: function() {
- return _this.timecode / 1000;
- },
- seek: function(pos) {
- _this.timecode = Math.round(pos * 1000);
- _this.changeCurrentAnnotation();
- },
- getMute: function() {
- var _res = (
- typeof _this.currentMedia !== "undefined"
- ? _this.currentMedia.popcorn.muted()
- : false
- );
- return _res;
- },
- setMute: function(p) {
- var _mute = !!p;
- for (var _i = 0; _i < _this.mashup.medias.length; _i++) {
- _this.mashup.medias[_i].popcorn.muted(_mute);
- }
- },
- getVolume: function() {
- var _res = (
- typeof _this.currentMedia !== "undefined"
- ? _this.currentMedia.popcorn.volume()
- : .5
- );
- return _res;
- },
- setVolume: function(_vol) {
- for (var _i = 0; _i < _this.mashup.medias.length; _i++) {
- _this.mashup.medias[_i].popcorn.volume(_vol);
- }
- }
- }
-
-};
-
-IriSP.PopcornReplacement.htmlMashup.prototype = new IriSP.PopcornReplacement.player("", {});
-
-IriSP.PopcornReplacement.htmlMashup.prototype.changeCurrentAnnotation = function() {
- var _annotation = this.mashup.getAnnotationAtTime( this.timecode );
- if (typeof _annotation == "undefined") {
- if (typeof this.currentMedia !== "undefined") {
- this.currentMedia.popcorn.pause();
- if (!this.media.paused) {
- this.media.paused = true;
- this.trigger("pause");
- }
- }
- return;
- }
- if (_annotation !== this.currentAnnotation) {
- this.currentAnnotation = _annotation;
- this.segmentBegin = this.currentAnnotation.annotation.begin.milliseconds;
- this.segmentEnd = this.currentAnnotation.annotation.end.milliseconds;
- this.timedelta = this.segmentBegin - this.currentAnnotation.begin.milliseconds;
- this.currentMedia = this.currentAnnotation.getMedia();
-
- for (var _i = 0; _i < this.mashup.medias.length; _i++) {
- if (this.mashup.medias[_i].id !== this.currentMedia.id) {
- this.mashup.medias[_i].videoEl.hide();
- this.mashup.medias[_i].popcorn.pause();
- } else {
- this.mashup.medias[_i].videoEl.show();
- }
- }
-/* PRELOADING */
- var _this = this,
- _preloadedMedias = [],
- _toPreload = this.mashup.getAnnotations().filter(function(_a) {
- return (_a.begin >= _this.currentAnnotation.end && _a.getMedia().id !== _this.currentMedia.id);
- });
- IriSP._(_toPreload).each(function(_a) {
- var _media = _a.getMedia();
- if (IriSP._(_preloadedMedias).indexOf(_media.id) === -1) {
- _preloadedMedias.push(_media.id);
- _media.popcorn.currentTime(_a.annotation.begin.getSeconds());
- //console.log("Preloading ", _media.id, " at t=", _a.annotation.begin.getSeconds());
- }
- });
-
-// console.log("Changed segment: media="+ this.currentMedia.id + ", from=" + this.segmentBegin + " to=" + this.segmentEnd +", timedelta = ", this.timedelta)
-// } else {
-// console.log("changeCurrentAnnotation called, but segment hasn't changed");
- }
- if (this.currentMedia.popcorn.readyState()) {
- this.currentMedia.popcorn.currentTime( (this.timecode + this.timedelta) / 1000);
- this.trigger("timeupdate");
- }
- if (!this.media.paused) {
- this.currentMedia.popcorn.play();
- }
-}
-/* To wrap a player the develop should create a new class derived from
-the IriSP.PopcornReplacement.player and defining the correct functions */
-
-/** jwplayer player wrapper */
-IriSP.PopcornReplacement.mashup = function(container, options) {
- /* Appel du constructeur de la classe parente */
- IriSP.PopcornReplacement.player.call(this, container, options);
-
- var _this = this;
-
- /* Définition des fonctions de commande :
- this.playerFns.play, .pause, .getPosition, .seek,
- .getMute, .setMute, .getVolume, .setVolume
- doivent être rattachés aux fonctions du player
- * */
-
- this.playerFns = {
- play : function() {
- if (_this.player) {
- return _this.player.playVideo();
- } else {
- return false;
- }
- },
- pause : function() {
- if (_this.player) {
- return _this.player.pauseVideo();
- } else {
- return false;
- }
- },
- getPosition : function() {
- if (_this.player) {
- return _this.player.getCurrentTime();
- } else {
- return 0;
- }
- },
- seek : function(pos) {
- if (_this.player) {
- return _this.player.seekTo(pos);
- } else {
- return false;
- }
- },
- getMute : function() {
- if (_this.player) {
- return _this.player.isMuted();
- } else {
- return false;
- }
- },
- setMute : function(p) {
- if (_this.player) {
- if (p) {
- _this.player.mute();
- }
- else {
- _this.player.unMute();
- }
- }
- },
- getVolume : function() {
- if (_this.player) {
- return _this.player.getVolume() / 2;
- } else {
- return false;
- }
- },
- setVolume : function(p) {
- if (_this.player) {
- _this.player.setVolume(Math.floor(2 * p));
- }
- },
- }
-
- /* Dailymotion utilise un système de fonctions référencées dans
- * des variables globales pour la gestion des événements.
- */
-
- window.onBabPlayerReady = function() {
- _this.onReady();
- };
- window.onBabStateChange = function(_state) {
- _this.onStateChange(_state);
- }
- window.onBabVideoProgress = function(_progress) {
- _this.onProgress(_progress);
- }
-
- var params = {
- allowScriptAccess : "always",
- wmode: "transparent",
- quality: "high",
- menu: true,
- bgcolor: "#869ca7"
- };
- var atts = {
- id : this.container
- };
- var flashvars = {
- urlData: options.mashup_xml
- };
- swfobject.embedSWF(options.mashup_swf, this.container, options.width, options.height, "8", null, flashvars, params, atts);
-
-};
-
-IriSP.PopcornReplacement.mashup.prototype = new IriSP.PopcornReplacement.player("", {});
-
-IriSP.PopcornReplacement.mashup.prototype.onReady = function() {
- this.player = document.getElementById(this.container);
- this.trigger("loadedmetadata");
-};
-
-IriSP.PopcornReplacement.mashup.prototype.onProgress = function(progressInfo) {
- this.trigger("timeupdate");
-}
-
-IriSP.PopcornReplacement.mashup.prototype.onStateChange = function(state) {
-
- switch(state) {
- case 1:
- this.trigger("play");
- break;
-
- case 2:
- this.trigger("pause");
- break;
-
- case 3:
- this.trigger("seeked");
- break;
- }
-
};/* LDT Platform Serializer */
if (typeof IriSP.serializers === "undefined") {
@@ -2487,7 +1575,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/ldt/ldt/static/ldt/metadataplayer/MediaList.js Wed Sep 19 01:53:14 2012 +0900
+++ b/src/ldt/ldt/static/ldt/metadataplayer/MediaList.js Wed Sep 19 15:03:51 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/ldt/ldt/static/ldt/metadataplayer/Mediafragment.js Wed Sep 19 01:53:14 2012 +0900
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Mediafragment.js Wed Sep 19 15:03:51 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/ldt/ldt/static/ldt/metadataplayer/Polemic.js Wed Sep 19 01:53:14 2012 +0900
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Polemic.js Wed Sep 19 15:03:51 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,16 +303,16 @@
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>');
- this.insertSubwidget(this.$.find(".Ldt-Polemic-Tooltip"), "tooltip", { type: "Tooltip" });
+ this.insertSubwidget(this.$.find(".Ldt-Polemic-Tooltip"), { type: "Tooltip" }, "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"
});
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/static/ldt/metadataplayer/PopcornPlayer.js Wed Sep 19 15:03:51 2012 +0900
@@ -0,0 +1,132 @@
+IriSP.Widgets.PopcornPlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.PopcornPlayer.prototype = new IriSP.Widgets.Widget();
+
+/* A Popcorn-based player for HTML5 Video, Youtube and Vimeo */
+
+IriSP.Widgets.PopcornPlayer.prototype.defaults = {
+ aspect_ratio: 14/9
+}
+
+IriSP.Widgets.PopcornPlayer.prototype.draw = function() {
+
+
+ if (typeof this.video === "undefined") {
+ this.video = this.media.video;
+ }
+
+ if (this.url_transform) {
+ this.video = this.url_transform(this.video);
+ }
+
+ if (!this.height) {
+ this.height = Math.floor(this.width/this.aspect_ratio);
+ this.$.css({
+ height: this.height
+ });
+ }
+
+ if (/^(https?:\/\/)?(www\.)?vimeo\.com/.test(this.video)) {
+
+ /* VIMEO */
+
+ var _popcorn = Popcorn.vimeo(this.container, this.video);
+
+ } else if (/^(https?:\/\/)?(www\.)?youtube\.com/.test(this.video)) {
+
+ /* YOUTUBE */
+
+ var _urlparts = this.video.split(/[?&]/),
+ _params = {};
+ for (var i = 1; i < _urlparts.length; i++) {
+ var _ppart = _urlparts[i].split('=');
+ _params[_ppart[0]] = decodeURIComponent(_ppart[1]);
+ }
+ _params.controls = 0;
+ _params.modestbranding = 1;
+ _url = _urlparts[0] + '?' + IriSP.jQuery.param(_params);
+
+ var _popcorn = Popcorn.youtube(this.container, _url);
+
+ } else {
+
+ /* DEFAULT HTML5 */
+
+ var _tmpId = IriSP._.uniqueId("popcorn"),
+ _videoEl = IriSP.jQuery('<video>');
+ _videoEl.attr({
+ id : _tmpId,
+ width : this.width,
+ height : this.height
+ });
+ if(typeof this.video === "string"){
+ _videoEl.attr("src",this.video);
+ } else {
+ for (var i = 0; i < this.video.length; i++) {
+ var _srcNode = IriSP.jQuery('<source>');
+ _srcNode.attr({
+ src: this.video[i].src,
+ type: this.video[i].type
+ });
+ _videoEl.append(_srcNode);
+ }
+ }
+ this.$.html(_videoEl);
+ var _popcorn = Popcorn("#" + _tmpId);
+ }
+
+ // Binding functions to Popcorn
+
+ this.media.getCurrentTime = function() {
+ return new IriSP.Model.Time(1000*_popcorn.currentTime());
+ }
+ this.media.getVolume = function() {
+ return _popcorn.volume();
+ }
+ this.media.getPaused = function() {
+ return _popcorn.media.paused;
+ }
+ this.media.getMuted = function() {
+ return _popcorn.muted();
+ }
+ this.media.setCurrentTime = function(_milliseconds) {
+ return _popcorn.currentTime(_milliseconds / 1000);
+ }
+ this.media.setVolume = function(_vol) {
+ return _popcorn.volume(_vol);
+ }
+ this.media.mute = function() {
+ return _popcorn.muted(true);
+ }
+ this.media.unmute = function() {
+ return _popcorn.muted(false);
+ }
+ this.media.play = function() {
+ return _popcorn.play();
+ }
+ this.media.pause = function() {
+ return _popcorn.pause();
+ }
+
+ // Binding Popcorn events to media
+
+ var _media = this.media;
+ _popcorn.on("timeupdate", function() {
+ _media.trigger("timeupdate", _media.getCurrentTime());
+ });
+
+ function simpleEventBind(_eventname) {
+ _popcorn.on(_eventname, function() {
+ _media.trigger(_eventname);
+ });
+ }
+
+ simpleEventBind("play");
+ simpleEventBind("pause");
+ simpleEventBind("seeked");
+ simpleEventBind("loadedmetadata");
+ simpleEventBind("volumechange");
+
+}
\ No newline at end of file
--- a/src/ldt/ldt/static/ldt/metadataplayer/Segments.js Wed Sep 19 01:53:14 2012 +0900
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Segments.js Wed Sep 19 15:03:51 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() {
@@ -77,7 +76,7 @@
_this.$segments.removeClass("inactive active");
});
});
- this.insertSubwidget(this.$.find(".Ldt-Segments-Tooltip"), "tooltip", { type: "Tooltip" });
+ this.insertSubwidget(this.$.find(".Ldt-Segments-Tooltip"), { type: "Tooltip" }, "tooltip");
this.$segments = this.$.find('.Ldt-Segments-Segment');
}
@@ -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/ldt/ldt/static/ldt/metadataplayer/Slice.js Wed Sep 19 01:53:14 2012 +0900
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Slice.js Wed Sep 19 15:03:51 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/ldt/ldt/static/ldt/metadataplayer/Slider.js Wed Sep 19 01:53:14 2012 +0900
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Slider.js Wed Sep 19 15:03:51 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("Player.MouseOver","onMouseover");
+ this.onMdpEvent("Player.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/ldt/ldt/static/ldt/metadataplayer/Slideshare.js Wed Sep 19 01:53:14 2012 +0900
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Slideshare.js Wed Sep 19 15:03:51 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/ldt/ldt/static/ldt/metadataplayer/Sparkline.js Wed Sep 19 01:53:14 2012 +0900
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Sparkline.js Wed Sep 19 15:03:51 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/ldt/ldt/static/ldt/metadataplayer/Tagcloud.js Wed Sep 19 01:53:14 2012 +0900
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Tagcloud.js Wed Sep 19 15:03:51 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/ldt/ldt/static/ldt/metadataplayer/Tooltip.js Wed Sep 19 01:53:14 2012 +0900
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Tooltip.js Wed Sep 19 15:03:51 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/ldt/ldt/static/ldt/metadataplayer/Trace.js Wed Sep 19 01:53:14 2012 +0900
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Trace.js Wed Sep 19 15:03:51 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) {
@@ -63,12 +74,8 @@
this.tracer.trace("TraceWidgetInit", {});
this.mouseLocation = '';
- IriSP.jQuery(".Ldt-Widget").bind("click mouseover mouseout", function(_e) {
- var _target = IriSP.jQuery(_e.target);
-
- while (!_target.hasClass("Ldt-TraceMe") && !_target.hasClass("Ldt-Widget") && _target.length) {
- _target = _target.parent();
- }
+ IriSP.jQuery(".Ldt-Widget").on("click mouseover mouseout", ".Ldt-TraceMe", function(_e) {
+ var _target = IriSP.jQuery(this);
var _widget = IriSP.jQuery(this).attr("widget-type"),
_data = {
@@ -95,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);
@@ -109,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;
});
@@ -134,16 +141,16 @@
delete _arg.widget;
delete _arg.type;
break;
- case 'timeupdate':
case 'play':
case 'pause':
- _arg.time = this.player.popcorn.currentTime() * 1000;
+ _arg.milliseconds = this.media.getCurrentTime().milliseconds;
+ case 'timeupdate':
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/ldt/ldt/static/ldt/metadataplayer/Tweet.js Wed Sep 19 01:53:14 2012 +0900
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Tweet.js Wed Sep 19 15:03:51 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();
}
Binary file src/ldt/ldt/static/ldt/metadataplayer/img/zoombuttons.png has changed
Binary file src/ldt/ldt/static/ldt/swf/ZeroClipboard.swf has changed