1"use strict";(self.webpackChunkuniversity_of_glasgow=self.webpackChunkuniversity_of_glasgow||[]).push([[5797],{91068:function(e,t,i){i.r(t),i.d(t,{default:function(){return Video}});var a=i(78535),s=i.n(a),o=i(67193);i(14309),i(72273);class Video{constructor(e,t){if(this.initel=e,this.bslcontainer=document.querySelector("#footerNav > div:nth-child(2)"),!document.getElementById("video-bslnotice")&&this.bslcontainer)try{this.bslcontainer.insertAdjacentHTML("beforeend",'\n <span id="video-bslnotice">\n <h2>British Sign Language</h2>\n <p>BSL users can contact us via contactSCOTLAND-BSL, the on-line British Sign Language interpreting video relay service.</p>\n <ul><li><a href="https://contactscotland-bsl.org/">Find out more about BSL assistance: contactSCOTLAND</a></li></ul>\n </span>\n ')}catch(e){console.log(e)}if(this.iscalltoaction=e.classList.contains("calltoaction"),this.isfullwidth=e.classList.contains("fullwidth"),this.el="A"===e.tagName?e:e.querySelector("a")?e.querySelector("a"):null,this.el){this.parent=e.parentNode,this.onlyvideocontent=2==this.parent.childElementCount,this.onlyvideocontent&&this.parent.classList.add("video-feature"),this.classlist=e.classList,this.id=`video_${t}`,this.source=!!this.el&&this.el.getAttribute("href").replace("?testing",""),this.source&&(this.host=this.getHost(this.source)),this.title=this.el&&""!=this.el.textContent?this.el.textContent:this.id,this.thumbnailgenerator="/ffmpeg/thumbgen.php?file=",this.loaded=this.el.dataset.videoloaded,this.types=[{name:"largeplayer",class:"largeplayer",wrapperclasses:["flex-video","widescreen",`${this.host}-wrapper`,this.classlist.contains("portrait")?"portrait":""]},{name:"smallplayer",class:"smallplayer",wrapperclasses:["large-6","columns","right","videoWrapper",`${this.host}-wrapper`]},{name:"popupplayer",class:"popupplayer",wrapperclasses:["video-popup","close-popup",`${this.host}-wrapper`]},{name:"mp3",class:"mp3",wrapperclasses:["widescreen","mp3player",`${this.host}-wrapper`]}];try{if("media"!==this.host||"media"==this.host&&this.source.includes("/feeds/")){new IntersectionObserver(((e,t)=>{e.forEach((e=>{e.isIntersecting&&(this.source&&this.loadplayer(),t.unobserve(e.target),window.dispatchEvent(new Event("resize")))}))}),{rootMargin:"300px 0px 0px 0px",threshold:0}).observe(this.el)}else this.el.remove()}catch(e){console.log(e)}}}getHost(e){return e.includes("youtu")?"youtube":e.includes("vimeo")?"vimeo":e.includes("facebook")?"facebook":e.includes("microsoftstream")?"stream":e.includes("mediaspace")?"kaltura":"media"}gettype(){return this.types.find((e=>this.classlist.contains(e.class)))}getyoutubeid(){const e=this.source.split("/");return this.source.includes("shorts")?e[4]:this.source.includes("youtu.be")?e[3].trim().split("?")[0]:e[3].split("=")[1].trim()}getvimeoid(){return this.source.split("/")[3]}getfacebookid(){return this.source.split("/")[3]}getStreamid(){return this.source.split("/")[4]}getKalturaid(){return this.source.split("/")[5]}getKalturaTitle(){return this.source.split("/")[4]}getthumbnail(){if(this.el.querySelector("img"))return this.el.querySelector("img").getAttribute("src");if("media"===this.host)return"/3t4/img/video-thumbnail.png";if("youtube"===this.host){return`https://img.youtube.com/vi/${this.getyoutubeid()}/maxresdefault.jpg`}if("vimeo"===this.host){return`https://www.gla.ac.uk/feeds/media/thumbnail.html?id=${this.getvimeoid()}`}if("facebook"===this.host){this.facebookid();return""}if("stream"===this.host){this.getStreamid();return"/3t4/img/video-thumbnail.png"}if("kaltura"===this.host){return`https://cfvod.kaltura.com/p/4157173/sp/415717300/thumbnail/entry_id/${this.getKalturaid()}/version/100001/width/1280/height/720`}}getplayer(){return"youtube"===this.host?`<div id="youtube_${this.id}"><img src="${this.getthumbnail()}" alt="" /></div>`:"media"===this.host?`<div id="jwplayer_${this.id}"><img src="${this.getthumbnail()}" alt="" /></div>`:"vimeo"===this.host?`<div id="vimeo_${this.id}"><img src="${this.getthumbnail()}" alt="" /></div>`:"stream"===this.host?`<div id="stream_${this.id}"></div>`:"kaltura"===this.host?`<div id="kaltura_${this.id}"></div>`:void 0}getplayerwrapper(){const e=this.gettype(),t=`\n <div>${this.getplayer()}</div>\n `,i=`\n <div>${this.getplayer()}<div style="clear:both;"></div>\n `,a=`\n <div class="pop-wrapper">${this.getplayer()}</div>\n `;return"smallplayer"===e.name?i:"popupplayer"===e.name?a:t}replaceelement(){const e=this.gettype(),t=document.createElement("div");
1if(t.id=this.id,e.wrapperclasses.forEach((e=>{if(""!==e)try{t.classList.add(e)}catch(e){console.log(e)}})),t.innerHTML=this.getplayerwrapper(),"popupplayer"===e.name)if(t.style.display="none",t.insertAdjacentHTML("beforeend",`<button class="close-popup" aria-label="close video" data-videoid="${this.id}">close</button>`),document.querySelector("body").appendChild(t),this.iscalltoaction){let e=`<span class="${[...this.initel.classList].join(" ")} video-popup-placeholder" data-videoid="${this.id}">${this.initel.textContent}</span>`;this.initel.classList.add("video-popup-placeholder"),this.initel.dataset.videoid=this.id,this.initel.insertAdjacentHTML("afterend",e),this.initel.parentNode.removeChild(this.initel)}else{let e=`<div tabindex="0" aria-label="${""!==this.title.trim()?this.title:"play video"}" role="button" class="video-popup-placeholder columns ${this.isfullwidth?"fullwidth large-12":"right large-6"} videoWrapper" data-videoid="${this.id}"><img src="${this.getthumbnail()}" alt="" role="presentation" /><div class="playoverlay"></div></div>`;this.parent.classList.contains("tileImage")&&(e=`<div tabindex="0" aria-label="${""!==this.title.trim()?this.title:"play video"}" role="button" class="video-popup-placeholder" data-videoid="${this.id}"><img class="video-popup-thumbnail" src="${this.getthumbnail()}" alt="" role="presentation" /><div class="playoverlay"></div></div>`),this.initel.insertAdjacentHTML("afterend",e),this.initel.parentNode.removeChild(this.initel)}else this.initel.parentNode.replaceChild(t,this.initel);this.popupclickhandler()}loadplayer(){switch(this.replaceelement(),this.el.dataset.videoloaded=!0,this.host){case"media":this.loadjwplayer();break;case"youtube":this.loadyoutube();break;case"vimeo":this.loadvimeo();break;case"facebook":this.loadfacebook();break;case"stream":this.loadstream();break;case"kaltura":this.loadKaltura()}}loadjwplayer(){const e=this.source.replace("http://media.gla.ac.uk/web","https://www.gla.ac.uk/feeds/media/pt.html?media="),t=this.gettype();let i="";i="mp3"===t.name?"16:3":"16:9",s()("/3t4/js/libs/jwplayer/jwplayer.js").then((()=>{jwplayer.key="yGyYXaHqa/lyeG0ScFArAF3gTiVPO42bByXM2A==",jwplayer(`jwplayer_${this.id}`).setup({file:e,width:"100%",aspectratio:i,title:this.title,image:this.getthumbnail(),type:"mp4",skin:{name:"bekle"},primary:"html5",preload:"none",ga:{},abouttext:"the University of Glasgow",aboutlink:"http://www.gla.ac.uk"})})).catch((e=>console.error("failed to load!",e)))}loadyoutube(){s()("https://www.youtube.com/iframe_api").then((()=>{let e=setInterval((()=>{YT.loaded&&(this.runyoutube(),clearInterval(e))}),100)}))}loadvimeo(){return s()("/3t4/js/libs/vimeo/dist/player.js").then((()=>{fetch(`/feeds/media/vimeo.html?id=${this.getvimeoid()}`).then((e=>e.json())).then((e=>{const t="success"==e.response?e.ratio:.5625,resizeiframe=()=>{const e=document.getElementById(`vimeo_${this.id}`),i=e.offsetWidth*t;e.querySelector("iframe").height=`${i}px`};document.getElementById(`vimeo_${this.id}`).removeChild(document.getElementById(`vimeo_${this.id}`).querySelector("img")),document.getElementById(`vimeo_${this.id}`).insertAdjacentHTML("beforeend",`<iframe src="https://player.vimeo.com/video/${this.getvimeoid()}?dnt=1" width="100%" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe>`),this.vimeoiframe=document.getElementById(`vimeo_${this.id}`).querySelector("iframe"),this.vimeoiframe.title=this.title,this.vimeoplayer=new Vimeo.Player(this.vimeoiframe),this.vimeoplayer.on("play",(()=>{o.A.logevent("vimeo video","play",this.getvimeoid())})),this.vimeoplayer.on("pause",(()=>{o.A.logevent("vimeo video","paused",this.getvimeoid())})),this.vimeoplayer.on("ended",(()=>{o.A.logevent("vimeo video","ended",this.getvimeoid())})),resizeiframe(),window.addEventListener("resize",(e=>{resizeiframe()}))}))})),!0}loadfacebook(){return document.getElementById(`facebook_${this.id}`).insertAdjacentHTML("beforeend",'\n <div id="fb-root"></div>\n '),s()("https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.2").then((()=>{document.getElementById(`facebook_${this.id}`).removeChild(document.getElementById(`facebook_${this.id}`).querySelector("img")),document.getElementById(`facebook_${this.id}`).insertAdjacentHTML("beforeend",`\n <iframe src="https://player.vimeo.com/video/${this.getfacebookid()}?dnt=1" width="100%" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe>\n `)})),!0}
1loadstream(){this.getStreamid(),document.getElementById(`stream_${this.id}`).insertAdjacentHTML("beforeend",`\n <div style='max-width: 1280px'><div style='position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;'><iframe width="1280" height="720" src="https://web.microsoftstream.com/embed/video/${this.getStreamid()}?autoplay=false&showinfo=true" allowfullscreen style="border:none; position: absolute; top: 0; left: 0; right: 0; bottom: 0; height: 100%; max-width: 100%;"></iframe></div></div>\n <div style="clear:both;"></div>\n `)}loadKaltura(){const e=this.getKalturaid();e?(console.log(`Preparing MediaSpace video: ${e}`),this.kalturaIframeId=`kaltura_iframe_${this.id}`,this.kalturaEntryId=e,this.kalturaLoaded=!1,document.getElementById(`kaltura_${this.id}`).insertAdjacentHTML("beforeend",`\n <div id="kaltura_container_${this.id}" style='max-width: 1280px'>\n <div style='position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; background: #000;'>\n <div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white;">\n Loading player...\n </div>\n </div>\n <div style="clear:both;"></div>\n </div>\n `)):console.error("No entry ID found")}activateKaltura(){if(this.kalturaLoaded)return;const e=document.getElementById(`kaltura_container_${this.id}`);e&&(console.log(`Activating Kaltura player: ${this.kalturaEntryId}`),e.innerHTML=`\n <div style='position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;'>\n <iframe \n id="${this.kalturaIframeId}"\n src="https://mediaspace.gla.ac.uk/embed/secure/iframe/entryId/${this.kalturaEntryId}/uiConfId/52235382?autoplay=false"\n style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"\n allowfullscreen \n webkitallowfullscreen \n mozAllowFullScreen \n allow="autoplay *; fullscreen *; encrypted-media *" \n frameborder="0"\n title="Kaltura Video Player">\n </iframe>\n </div>\n <div style="clear:both;"></div>\n `,this.kalturaLoaded=!0,this.initKalturaAPI())}initKalturaAPI(){const e=document.getElementById(this.kalturaIframeId);e&&e.addEventListener("load",(()=>{console.log("Kaltura iframe loaded")}))}stopKaltura(){const e=document.getElementById(this.kalturaIframeId);e&&e.contentWindow.postMessage({method:"pause"},"*")}destroyKaltura(){const e=document.getElementById(`kaltura_container_${this.id}`);e&&(e.innerHTML="\n <div style='position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; background: #000;'>\n <div style=\"position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white;\">\n Player stopped\n </div>\n </div>\n "),this.kalturaLoaded=!1}runyoutube(){new YT.Player(`youtube_${this.id}`,{height:"100%",width:"100%",videoId:this.getyoutubeid(),host:"https://www.youtube-nocookie.com",playerVars:{autoplay:!1,loop:0,controls:1,showinfo:0,autohide:1,modestbranding:1,vq:"hd1080",enablejsapi:1,playsinline:1},events:{onReady:function(e){"function"==typeof e.target.setSphericalProperties&&e.target.setSphericalProperties({yaw:90,pitch:10,fov:80})},onStateChange:function(e){o.A.logevent("youtube video",{"-1":"unstarted",0:"ended",1:"playing",2:"paused",3:"buffering",5:"video cued"}[e.data],e.target.getVideoData().title)}}})}popupclickhandler(){[...document.querySelectorAll(".video-popup-placeholder")].forEach((e=>{e.dataset.clickhandler||(e.addEventListener("click",(()=>{const t=document.getElementById(e.dataset.videoid);t.style.display="block",t.querySelector(".close-popup").focus(),"media"===this.host?jwplayer(`jwplayer_${e.dataset.videoid}`).play():"youtube"===this.host?document.getElementById(`youtube_${this.id}`).contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}',"*"):"vimeo"===this.host?this.vimeoplayer.play():"kaltura"===this.host&&this.activateKaltura()})),e.addEventListener("keypress",(function(e){"Enter"===e.key&&(e.preventDefault(),e.target.click())})),e.dataset.clickhandler=!0)}
1)),[...document.querySelectorAll(".close-popup")].forEach((e=>{e.dataset.clickhandler||(e.addEventListener("click",(()=>{document.getElementById(this.id).style.display="none","media"===this.host?e.dataset.videoid&&jwplayer(`jwplayer_${e.dataset.videoid}`).stop():"youtube"===this.host?document.getElementById(`youtube_${this.id}`).contentWindow.postMessage('{"event":"command","func":"stopVideo","args":""}',"*"):"vimeo"===this.host?this.vimeoplayer.pause():"kaltura"===this.host&&(this.stopKaltura(),this.destroyKaltura())})),e.addEventListener("keypress",(function(e){"Enter"===e.key&&(e.preventDefault(),e.target.click())})),e.dataset.clickhandler=!0)}))}}}}]); 2//# sourceMappingURL=gu-video.45238229.js.map
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.