Skip to content

Commit

Permalink
use onloadedmetadata to trigger setcurrentime
Browse files Browse the repository at this point in the history
  • Loading branch information
edsilv committed Jan 5, 2018
1 parent db913d2 commit 643d2e1
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 22 deletions.
2 changes: 1 addition & 1 deletion dist/iiif-av-component.bundle.js

Large diffs are not rendered by default.

18 changes: 12 additions & 6 deletions dist/iiif-av-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,21 @@ var IIIFComponents;
canvasInstance.play();
}
});
$volumeControl.on('input', function () {
canvasInstance.setVolume(Number(this.value));
});
$volumeControl.on('change', function () {
canvasInstance.setVolume(Number(this.value));
});
canvasInstance.setCurrentTime(0);
if (this.options.data.autoPlay) {
canvasInstance.play();
}
$timingControls.find('.canvasDuration').text(IIIFComponents.AVComponentUtils.Utils.formatTime(canvasInstance.canvasClockDuration));
this._logMessage('CREATED CANVAS: ' + canvasInstance.canvasClockDuration + ' seconds, ' + canvasInstance.canvasWidth + ' x ' + canvasInstance.canvasHeight + ' px.');
var that = this;
canvasInstance.$playerElement[0].addEventListener('loadedmetadata', function () {
canvasInstance.setCurrentTime(0);
if (that.options.data.autoPlay) {
canvasInstance.play();
}
$timingControls.find('.canvasDuration').text(IIIFComponents.AVComponentUtils.Utils.formatTime(canvasInstance.canvasClockDuration));
that._logMessage('CREATED CANVAS: ' + canvasInstance.canvasClockDuration + ' seconds, ' + canvasInstance.canvasWidth + ' x ' + canvasInstance.canvasHeight + ' px.');
}, false);
};
AVComponent.prototype.getCanvasInstanceById = function (canvasId) {
canvasId = manifesto.Utils.normaliseUrl(canvasId);
Expand Down
Loading

0 comments on commit 643d2e1

Please sign in to comment.