src/js/widgets/createAnnotationWidget.js
branchpopcorn-port
changeset 682 10a52271579d
parent 678 45385e19022a
child 683 00f37b85b2e2
equal deleted inserted replaced
681:9e113f912e4e 682:10a52271579d
   246                     _this.showEndScreen(annotation);
   246                     _this.showEndScreen(annotation);
   247                     if (_this.cinecast_version) {
   247                     if (_this.cinecast_version) {
   248                       window.setTimeout(IriSP.wrap(_this, function() { this.showStartScreen(); }), 5000);
   248                       window.setTimeout(IriSP.wrap(_this, function() { this.showStartScreen(); }), 5000);
   249                     }
   249                     }
   250                     
   250                     
       
   251                     // hide the slicer widget
       
   252                     if (!_this.cinecast_version) {
       
   253                       console.log("hie");
       
   254                       this._Popcorn.trigger("IriSP.SliceWidget.hide");
       
   255                     }                                        
   251                     });
   256                     });
   252   }
   257   }
   253 };
   258 };
   254 
   259 
   255 IriSP.createAnnotationWidget.prototype.handleSliderChanges = function(params) {
   260 IriSP.createAnnotationWidget.prototype.handleSliderChanges = function(params) {
   261   var _this = this;
   266   var _this = this;
   262   var apiJson = {annotations : [{}], meta: {}};
   267   var apiJson = {annotations : [{}], meta: {}};
   263   var annotation = apiJson["annotations"][0];
   268   var annotation = apiJson["annotations"][0];
   264   
   269   
   265   annotation["media"] = this._serializer.currentMedia()["id"];
   270   annotation["media"] = this._serializer.currentMedia()["id"];
       
   271   var duration_part = Math.round(this._serializer.currentMedia().meta["dc:duration"] / 20);
   266   
   272   
   267   if (this.cinecast_version) {   
   273   if (this.cinecast_version) {   
   268       annotation["begin"] = Math.round(this._Popcorn.currentTime() * 1000 - 10000);
   274       annotation["begin"] = Math.round(this._Popcorn.currentTime() * 1000 - duration_part);
   269       annotation["end"] = Math.round(this._Popcorn.currentTime() * 1000 + 10000);
   275       annotation["end"] = Math.round(this._Popcorn.currentTime() * 1000 + duration_part);
   270       if (annotation["begin"] < 0)
   276       if (annotation["begin"] < 0)
   271         annotation["begin"] = 0;
   277         annotation["begin"] = 0;
   272       
   278       
   273       if (annotation["end"] > this._serializer.currentMedia().meta["dc:duration"])
   279       if (annotation["end"] > this._serializer.currentMedia().meta["dc:duration"])
   274         annotation["end"] = this._serializer.currentMedia().meta["dc:duration"];
   280         annotation["end"] = this._serializer.currentMedia().meta["dc:duration"];