198 var currentTime = this._Popcorn.currentTime(); |
198 var currentTime = this._Popcorn.currentTime(); |
199 |
199 |
200 // block the arrow. |
200 // block the arrow. |
201 this._Popcorn.trigger("IriSP.ArrowWidget.blockArrow"); |
201 this._Popcorn.trigger("IriSP.ArrowWidget.blockArrow"); |
202 |
202 |
203 var duration = +this._serializer.currentMedia().meta["dc:duration"]; |
203 var duration = this._serializer.getDuration(); |
204 |
204 |
205 var currentChapter = this._serializer.currentChapitre(currentTime); |
205 var currentChapter = this._serializer.currentChapitre(currentTime); |
206 |
206 |
207 if (IriSP.null_or_undefined(currentChapter)) { |
207 if (IriSP.null_or_undefined(currentChapter)) { |
208 var left = this.selector.width() / 2; |
208 var left = this.selector.width() / 2; |
377 var _this = this; |
377 var _this = this; |
378 var apiJson = {annotations : [{}], meta: {}}; |
378 var apiJson = {annotations : [{}], meta: {}}; |
379 var annotation = apiJson["annotations"][0]; |
379 var annotation = apiJson["annotations"][0]; |
380 |
380 |
381 annotation["media"] = this._serializer.currentMedia()["id"]; |
381 annotation["media"] = this._serializer.currentMedia()["id"]; |
382 var duration_part = Math.round(this._serializer.currentMedia().meta["dc:duration"] / 20); |
382 var duration_part = Math.round(this._serializer.getDuration() / 20); |
383 |
383 |
384 if (this.cinecast_version) { |
384 if (this.cinecast_version) { |
385 annotation["begin"] = Math.round(this._Popcorn.currentTime() * 1000 - duration_part); |
385 annotation["begin"] = Math.round(this._Popcorn.currentTime() * 1000 - duration_part); |
386 annotation["end"] = Math.round(this._Popcorn.currentTime() * 1000 + duration_part); |
386 annotation["end"] = Math.round(this._Popcorn.currentTime() * 1000 + duration_part); |
387 } else { |
387 } else { |
388 var duration = +this._serializer.currentMedia().meta["dc:duration"]; |
388 var duration = this._serializer.getDuration(); |
389 annotation["begin"] = +((duration * (this.sliceLeft / 100)).toFixed(0)); |
389 annotation["begin"] = +((duration * (this.sliceLeft / 100)).toFixed(0)); |
390 annotation["end"] = +((duration * ((this.sliceWidth + this.sliceLeft) / 100)).toFixed(0)); |
390 annotation["end"] = +((duration * ((this.sliceWidth + this.sliceLeft) / 100)).toFixed(0)); |
391 } |
391 } |
392 |
392 |
393 // boundary checks |
393 // boundary checks |
394 if (annotation["begin"] < 0) |
394 if (annotation["begin"] < 0) |
395 annotation["begin"] = 0; |
395 annotation["begin"] = 0; |
396 |
396 |
397 if (annotation["end"] > this._serializer.currentMedia().meta["dc:duration"]) |
397 if (annotation["end"] > this._serializer.getDuration()) |
398 annotation["end"] = this._serializer.currentMedia().meta["dc:duration"]; |
398 annotation["end"] = this._serializer.getDuration(); |
399 |
399 |
400 |
400 |
401 annotation["type"] = this._serializer.getContributions(); |
401 annotation["type"] = this._serializer.getContributions(); |
402 if (typeof(annotation["type"]) === "undefined") |
402 if (typeof(annotation["type"]) === "undefined") |
403 annotation["type"] = ""; |
403 annotation["type"] = ""; |
442 if (typeof(this._serializer.getContributions()) === "undefined") { |
442 if (typeof(this._serializer.getContributions()) === "undefined") { |
443 /* set up a basic view */ |
443 /* set up a basic view */ |
444 var tmp_view = {"dc:contributor": "perso", "dc:creator": "perso", "dc:title": "Contributions", |
444 var tmp_view = {"dc:contributor": "perso", "dc:creator": "perso", "dc:title": "Contributions", |
445 "id": json.annotations[0].type} |
445 "id": json.annotations[0].type} |
446 |
446 |
447 this._serializer._data["annotation-types"].push(tmp_view); |
447 |
|
448 IriSP.get_aliased(this._serializer._data, ["annotation_types", "annotation-types"]).push(tmp_view); |
448 } |
449 } |
449 |
450 |
450 delete annotation.tags; |
451 delete annotation.tags; |
451 annotation.content.description = annotation.content.data; |
452 annotation.content.description = annotation.content.data; |
452 annotation.content.title = ""; |
453 annotation.content.title = ""; |