diff -r 7c67caaafdeb -r 761ba7426984 web/res/metadataplayer/HtmlMashupPlayer.js --- a/web/res/metadataplayer/HtmlMashupPlayer.js Mon Nov 20 18:10:58 2023 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,345 +0,0 @@ -IriSP.Widgets.HtmlMashupPlayer = function(player, config) { - IriSP.Widgets.Widget.call(this, player, config); -}; - -IriSP.Widgets.HtmlMashupPlayer.prototype = new IriSP.Widgets.Widget(); - - -IriSP.Widgets.HtmlMashupPlayer.prototype.defaults = { - aspect_ratio: 14/9, - background: "#333333" -}; - -IriSP.Widgets.HtmlMashupPlayer.prototype.draw = function() { - - if (!this.height && this.aspect_ratio) { - this.height = this.width / this.aspect_ratio; - this.$.css("height", this.height); - } - - if (this.background) { - this.$.css("background", this.background); - } - - var mashup = this.media, - sel = this.$, - width = this.width, - height = this.height, - url_transform = this.url_transform; - - mashup.currentMedia = null; - mashup.currentAnnotation = null; - mashup.seeking = false; - var mashupSegmentBegin, - mashupSegmentEnd, - mashupTimecode = 0, - // seekdiv = $(".video-wait"), - mashupTimedelta; - -/* - function showSeek() { - if (currentMedia.seeking) { - seekdiv.show(); - } - } -*/ - - function changeCurrentAnnotation() { - if (mashupTimecode >= mashup.duration) { - if (!mashup.paused) { - mashup.paused = true; - mashup.trigger("pause"); - } - mashupTimecode = 0; - } - var _annotation = mashup.getAnnotationAtTime( mashupTimecode ); - if (typeof _annotation === "undefined") { - if (mashup.currentMedia) { - mashup.currentMedia.pause(); - if (!mashup.paused) { - mashup.paused = true; - mashup.trigger("pause"); - } - } - return; - } - mashup.currentAnnotation = _annotation; - mashupSegmentBegin = mashup.currentAnnotation.annotation.begin.milliseconds; - mashupSegmentEnd = mashup.currentAnnotation.annotation.end.milliseconds; - mashupTimedelta = mashupSegmentBegin - mashup.currentAnnotation.begin.milliseconds; - mashup.currentMedia = mashup.currentAnnotation.getMedia(); - mashup.getMedias().forEach(function(_media) { - if (_media !== mashup.currentMedia) { - _media.hide(); - _media.pause(); - } else { - _media.show(); - } - }); - - mashup.currentMedia.setCurrentTime( mashupTimecode + mashupTimedelta); - mashup.currentMedia.seeking = true; - - if (!mashup.paused) { - mashup.currentMedia.play(); - mashup.seeking = true; -// setTimeout(showSeek,200); - } - mashup.trigger("timeupdate", new IriSP.Model.Time(mashupTimecode)); - - } - - mashup.getMedias().forEach(addMedia); - changeCurrentAnnotation(); - mashup.trigger("loadedmetadata"); - - function addMedia(media) { - if (media.has_player) { - return; - } - media.has_player = true; - var videourl = media.video; - if (typeof url_transform === "function") { - videourl = url_transform(media.video); - } - var videoid = "video_" + media.id, - videoElement; - - media.show = function() { - - if (document.getElementById(videoid)) { - return; - } - - media.loaded = false; - media.paused = true; - var videoSelector = $('