63 |
63 |
64 this.selector.find(".Ldt-createAnnotation-Description") |
64 this.selector.find(".Ldt-createAnnotation-Description") |
65 .bind("propertychange keyup input paste", IriSP.wrap(this, this.handleTextChanges)); |
65 .bind("propertychange keyup input paste", IriSP.wrap(this, this.handleTextChanges)); |
66 |
66 |
67 /* the cinecast version of the player is supposed to pause when the user clicks on the button */ |
67 /* the cinecast version of the player is supposed to pause when the user clicks on the button */ |
68 if (this.cinecast_version) |
68 if (this.cinecast_version) { |
69 this.selector.find(".Ldt-createAnnotation-Description") |
69 this.selector.find(".Ldt-createAnnotation-Description") |
70 .one("propertychange keyup input paste js_mod", |
70 .one("propertychange keyup input paste js_mod", |
71 function() { if (!_this._Popcorn.media.paused) _this._Popcorn.pause() }); |
71 function() { if (!_this._Popcorn.media.paused) _this._Popcorn.pause() }); |
72 |
72 } |
73 /* the cinecast version expects the user to comment on a defined segment. |
73 /* the cinecast version expects the user to comment on a defined segment. |
74 As the widget is always shown, we need a way to update it's content as |
74 As the widget is always shown, we need a way to update it's content as |
75 time passes. We do this like we did with the annotationsWidget : we schedule |
75 time passes. We do this like we did with the annotationsWidget : we schedule |
76 a .code start function which will be called at the right time. |
76 a .code start function which will be called at the right time. |
77 */ |
77 */ |
114 if (!this.cinecast_version) |
114 if (!this.cinecast_version) |
115 this._Popcorn.listen("IriSP.PlayerWidget.AnnotateButton.clicked", |
115 this._Popcorn.listen("IriSP.PlayerWidget.AnnotateButton.clicked", |
116 IriSP.wrap(this, this.handleAnnotateSignal)); |
116 IriSP.wrap(this, this.handleAnnotateSignal)); |
117 }; |
117 }; |
118 |
118 |
|
119 /** handles clicks on the annotate button. Works only for the non-cinecast version */ |
119 IriSP.createAnnotationWidget.prototype.handleAnnotateSignal = function() { |
120 IriSP.createAnnotationWidget.prototype.handleAnnotateSignal = function() { |
120 // note : this signal is only handled by the non-cinecast version. |
121 |
121 if (this._hidden == false) { |
122 if (this._hidden == false) { |
122 this.selector.hide(); |
123 this.selector.hide(); |
123 this._hidden = true; |
124 this._hidden = true; |
124 |
125 |
125 // free the arrow. |
126 // free the arrow. |
126 this._Popcorn.trigger("IriSP.ArrowWidget.releaseArrow"); |
127 this._Popcorn.trigger("IriSP.ArrowWidget.releaseArrow"); |
|
128 this._Popcorn.trigger("IriSP.SliceWidget.hide"); |
|
129 |
127 } else { |
130 } else { |
128 this.showStartScreen(); |
131 this.showStartScreen(); |
129 this.selector.show(); |
132 this.selector.show(); |
130 this._hidden = false; |
133 this._hidden = false; |
|
134 var currentTime = this._Popcorn.currentTime(); |
131 |
135 |
132 // block the arrow. |
136 // block the arrow. |
133 this._Popcorn.trigger("IriSP.ArrowWidget.blockArrow"); |
137 this._Popcorn.trigger("IriSP.ArrowWidget.blockArrow"); |
|
138 var duration = +this._serializer.currentMedia().meta["dc:duration"]; |
|
139 var currentChapter = this._serializer.currentChapitre(currentTime); |
|
140 console.log(currentTime); |
|
141 var left = (currentChapter.begin / duration) * this.selector.width(); |
|
142 var width = (currentChapter.end / duration) * this.selector.width() - left; |
|
143 console.log([left, width]); |
|
144 this._Popcorn.trigger("IriSP.SliceWidget.position", [left, width]); |
|
145 this._Popcorn.trigger("IriSP.SliceWidget.show"); |
134 } |
146 } |
135 }; |
147 }; |
136 |
148 |
137 |
149 |
138 /** watch for changes in the textfield and change the buttons accordingly */ |
150 /** watch for changes in the textfield and change the buttons accordingly */ |