--- a/src/ldt/ldt/static/ldt/metadataplayer/AdaptivePlayer.js Thu Jan 17 11:35:19 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/AdaptivePlayer.js Thu Jan 17 12:54:18 2013 +0100
@@ -6,7 +6,7 @@
IriSP.Widgets.AdaptivePlayer.prototype.defaults = {
mime_type: "video/mp4",
- normal_player: "PopcornPlayer",
+ normal_player: "HtmlPlayer",
fallback_player: "JwpPlayer"
}
--- a/src/ldt/ldt/static/ldt/metadataplayer/AutoPlayer.js Thu Jan 17 11:35:19 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/AutoPlayer.js Thu Jan 17 12:54:18 2013 +0100
@@ -27,7 +27,7 @@
},
{
regexp: /\.(ogg|ogv|webm)$/,
- type: "PopcornPlayer"
+ type: "HtmlPlayer"
},
{
regexp: /^(https?:\/\/)?(www\.)?youtube\.com/,
@@ -57,7 +57,7 @@
if (_opts.type === "AdaptivePlayer") {
var _canPlayType = document.createElement('video').canPlayType("video/mp4");
- _opts.type = (_canPlayType == "maybe" || _canPlayType == "probably") ? "PopcornPlayer" : "JwpPlayer";
+ _opts.type = (_canPlayType == "maybe" || _canPlayType == "probably") ? "HtmlPlayer" : "JwpPlayer";
}
if (_rtmprgx.test(this.video)) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/static/ldt/metadataplayer/HtmlPlayer.js Thu Jan 17 12:54:18 2013 +0100
@@ -0,0 +1,127 @@
+IriSP.Widgets.HtmlPlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.HtmlPlayer.prototype = new IriSP.Widgets.Widget();
+
+
+IriSP.Widgets.HtmlPlayer.prototype.defaults = {
+}
+
+IriSP.Widgets.HtmlPlayer.prototype.draw = function() {
+
+
+ if (typeof this.video === "undefined") {
+ this.video = this.media.video;
+ }
+
+ if (this.url_transform) {
+ this.video = this.url_transform(this.video);
+ }
+
+ var videoEl = IriSP.jQuery('<video>');
+ videoEl.attr({
+ width : this.width,
+ height : this.height || undefined
+ });
+ 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);
+ if (this.autostart || this.autoplay) {
+ videoEl.attr("autoplay", true);
+ }
+
+ var mediaEl = videoEl[0],
+ media = this.media;
+
+ // Binding functions to Popcorn
+ media.on("setcurrenttime", function(_milliseconds) {
+ try {
+ mediaEl.currentTime = (_milliseconds / 1000);
+ } catch (err) {
+
+ }
+ });
+
+ media.on("setvolume", function(_vol) {
+ media.volume = _vol;
+ try {
+ mediaEl.volume = _vol;
+ } catch (err) {
+
+ }
+ });
+
+ media.on("setmuted", function(_muted) {
+ media.muted = _muted;
+ try {
+ mediaEl.muted = _muted;
+ } catch (err) {
+
+ }
+ });
+
+ media.on("setplay", function() {
+ try {
+ mediaEl.play();
+ } catch (err) {
+
+ }
+ });
+
+ media.on("setpause", function() {
+ try {
+ mediaEl.pause();
+ } catch (err) {
+
+ }
+ });
+
+ // Binding Popcorn events to media
+ function getVolume() {
+ media.muted = mediaEl.muted;
+ media.volume = mediaEl.volume;
+ }
+
+ videoEl.on("loadedmetadata", function() {
+ getVolume();
+ media.trigger("loadedmetadata");
+ media.trigger("volumechange");
+ })
+
+ videoEl.on("timeupdate", function() {
+ media.trigger("timeupdate", new IriSP.Model.Time(1000*mediaEl.currentTime));
+ });
+
+ videoEl.on("volumechange", function() {
+ getVolume();
+ media.trigger("volumechange");
+ })
+
+ videoEl.on("play", function() {
+ media.trigger("play");
+ });
+
+ videoEl.on("pause", function() {
+ media.trigger("pause");
+ });
+
+ videoEl.on("seeking", function() {
+ media.trigger("seeking");
+ });
+
+ videoEl.on("seeked", function() {
+ media.trigger("seeked");
+ });
+
+}
\ No newline at end of file
--- a/src/ldt/ldt/static/ldt/metadataplayer/JwpPlayer.js Thu Jan 17 11:35:19 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/JwpPlayer.js Thu Jan 17 12:54:18 2013 +0100
@@ -36,7 +36,9 @@
_opts.flashplayer = IriSP.getLib("jwPlayerSWF");
_opts["controlbar.position"] = "none";
_opts.width = this.width;
- _opts.height = this.height || Math.floor(.643*this.width);
+ if (this.height) {
+ _opts.height = this.height;
+ }
for (var i = 0; i < _props.length; i++) {
if (typeof this[_props[i]] !== "undefined") {
--- a/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js Thu Jan 17 11:35:19 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js Thu Jan 17 12:54:18 2013 +0100
@@ -126,17 +126,17 @@
});
this.$.find('.Ldt-Loader').detach();
- var endload = false;
+ this.widgetsLoaded = false;
this.on("widget-loaded", function() {
- if (endload) {
+ if (_this.widgetsLoaded) {
return;
}
var isloaded = !IriSP._(_this.widgets).any(function(w) {
return !(w && w.isLoaded())
});
if (isloaded) {
- endload = true;
+ _this.widgetsLoaded = true;
_this.trigger("widgets-loaded");
}
});
@@ -801,6 +801,7 @@
this.volume = .5;
this.paused = true;
this.muted = false;
+ this.loadedMetadata = false;
var _this = this;
this.on("play", function() {
_this.paused = false;
@@ -825,6 +826,9 @@
_this.trigger("enter-annotation",_a);
});
});
+ this.on("loadedmetadata", function() {
+ _this.loadedMetadata = true;
+ })
}
Model.Playable.prototype = new Model.Element();
--- a/src/ldt/ldt/static/ldt/metadataplayer/Mediafragment.js Thu Jan 17 11:35:19 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Mediafragment.js Thu Jan 17 12:54:18 2013 +0100
@@ -18,16 +18,18 @@
IriSP.Widgets.Mediafragment.prototype = new IriSP.Widgets.Widget();
IriSP.Widgets.Mediafragment.prototype.draw = function() {
- this.onMediaEvent("pause","setHashToTime");
+ this.onMediaEvent("setpause","setHashToTime");
var _this = this;
this.getWidgetAnnotations().forEach(function(_annotation) {
_annotation.on("click", function() {
_this.setHashToAnnotation(_annotation.id);
})
});
- this.player.on("widgets-loaded", function() {
- _this.goToHash();
- });
+ if (this.media.loadedMetadata) {
+ this.goToHash();
+ } else {
+ this.onMediaEvent("loadedmetadata","goToHash");
+ }
}
IriSP.Widgets.Mediafragment.prototype.setWindowHash = function(_hash) {
--- a/src/ldt/ldt/static/ldt/metadataplayer/Polemic.js Thu Jan 17 11:35:19 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Polemic.js Thu Jan 17 12:54:18 2013 +0100
@@ -19,7 +19,7 @@
IriSP.Widgets.Polemic.prototype.defaults = {
element_width : 5,
element_height : 5,
- max_elements : 15,
+ max_elements: 20,
annotation_type : "tweet",
defaultcolor : "#585858",
foundcolor : "#fc00ff",
@@ -137,8 +137,8 @@
_annotation.on("select", function() {
if (_this.tooltip) {
_this.tooltip.show(
- Math.floor(_elx + (_this.element_width - 1) / 2),
- _ely,
+ + Math.floor(_elx + (_this.element_width - 1) / 2),
+ + _ely,
_annotation.title,
_col
);
@@ -272,10 +272,10 @@
_html = '<p>' + _this.l10n.from_ + _el.attr("begin-time") + _this.l10n._to_ + _el.attr("end-time") + '</p>';
for (var _i = 0; _i <= _this.polemics.length; _i++) {
var _color = _i ? _this.polemics[_i - 1].color : _this.defaultcolor;
- _html += '<div class="Ldt-Tooltip-Color" style="background: ' + _color + '"></div><p>' + _nums[_i] + _this.l10n._annotations + '</p>'
+ _html += '<div class="Ldt-Tooltip-AltColor" style="background: ' + _color + '"></div><p>' + _nums[_i] + _this.l10n._annotations + '</p>'
}
if (_this.tooltip) {
- _this.tooltip.show(_el.attr("pos-x"), _el.attr("pos-y"), _html);
+ _this.tooltip.show(+ _el.attr("pos-x"), + _el.attr("pos-y"), _html);
}
})
.mouseout(function() {
--- a/src/ldt/ldt/static/ldt/metadataplayer/PopcornPlayer.js Thu Jan 17 11:35:19 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/PopcornPlayer.js Thu Jan 17 12:54:18 2013 +0100
@@ -7,7 +7,6 @@
/* 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() {
@@ -21,13 +20,6 @@
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 */
@@ -62,7 +54,7 @@
_videoEl.attr({
id : _tmpId,
width : this.width,
- height : this.height
+ height : this.height || undefined
});
if(typeof this.video === "string"){
_videoEl.attr("src",this.video);
--- a/src/ldt/ldt/static/ldt/metadataplayer/Tooltip.css Thu Jan 17 11:35:19 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Tooltip.css Thu Jan 17 12:54:18 2013 +0100
@@ -108,6 +108,10 @@
float: left; margin: 8px 2px 2px 8px; width: 10px; height: 10px;
}
+.Ldt-Tooltip-AltColor {
+ float: left; margin: 2px 2px 2px 3px; width: 10px; height: 10px;
+}
+
.Ldt-Tooltip img {
max-width: 140px; max-height: 80px; margin: 2px 20px;
}
--- a/src/ldt/ldt/static/ldt/metadataplayer/Tooltip.js Thu Jan 17 11:35:19 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Tooltip.js Thu Jan 17 12:54:18 2013 +0100
@@ -56,8 +56,8 @@
shift = Math.max(x - this.__halfWidth - this.min_x, - this.__maxShift);
}
- if (typeof this.max_x !== "undefined" && (x + this.__halfWidth > this.max_x)) {
- shift = Math.min(x + this.__halfWidth - this.max_x, this.__maxShift);
+ if (typeof this.max_x !== "undefined" && (+x + this.__halfWidth > this.max_x)) {
+ shift = Math.min(+ x + this.__halfWidth - this.max_x, this.__maxShift);
}
this.$tooltip.css({
--- a/src/ldt/ldt/static/ldt/metadataplayer/Tweet.js Thu Jan 17 11:35:19 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Tweet.js Thu Jan 17 12:54:18 2013 +0100
@@ -6,7 +6,7 @@
IriSP.Widgets.Tweet.prototype = new IriSP.Widgets.Widget();
IriSP.Widgets.Tweet.prototype.defaults = {
- hide_timeout: 5000,
+ hide_timeout: 10000,
polemics : [
{
"keywords" : [ "++" ],