https://framtidsfredag.no/wp-content/plugins/smart-bb-plugin/modul…/js/hls-video-player.js?ver=1.4.5
1(()=>{function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,i(s.key),s)}}function i(t){var i=function(t,i){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var s=n.call(t,i||"default");if("object"!=e(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===i?String:Number)(t)}(t,"string");return"symbol"==e(i)?i:i+""}var n=function(){return e=function e(t){var i=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.settings=t,this.selector=t.selector,this.wrapper=document.querySelector(this.selector),this.wrapper&&(this.video=this.wrapper.querySelector(".smart-bb-hls-video-player"),this.video&&(this.useHLS=t.useHLS||!1,this.playerStyle=t.playerStyle||"functional",this.allowFullscreen=!1!==t.allowFullscreen,this.hls=null,this._onMouseMove=null,this._onMouseUp=null,this._onFullscreenChange=function(){return i._updateFullscreenState()},this._progressFilled=null,this._progressHandle=null,this._currentTimeEl=null,this._durationEl=null,this._volumeFilled=null,this._volumeHandle=null,this._init()))},i=[{key:"_init",value:function(){this.useHLS&&"undefined"!=typeof Hls?this._initHLS():this._initMP4(),this._setupEventListeners()}},{key:"_initHLS",value:function(){var e=this,t=this.video.getAttribute("data-hls-url");t?Hls.isSupported()?(this.hls=new Hls({enableWorker:!0,lowLatencyMode:!1}),this.hls.loadSource(t),this.hls.attachMedia(this.video),this.hls.on(Hls.Events.MANIFEST_PARSED,function(){e._onVideoReady()}),this.hls.on(Hls.Events.ERROR,function(t,i){i.fatal&&e._fallbackToMP4()})):this.video.canPlayType("application/vnd.apple.mpegurl")?(this.video.src=t,this._onVideoReady()):this._initMP4():this._initMP4()}},{key:"_initMP4",value:function(){var e=this.video.getAttribute("data-mp4-url");this.video.getAttribute("src")||this.video.querySelector("source[src]")?this._onVideoReady():e&&(this.video.src=e,this._onVideoReady())}},{key:"_fallbackToMP4",value:function(){this.hls&&(this.hls.destroy(),this.hls=null),this._initMP4()}},{key:"_onVideoReady",value:function(){if("decorative"!==this.playerStyle){var e=this.wrapper.querySelector(".smart-bb-hls-video-controls");e&&(e.style.display="flex")}this._updateVolume()}},{key:"_setupEventListeners",value:function(){var e=this;this._progressFilled=this.wrapper.querySelector(".smart-bb-hls-video-progress-filled"),this._progressHandle=this.wrapper.querySelector(".smart-bb-hls-video-progress-handle"),this._currentTimeEl=this.wrapper.querySelector(".smart-bb-hls-video-current-time"),this._durationEl=this.wrapper.querySelector(".smart-bb-hls-video-duration"),this._volumeFilled=this.wrapper.querySelector(".smart-bb-hls-video-volume-filled"),this._volumeHandle=this.wrapper.querySelector(".smart-bb-hls-video-volume-handle");var t=this.wrapper.querySelector(".smart-bb-hls-video-play-pause");t&&t.addEventListener("click",function(){return e._togglePlayPause()}),this.video.addEventListener("click",function(){return e._togglePlayPause()}),"functional"===this.playerStyle&&(this._setupProgressBar(),this._setupVolumeControls(),this.allowFullscreen&&this._setupFullscreen()),this.video.addEventListener("play",function(){e.wrapper.classList.add("is-playing")}),this.video.addEventListener("pause",function(){e.wrapper.classList.remove("is-playing")}),this.video.addEventListener("timeupdate",function(){return e._updateProgress()}),this.video.addEventListener("loadedmetadata",function(){return e._updateTimeDisplay()}),this.video.addEventListener("volumechange",function(){return e._updateVolume()})}},{key:"_setupProgressBar",value:function(){var e=this,t=this.wrapper.querySelector(".smart-bb-hls-video-progress-bar");if(t){var i=!1,n=function(i){var n=t.getBoundingClientRect(),s=Math.max(0,Math.min(1,(i.clientX-n.left)/n.width));e._seek(s)};t.addEventListener("mousedown",function(e){i=!0,n(e)}),this._onMouseMove=function(e){i&&n(e)},this._onMouseUp=function(){i=!1},document.addEventListener("mousemove",this._onMouseMove),document.addEventListener("mouseup",this._onMouseUp)}}},{key:"_setupVolumeControls",value:function(){var e=this,t=this.wrapper.querySelector(".smart-bb-hls-v
1ideo-mute");t&&t.addEventListener("click",function(){return e._toggleMute()});var i=this.wrapper.querySelector(".smart-bb-hls-video-volume-bar");if(i){var n=!1,s=function(t){var n=i.getBoundingClientRect(),s=1-Math.max(0,Math.min(1,(t.clientY-n.top)/n.height));e._setVolume(s)};i.addEventListener("mousedown",function(e){n=!0,s(e)});var o=function(e){n&&s(e)},r=function(){n=!1};document.addEventListener("mousemove",o),document.addEventListener("mouseup",r),this._volumeDragHandlers={onVolumeDrag:o,onVolumeUp:r}}}},{key:"_setupFullscreen",value:function(){var e=this,t=this.wrapper.querySelector(".smart-bb-hls-video-fullscreen");t&&t.addEventListener("click",function(){return e._toggleFullscreen()}),document.addEventListener("fullscreenchange",this._onFullscreenChange),document.addEventListener("webkitfullscreenchange",this._onFullscreenChange),document.addEventListener("mozfullscreenchange",this._onFullscreenChange),document.addEventListener("MSFullscreenChange",this._onFullscreenChange)}},{key:"_togglePlayPause",value:function(){this.video.paused?this.video.play().catch(function(){}):this.video.pause()}},{key:"_seek",value:function(e){this.video.duration&&isFinite(this.video.duration)&&(this.video.currentTime=this.video.duration*e)}},{key:"_toggleMute",value:function(){this.video.muted=!this.video.muted}},{key:"_setVolume",value:function(e){this.video.volume=Math.max(0,Math.min(1,e)),this.video.muted=0===e}},{key:"_toggleFullscreen",value:function(){if(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement){var e=document.exitFullscreen||document.webkitExitFullscreen||document.mozCancelFullScreen||document.msExitFullscreen;e&&e.call(document)}else{var t=this.wrapper.requestFullscreen||this.wrapper.webkitRequestFullscreen||this.wrapper.mozRequestFullScreen||this.wrapper.msRequestFullscreen;t&&t.call(this.wrapper)}}},{key:"_updateFullscreenState",value:function(){var e=!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement);this.wrapper.classList.toggle("is-fullscreen",e)}},{key:"_updateProgress",value:function(){if(this.video.duration&&isFinite(this.video.duration)){var e=this.video.currentTime/this.video.duration*100;this._progressFilled&&(this._progressFilled.style.width=e+"%"),this._progressHandle&&(this._progressHandle.style.left=e+"%"),this._updateTimeDisplay()}}},{key:"_updateTimeDisplay",value:function(){this._currentTimeEl&&(this._currentTimeEl.textContent=this._formatTime(this.video.currentTime)),this._durationEl&&(this._durationEl.textContent=this._formatTime(this.video.duration))}},{key:"_updateVolume",value:function(){var e=this.video.muted?0:this.video.volume;this._volumeFilled&&(this._volumeFilled.style.height=100*e+"%"),this._volumeHandle&&(this._volumeHandle.style.bottom=100*e+"%"),this.wrapper.classList.toggle("is-muted",this.video.muted)}},{key:"_formatTime",value:function(e){if(isNaN(e)||!isFinite(e))return"0:00";var t=Math.floor(e/3600),i=Math.floor(e%3600/60),n=Math.floor(e%60);return t>0?"".concat(t,":").concat(String(i).padStart(2,"0"),":").concat(String(n).padStart(2,"0")):"".concat(i,":").concat(String(n).padStart(2,"0"))}},{key:"destroy",value:function(){this.hls&&(this.hls.destroy(),this.hls=null),this._onMouseMove&&(document.removeEventListener("mousemove",this._onMouseMove),this._onMouseMove=null),this._onMouseUp&&(document.removeEventListener("mouseup",this._onMouseUp),this._onMouseUp=null),this._volumeDragHandlers&&(document.removeEventListener("mousemove",this._volumeDragHandlers.onVolumeDrag),document.removeEventListener("mouseup",this._volumeDragHandlers.onVolumeUp),this._volumeDragHandlers=null),document.removeEventListener("fullscreenchange",this._onFullscreenChange),document.removeEventListener("webkitfullscreenchange",this._onFullscreenChange),document.removeEventListener("mozfullscreenchange",this._onFullscreenChange),document.removeEventListener("MSFullscreenChange",this._onFullscreenChange)}}],i&&t(e.prototype,i),n&&t(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,i,n}();window.SmartBBHLSVideoPlayer=n})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.