Merge with d56201bf14469400951225a1e8ec9b532f5140f2
authorymh <ymh.work@gmail.com>
Fri, 01 Mar 2013 18:25:52 +0100
changeset 1122 3bda04d364dd
parent 1070 e1b6be4d85a4 (diff)
parent 1121 d56201bf1446 (current diff)
child 1123 ba7783d59d3f
Merge with d56201bf14469400951225a1e8ec9b532f5140f2
src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js
src/ldt/ldt/static/ldt/metadataplayer/Polemic.js
src/ldt/ldt/static/ldt/metadataplayer/Tweet.js
--- a/.hgtags	Fri Mar 01 18:05:02 2013 +0100
+++ b/.hgtags	Fri Mar 01 18:25:52 2013 +0100
@@ -142,3 +142,4 @@
 726f2cf3f020c6d4dd1075acb6b94de2dbec5685 V01.42
 c4d6ddd5f718d1e55441247aa4c4366a5d7be470 V01.43
 996bb5b1adbc920f8ecb49f9d7b45f51a8aa3c04 V01.44
+62be1eedf90855ab3cef1ab8a9f0c66130638673 V01.45
--- a/src/ldt/ldt/api/ldt/resources/project.py	Fri Mar 01 18:05:02 2013 +0100
+++ b/src/ldt/ldt/api/ldt/resources/project.py	Fri Mar 01 18:25:52 2013 +0100
@@ -11,6 +11,7 @@
 from tastypie.authorization import Authorization
 from tastypie.resources import Bundle, ModelResource, ALL
 from tastypie import fields
+from tastypie.exceptions import BadRequest
 
 
 class ProjectResource(ModelResource):
@@ -63,4 +64,7 @@
         assign('ldt_utils.view_project', everyone, bundle.obj)
         protect_models()
         return bundle
+    
+    def obj_delete_list(self, request=None, **kwargs):
+        raise BadRequest("PUT with a list of projects is forbidden.")
     
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/static/ldt/metadataplayer/HtmlPlayer.js	Fri Mar 01 18:25:52 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