src/js/widgets/createAnnotationWidget.js
branchpopcorn-port
changeset 682 10a52271579d
parent 678 45385e19022a
child 683 00f37b85b2e2
--- 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;