# HG changeset patch # User veltr # Date 1349172315 -7200 # Node ID b4c6e64acb2d2bc7c56cd949dd0632451cd9b410 # Parent c1c762ad16974a81c9ea02d6a1dc3de8988ac162 Added a dual mode HTML/Flash player diff -r c1c762ad1697 -r b4c6e64acb2d src/widgets/AnnotationsList.js --- a/src/widgets/AnnotationsList.js Wed Sep 26 18:55:36 2012 +0200 +++ b/src/widgets/AnnotationsList.js Tue Oct 02 12:05:15 2012 +0200 @@ -17,7 +17,7 @@ ajax_url : false, /* number of milliseconds before/after the current timecode when calling the segment API */ - ajax_granularity : 300000, + ajax_granularity : 600000, default_thumbnail : "", /* URL when the annotation is not in the current project, * e.g. http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/{{media}}/{{project}}/{{annotationType}}#id={{annotation}} @@ -220,7 +220,7 @@ url : _url, tags : _annotation.getTagTexts(), specific_style : (typeof _bgcolor !== "undefined" ? "background-color: " + _bgcolor : ""), - audio : (_this.show_audio && _annotation.audio ? _annotation.audio.href : undefined), + audio : (_this.show_audio && _annotation.audio && _annotation.audio.href && _annotation.audio.href != "null" ? _annotation.audio.href : undefined), l10n: _this.l10n }; var _html = Mustache.to_html(_this.annotationTemplate, _data); diff -r c1c762ad1697 -r b4c6e64acb2d src/widgets/H264Player.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/widgets/H264Player.js Tue Oct 02 12:05:15 2012 +0200 @@ -0,0 +1,33 @@ +IriSP.Widgets.H264Player = function(player, config) { + IriSP.Widgets.Widget.call(this, player, config); +}; + +IriSP.Widgets.H264Player.prototype = new IriSP.Widgets.Widget(); + +IriSP.Widgets.H264Player.prototype.defaults = { + mime_type: "video/mp4", + normal_player: "PopcornPlayer", + fallback_player: "JwpPlayer" +} + +IriSP.Widgets.H264Player.prototype.draw = function() { + + if (typeof this.video === "undefined") { + this.video = this.media.video; + } + + var _props = [ "autostart", "video", "height", "width", "url_transform" ], + _opts = {}, + _canPlayType = document.createElement('video').canPlayType(this.mime_type); + + _opts.type = (_canPlayType == "maybe" || _canPlayType == "probably") ? this.normal_player : this.fallback_player; + + 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 diff -r c1c762ad1697 -r b4c6e64acb2d src/widgets/MashupPlayer.js --- a/src/widgets/MashupPlayer.js Wed Sep 26 18:55:36 2012 +0200 +++ b/src/widgets/MashupPlayer.js Tue Oct 02 12:05:15 2012 +0200 @@ -10,13 +10,14 @@ IriSP.Widgets.MashupPlayer.prototype.defaults = { aspect_ratio: 14/9, split_screen: false, - player_type: "PopcornPlayer" + player_type: "PopcornPlayer", + background: "#000000" } IriSP.Widgets.MashupPlayer.prototype.draw = function() { var _this = this, _mashup = this.media, - _pauseState = true, + _pauseState = (!this.autostart && !this.autoplay), _currentMedia = null, _currentAnnotation = null, _segmentBegin, @@ -88,6 +89,10 @@ }); } + this.$.css({ + background: this.background + }); + var _grid = Math.ceil(Math.sqrt(_mashup.medias.length)), _width = (this.split_screen ? this.width / _grid : this.width), _height = (this.split_screen ? this.height / _grid : this.height) @@ -210,6 +215,6 @@ } } - changeCurrentAnnotation(); + _mashup.on("loadedmetadata", changeCurrentAnnotation); } \ No newline at end of file diff -r c1c762ad1697 -r b4c6e64acb2d src/widgets/PopcornPlayer.js --- a/src/widgets/PopcornPlayer.js Wed Sep 26 18:55:36 2012 +0200 +++ b/src/widgets/PopcornPlayer.js Tue Oct 02 12:05:15 2012 +0200 @@ -46,6 +46,9 @@ } _params.controls = 0; _params.modestbranding = 1; + if (this.autostart || this.autoplay) { + _params.autoplay = 1; + } _url = _urlparts[0] + '?' + IriSP.jQuery.param(_params); var _popcorn = Popcorn.youtube(this.container, _url); @@ -75,7 +78,11 @@ } this.$.html(_videoEl); var _popcorn = Popcorn("#" + _tmpId); + if (this.autostart || this.autoplay) { + _popcorn.autoplay(true); + } } + // Binding functions to Popcorn diff -r c1c762ad1697 -r b4c6e64acb2d test/index.htm --- a/test/index.htm Wed Sep 26 18:55:36 2012 +0200 +++ b/test/index.htm Tue Oct 02 12:05:15 2012 +0200 @@ -13,7 +13,7 @@