Updated Metadataplayer -- Added Adaptive Player
authorveltr
Tue, 02 Oct 2012 13:06:27 +0200
changeset 815 356ed4516061
parent 814 fb232b3266b0
child 816 2840ad5b48ed
Updated Metadataplayer -- Added Adaptive Player
src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html
src/ldt/ldt/static/ldt/metadataplayer/AdaptivePlayer.js
src/ldt/ldt/static/ldt/metadataplayer/PopcornPlayer.js
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Mon Oct 01 15:53:12 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Tue Oct 02 13:06:27 2012 +0200
@@ -58,7 +58,9 @@
             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"
+            default_thumbnail : "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}css/imgs/video_sequence.png",
+            show_audio: true,
+            rtmp_streamer: "rtmp://media.iri.centrepompidou.fr/ddc_micro_record/"
         },{
             type: "Controller"
         },{
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/static/ldt/metadataplayer/AdaptivePlayer.js	Tue Oct 02 13:06:27 2012 +0200
@@ -0,0 +1,33 @@
+IriSP.Widgets.AdaptivePlayer = function(player, config) {
+    IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.AdaptivePlayer.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.AdaptivePlayer.prototype.defaults = {
+    mime_type: "video/mp4",
+    normal_player: "PopcornPlayer",
+    fallback_player: "JwpPlayer"
+}
+
+IriSP.Widgets.AdaptivePlayer.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
--- a/src/ldt/ldt/static/ldt/metadataplayer/PopcornPlayer.js	Mon Oct 01 15:53:12 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/PopcornPlayer.js	Tue Oct 02 13:06:27 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