/**
* Changes the player source.
* @param {?string} contentSrc The URI for the content to be played. Leave
* blank to use the existing content.
*/
PlayerWrapper.prototype.changeSource = function (contentSrc) {
// Only try to pause the player when initialised with a source already
if (this.vjsPlayer.currentSrc()) {
this.vjsPlayer.currentTime(0);
this.vjsPlayer.pause();
}
if (contentSrc) {
this.vjsPlayer.src(contentSrc);
}
this.vjsPlayer.one('loadedmetadata', this.seekContentToZero.bind(this));
};
/**
* Seeks content to 00:00:00. This is used as an event handler for the
* loadedmetadata event, since seeking is not possible until that event has
* fired.
*/
PlayerWrapper.prototype.seekContentToZero = function () {
this.vjsPlayer.currentTime(0);
};
this.vjsPlayer.one('loadedmetadata', this.seekContentToZero.bind(this)); sometimes will be failed because of iOS bug
this.vjsPlayer.one('loadedmetadata', this.seekContentToZero.bind(this)); sometimes will be failed because of iOS bug
https://stackoverflow.com/questions/18266437/html5-video-currenttime-not-setting-properly-on-iphon