diff --git a/dist/iiif-av-component.d.ts b/dist/iiif-av-component.d.ts
index caafdf4..cee1cb5 100644
--- a/dist/iiif-av-component.d.ts
+++ b/dist/iiif-av-component.d.ts
@@ -1,4 +1,4 @@
-// iiif-av-component v0.0.13 https://github.com/iiif-commons/iiif-av-component#readme
+// iiif-av-component v0.0.14 https://github.com/iiif-commons/iiif-av-component#readme
///
declare namespace IIIFComponents {
diff --git a/dist/iiif-av-component.js b/dist/iiif-av-component.js
index 2d92efc..f0117d2 100644
--- a/dist/iiif-av-component.js
+++ b/dist/iiif-av-component.js
@@ -1,4 +1,4 @@
-// iiif-av-component v0.0.13 https://github.com/iiif-commons/iiif-av-component#readme
+// iiif-av-component v0.0.14 https://github.com/iiif-commons/iiif-av-component#readme
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.iiifAvComponent = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o
diff --git a/dist/iiif-av-component.min.js b/dist/iiif-av-component.min.js
index ca2509e..739f547 100644
--- a/dist/iiif-av-component.min.js
+++ b/dist/iiif-av-component.min.js
@@ -1,2 +1,2 @@
-// iiif-av-component v0.0.13 https://github.com/iiif-commons/iiif-av-component#readme
+// iiif-av-component v0.0.14 https://github.com/iiif-commons/iiif-av-component#readme
!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.iiifAvComponent=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o1){var rangeTiming=temporal[1].split(","),duration=new IIIFComponents.AVComponentObjects.Duration(Number(rangeTiming[0]),Number(rangeTiming[1]));canvasInstance.currentDuration=duration,canvasInstance.highlightDuration(),canvasInstance.setCurrentTime(duration.start),canvasInstance.play()}}},AVComponent.prototype.showCanvas=function(canvasId){for(var i=0;i')}return CanvasInstance.prototype.init=function(){var _this=this;this._$canvasContainer=$(''),this._$optionsContainer=$(''),this._$rangeTimelineContainer=$(''),this._$canvasTimelineContainer=$(''),this._$durationHighlight=$(''),this._$timelineItemContainer=$(''),this._$controlsContainer=$(''),this._$playButton=$('"),this._$timingControls=$(""+this._data.content.currentTime+': / '+this._data.content.duration+': '),this._$volumeControl=$(''),this._$canvasTime=this._$timingControls.find(".canvasTime"),this._$canvasDuration=this._$timingControls.find(".canvasDuration"),this._$controlsContainer.append(this._$playButton,this._$timingControls,this._$volumeControl),this._$canvasTimelineContainer.append(this._$durationHighlight),this._$optionsContainer.append(this._$canvasTimelineContainer,this._$rangeTimelineContainer,this._$timelineItemContainer,this._$controlsContainer),this.$playerElement.append(this._$canvasContainer,this._$optionsContainer),this._canvasClockDuration=this.canvas.getDuration();var canvasWidth=this.canvas.getWidth(),canvasHeight=this.canvas.getHeight();canvasWidth?this._canvasWidth=canvasWidth:this._canvasWidth=this.$playerElement.parent().width(),canvasHeight?this._canvasHeight=canvasHeight:this._canvasHeight=this._canvasWidth*this._data.defaultAspectRatio;var that=this;this._$playButton.on("click",function(){_this._isPlaying?_this.pause():_this.play()}),this._$volumeControl.on("input",function(){that.setVolume(Number(this.value))}),this._$volumeControl.on("change",function(){that.setVolume(Number(this.value))}),this._$canvasTimelineContainer.slider({value:0,step:.01,orientation:"horizontal",range:"min",max:that._canvasClockDuration,animate:!1,create:function(evt,ui){},slide:function(evt,ui){that.setCurrentTime(ui.value)},stop:function(evt,ui){}}),this._contentAnnotations=[];var items=this.canvas.__jsonld.content[0].items;1===items.length&&this._$timelineItemContainer.hide();for(var i=0;i');break;case"video":$mediaElement=$('');break;case"audio":$mediaElement=$('');break;case"textualbody":$mediaElement=$(''+data.source+"
");break;default:return}if($mediaElement.css({top:data.top+"%",left:data.left+"%",width:data.width+"%",height:data.height+"%"}).hide(),data.element=$mediaElement,"video"===data.type.toLowerCase()||"audio"===data.type.toLowerCase()){data.timeout=null;var that_1=this;data.checkForStall=function(){var self=this;this.active?(that_1._checkMediaSynchronization(),this.element.get(0).readyState>0&&!this.outOfSync?that_1._playbackStalled(!1,self):(that_1._playbackStalled(!0,self),this.timeout&&window.clearTimeout(this.timeout),this.timeout=window.setTimeout(function(){self.checkForStall()},1e3))):that_1._playbackStalled(!1,self)}}if(this._contentAnnotations.push(data),this.$playerElement&&this._$canvasContainer.append($mediaElement),"video"===data.type.toLowerCase()||"audio"===data.type.toLowerCase()){var that_2=this,self_1=data;$mediaElement.on("loadstart",function(){self_1.checkForStall()}),$mediaElement.on("waiting",function(){self_1.checkForStall()}),$mediaElement.on("seeking",function(){}),$mediaElement.on("loadedmetadata",function(){that_2._readyCanvasesCount++,that_2._readyCanvasesCount===that_2._contentAnnotations.length&&(that_2.setCurrentTime(0),that_2._data.autoPlay&&that_2.play(),that_2._updateDurationDisplay(),that_2.fire(IIIFComponents.AVComponent.Events.CANVASREADY))}),$mediaElement.attr("preload","auto"),$mediaElement.get(0).load()}this._renderSyncIndicator(data)},CanvasInstance.prototype._updateCurrentTimeDisplay=function(){if(this._isLimitedToRange()&&this.currentDuration){var rangeClockTime=this._canvasClockTime-this.currentDuration.start;this._$canvasTime.text(IIIFComponents.AVComponentUtils.Utils.formatTime(rangeClockTime))}else this._$canvasTime.text(IIIFComponents.AVComponentUtils.Utils.formatTime(this._canvasClockTime))},CanvasInstance.prototype._updateDurationDisplay=function(){this._isLimitedToRange()&&this.currentDuration?this._$canvasDuration.text(IIIFComponents.AVComponentUtils.Utils.formatTime(this.currentDuration.getLength())):this._$canvasDuration.text(IIIFComponents.AVComponentUtils.Utils.formatTime(this._canvasClockDuration))},CanvasInstance.prototype.highlightDuration=function(){if(this.currentDuration){var totalLength=this._canvasClockDuration,timelineLength=this._$canvasTimelineContainer.width(),ratio=timelineLength/totalLength,start=this.currentDuration.start*ratio,end=this.currentDuration.end*ratio,width=end-start;this._$durationHighlight.css({left:start,width:width});var that=this;this._$rangeTimelineContainer.slider("destroy"),this._$rangeTimelineContainer.slider({value:this.currentDuration.start,step:.01,orientation:"horizontal",range:"min",min:this.currentDuration.start,max:this.currentDuration.end,animate:!1,create:function(evt,ui){},slide:function(evt,ui){that.setCurrentTime(ui.value)},stop:function(evt,ui){}})}},CanvasInstance.prototype.setVolume=function(value){for(var i=0;i');$timelineItem.css({left:leftPercent+"%",width:widthPercent+"%"});var $lineWrapper=$('');$timelineItem.appendTo($lineWrapper),mediaElementData.timelineElement=$timelineItem,this.$playerElement&&this._$timelineItemContainer.append($lineWrapper)},CanvasInstance.prototype.setCurrentTime=function(seconds){this._canvasClockTime=seconds,this._canvasClockStartDate=Date.now()-1e3*this._canvasClockTime,this.logMessage("SET CURRENT TIME to: "+this._canvasClockTime+" seconds."),this._canvasClockUpdater(),this._highPriorityUpdater(),this._lowPriorityUpdater(),this._synchronizeMedia()},CanvasInstance.prototype.play=function(withoutUpdate){if(!this._isPlaying){this._isLimitedToRange()&&this.currentDuration&&this._canvasClockTime>=this.currentDuration.end&&(this._canvasClockTime=this.currentDuration.start),this._canvasClockTime===this._canvasClockDuration&&(this._canvasClockTime=0),this._canvasClockStartDate=Date.now()-1e3*this._canvasClockTime;var self=this;this._highPriorityInterval=window.setInterval(function(){self._highPriorityUpdater()},this._highPriorityFrequency),this._lowPriorityInterval=window.setInterval(function(){self._lowPriorityUpdater()},this._lowPriorityFrequency),this._canvasClockInterval=window.setInterval(function(){self._canvasClockUpdater()},this._canvasClockFrequency),this._isPlaying=!0,withoutUpdate||this._synchronizeMedia(),this._$playButton.removeClass("play"),this._$playButton.addClass("pause"),this._$playButton.text(this._data.content.pause),this.fire(IIIFComponents.AVComponent.Events.PLAYCANVAS),this.logMessage("PLAY canvas")}},CanvasInstance.prototype.pause=function(withoutUpdate){window.clearInterval(this._highPriorityInterval),window.clearInterval(this._lowPriorityInterval),window.clearInterval(this._canvasClockInterval),this._isPlaying=!1,withoutUpdate||(this._highPriorityUpdater(),this._lowPriorityUpdater(),this._synchronizeMedia()),this._$playButton.removeClass("pause"),this._$playButton.addClass("play"),this._$playButton.text(this._data.content.play),this.fire(IIIFComponents.AVComponent.Events.PAUSECANVAS),this.logMessage("PAUSE canvas")},CanvasInstance.prototype._isLimitedToRange=function(){return this._data.limitToRange},CanvasInstance.prototype._canvasClockUpdater=function(){this._canvasClockTime=(Date.now()-this._canvasClockStartDate)/1e3,this._isLimitedToRange()&&this.currentDuration&&this._canvasClockTime>=this.currentDuration.end&&this.pause(),this._canvasClockTime>=this._canvasClockDuration&&(this._canvasClockTime=this._canvasClockDuration,this.pause())},CanvasInstance.prototype._highPriorityUpdater=function(){this._$rangeTimelineContainer.slider({value:this._canvasClockTime}),this._$canvasTimelineContainer.slider({value:this._canvasClockTime}),this._updateCurrentTimeDisplay(),this._updateDurationDisplay()},CanvasInstance.prototype._lowPriorityUpdater=function(){this._updateMediaActiveStates()},CanvasInstance.prototype._updateMediaActiveStates=function(){for(var contentAnnotation,i=0;i=this._canvasClockTime?(this._checkMediaSynchronization(),contentAnnotation.active||(this._synchronizeMedia(),contentAnnotation.active=!0,contentAnnotation.element.show(),contentAnnotation.timelineElement.addClass("active")),"Video"!=contentAnnotation.type&&"Audio"!=contentAnnotation.type||contentAnnotation.element[0].currentTime>contentAnnotation.element[0].duration-contentAnnotation.endOffset&&contentAnnotation.element[0].pause()):contentAnnotation.active&&(contentAnnotation.active=!1,contentAnnotation.element.hide(),contentAnnotation.timelineElement.removeClass("active"),"Video"!=contentAnnotation.type&&"Audio"!=contentAnnotation.type||contentAnnotation.element[0].pause())},CanvasInstance.prototype._synchronizeMedia=function(){for(var contentAnnotation,i=0;i=this._canvasClockTime)if(this._isPlaying){if(contentAnnotation.element[0].paused){var promise=contentAnnotation.element[0].play();promise&&promise["catch"](function(){})}}else contentAnnotation.element[0].pause();else contentAnnotation.element[0].pause();contentAnnotation.element[0].currentTime>contentAnnotation.element[0].duration-contentAnnotation.endOffset&&contentAnnotation.element[0].pause()}this.logMessage("SYNC MEDIA at: "+this._canvasClockTime+" seconds.")},CanvasInstance.prototype._checkMediaSynchronization=function(){for(var contentAnnotation,i=0,l=this._contentAnnotations.length;i=this._canvasClockTime){var correctTime=this._canvasClockTime-contentAnnotation.start+contentAnnotation.startOffset,factualTime=contentAnnotation.element[0].currentTime;if(Math.abs(factualTime-correctTime)>.4){contentAnnotation.outOfSync=!0;var lag=Math.abs(factualTime-correctTime);this.logMessage("DETECTED synchronization lag: "+Math.abs(lag)),contentAnnotation.element[0].currentTime=correctTime}else contentAnnotation.outOfSync=!1}},CanvasInstance.prototype._playbackStalled=function(aBoolean,syncMediaRequestingStall){if(aBoolean)this._stallRequestedBy.indexOf(syncMediaRequestingStall)<0&&this._stallRequestedBy.push(syncMediaRequestingStall),this._isStalled||(this.$playerElement&&this._showWorkingIndicator(this._$canvasContainer),this._wasPlaying=this._isPlaying,this.pause(!0),this._isStalled=aBoolean);else{var idx=this._stallRequestedBy.indexOf(syncMediaRequestingStall);idx>=0&&this._stallRequestedBy.splice(idx,1),0===this._stallRequestedBy.length&&(this._hideWorkingIndicator(),this._isStalled&&this._wasPlaying&&this.play(!0),this._isStalled=aBoolean)}},CanvasInstance.prototype._showWorkingIndicator=function($targetElement){var workingIndicator=$('Waiting...
');0==$targetElement.find(".workingIndicator").length&&$targetElement.append(workingIndicator)},CanvasInstance.prototype._hideWorkingIndicator=function(){$(".workingIndicator").remove()},CanvasInstance.prototype.resize=function(){if(this.$playerElement){var containerWidth=this._$canvasContainer.width();if(containerWidth){this._$canvasTimelineContainer.width(containerWidth);var $options=this.$playerElement.find(".optionsContainer");this._$canvasContainer.height(this.$playerElement.parent().height()-$options.height())}this.highlightDuration()}},CanvasInstance.prototype.on=function(name,callback,ctx){var e=this._e||(this._e={});(e[name]||(e[name]=[])).push({fn:callback,ctx:ctx})},CanvasInstance.prototype.fire=function(name){for(var args=[],_i=1;_i=10?hours:"0"+hours,minutes=Math.floor(seconds%3600/60),minutes=minutes>=10?minutes:"0"+minutes,seconds=Math.floor(seconds%3600%60),seconds=seconds>=10?seconds:"0"+seconds,hourValue=hours>=1?hours+":":"",hourValue+minutes+":"+seconds},Utils}();AVComponentUtils.Utils=Utils}(AVComponentUtils=IIIFComponents.AVComponentUtils||(IIIFComponents.AVComponentUtils={}))}(IIIFComponents||(IIIFComponents={}))}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)});
\ No newline at end of file
diff --git a/examples/js/iiif-av-component.js b/examples/js/iiif-av-component.js
index 2d92efc..f0117d2 100644
--- a/examples/js/iiif-av-component.js
+++ b/examples/js/iiif-av-component.js
@@ -1,4 +1,4 @@
-// iiif-av-component v0.0.13 https://github.com/iiif-commons/iiif-av-component#readme
+// iiif-av-component v0.0.14 https://github.com/iiif-commons/iiif-av-component#readme
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.iiifAvComponent = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o
diff --git a/package.json b/package.json
index d0e6003..2b3ada6 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "iiif-av-component",
- "version": "0.0.13",
+ "version": "0.0.14",
"description": "",
"main": "index.js",
"types": "./dist/iiif-av-component.d.ts",