set the duration of the cinecast annotation as a function of the total length of popcorn-port
authorhamidouk
Thu, 19 Jan 2012 12:48:05 +0100
branchpopcorn-port
changeset 682 10a52271579d
parent 681 9e113f912e4e
child 683 00f37b85b2e2
set the duration of the cinecast annotation as a function of the total length of the media.
src/js/widgets/createAnnotationWidget.js
--- a/src/js/widgets/createAnnotationWidget.js	Thu Jan 19 12:39:58 2012 +0100
+++ b/src/js/widgets/createAnnotationWidget.js	Thu Jan 19 12:48:05 2012 +0100
@@ -248,6 +248,11 @@
                       window.setTimeout(IriSP.wrap(_this, function() { this.showStartScreen(); }), 5000);
                     }
                     
+                    // hide the slicer widget
+                    if (!_this.cinecast_version) {
+                      console.log("hie");
+                      this._Popcorn.trigger("IriSP.SliceWidget.hide");
+                    }                                        
                     });
   }
 };
@@ -263,10 +268,11 @@
   var annotation = apiJson["annotations"][0];
   
   annotation["media"] = this._serializer.currentMedia()["id"];
+  var duration_part = Math.round(this._serializer.currentMedia().meta["dc:duration"] / 20);
   
   if (this.cinecast_version) {   
-      annotation["begin"] = Math.round(this._Popcorn.currentTime() * 1000 - 10000);
-      annotation["end"] = Math.round(this._Popcorn.currentTime() * 1000 + 10000);
+      annotation["begin"] = Math.round(this._Popcorn.currentTime() * 1000 - duration_part);
+      annotation["end"] = Math.round(this._Popcorn.currentTime() * 1000 + duration_part);
       if (annotation["begin"] < 0)
         annotation["begin"] = 0;