(function () { var supportsTextTracks; var hlsPlayer; var requiresSettingStartTimeOnStart; var subtitleTrackIndexToSetOnPlaying; function htmlMediaRenderer(options) { var mediaElement; var self = this; function onEnded() { Events.trigger(self, 'ended'); } function onTimeUpdate() { //if (isViblastStarted) { // // This is a workaround for viblast not stopping playback at the end // var time = this.currentTime; // var duration = this.duration; // if (duration) { // if (time >= (duration - 1)) { // //onEnded(); // return; // } // } //} Events.trigger(self, 'timeupdate'); } function onVolumeChange() { Events.trigger(self, 'volumechange'); } function onOneAudioPlaying(e) { var elem = e.target; elem.removeEventListener('playing', onOneAudioPlaying); $('.mediaPlayerAudioContainer').hide(); } function onPlaying() { Events.trigger(self, 'playing'); } function onPlay() { Events.trigger(self, 'play'); } function onPause() { Events.trigger(self, 'pause'); } function onClick() { Events.trigger(self, 'click'); } function onDblClick() { Events.trigger(self, 'dblclick'); } function onError(e) { var elem = e.target; var errorCode = elem.error ? elem.error.code : ''; console.log('Media element error code: ' + errorCode); Events.trigger(self, 'error'); } function onLoadedMetadata(e) { var elem = e.target; elem.removeEventListener('loadedmetadata', onLoadedMetadata); if (!hlsPlayer) { elem.play(); } } function requireHlsPlayer(callback) { require(['hlsjs'], function (hls) { window.Hls = hls; callback(); }); } function getStartTime(url) { var src = url; var parts = src.split('#'); if (parts.length > 1) { parts = parts[parts.length - 1].split('='); if (parts.length == 2) { return parseFloat(parts[1]); } } return 0; } function onOneVideoPlaying(e) { var element = e.target; element.removeEventListener('playing', onOneVideoPlaying); self.setCurrentTrackElement(subtitleTrackIndexToSetOnPlaying); var requiresNativeControls = !self.enableCustomVideoControls(); if (requiresNativeControls) { $(element).attr('controls', 'controls'); } if (requiresSettingStartTimeOnStart) { var src = (self.currentSrc() || '').toLowerCase(); var startPositionInSeekParam = getStartTime(src); // Appending #t=xxx to the query string doesn't seem to work with HLS if (startPositionInSeekParam && src.indexOf('.m3u8') != -1) { var delay = browserInfo.safari ? 2500 : 0; if (delay) { setTimeout(function () { element.currentTime = startPositionInSeekParam; }, delay); } else { element.currentTime = startPositionInSeekParam; } } } } function createAudioElement() { var elem = $('.mediaPlayerAudio'); if (!elem.length) { var html = ''; var requiresControls = !MediaPlayer.canAutoPlayAudio(); if (requiresControls) { html += '