diff --git a/amd/build/player.min.js b/amd/build/player.min.js index d25dd02c..4b64fb22 100644 --- a/amd/build/player.min.js +++ b/amd/build/player.min.js @@ -1,3 +1,2 @@ -var e,t;e=window,t=function(){function r(e,t){for(var n=0;ne&&(d=JSON.stringify(d)),a.element.contentWindow.postMessage(d,a.origin))}function E(a,c){var d,f,g=[];(c=s(c)).event?("error"===c.event&&b(a,c.data.method).forEach(function(b){var d=new Error(c.data.message);d.name=c.data.name,b.reject(d),k(a,c.data.method,b)}),g=b(a,"event:".concat(c.event)),d=c.data):!c.method||(f=function(a,c){var d=b(a,c);if(1>d.length)return!1;var e=d.shift();return k(a,c,e),e}(a,c.method))&&(g.push(f),d=c.value),g.forEach(function(b){try{if("function"==typeof b)return void b.call(a,d);b.resolve(d)}catch(a){}})}var w=["autopause","autoplay","background","byline","color","controls","dnt","height","id","interactive_params","keyboard","loop","maxheight","maxwidth","muted","playsinline","portrait","responsive","speed","texttrack","title","transparent","url","width"];function G(a,b){var c=1 - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -define("mod_videotime/resize_tab_player",["mod_videotime/player","core/notification"],(function(Player,Notification){var resizeTabPlayer=function(){this.initialize()};return resizeTabPlayer.prototype.column="",resizeTabPlayer.prototype.initialize=function(){let observer=new ResizeObserver(this.resize);new MutationObserver(this.resize).observe(document.querySelector("#page-content"),{subtree:!0,childList:!0}),document.querySelectorAll(".instance-container, div.videotime-tab-instance").forEach((container=>{observer.observe(container)})),this.resize(),document.querySelectorAll(".videotime-tab-instance").forEach((instance=>{instance.style.position="absolute"})),window.removeEventListener("mousemove",this.mousemoveHandler),window.addEventListener("mousemove",this.mousemoveHandler),window.removeEventListener("dragstart",this.dragstartHandler),window.addEventListener("dragstart",this.dragstartHandler),window.removeEventListener("mouseup",this.dragendHandler),window.addEventListener("mouseup",this.dragendHandler),window.removeEventListener("click",this.cueVideo),window.addEventListener("click",this.cueVideo)},resizeTabPlayer.prototype.resize=function(){document.querySelectorAll(".instance-container").forEach((container=>{container.offsetWidth&&container.closest(".videotimetabs").querySelectorAll(".videotime-tab-instance .vimeo-embed iframe").forEach((iframe=>{let instance=iframe.closest(".videotime-tab-instance"),content=iframe.closest(".tab-content");Object.assign(instance.style,{top:container.offsetTop+"px",left:container.offsetLeft+"px",width:container.offsetWidth+"px"}),container.style.minHeight=iframe.closest(".videotime-tab-instance").offsetHeight+"px",content.querySelectorAll(".videotime-tab-instance-cover").forEach((cover=>{Object.assign(cover.style,{height:content.offsetHeight+"px",left:content.offsetLeft+"px",top:content.offsetTop+"px",width:content.offsetWidth+"px"})}))}))}))},resizeTabPlayer.prototype.dragendHandler=function(){document.querySelectorAll(".videotime-tab-instance-cover").forEach((cover=>{cover.style.display="none"}))},resizeTabPlayer.prototype.dragstartHandler=function(e){e.target.classList.contains("videotimetab-resize-handle")&&(this.column=e.target.closest(".tab-pane").querySelector(".videotimetab-resize"),e.stopPropagation(),e.preventDefault(),document.querySelectorAll(".videotime-tab-instance-cover").forEach((cover=>{cover.style.display="block"})))},resizeTabPlayer.prototype.mousemoveHandler=function(e){document.querySelectorAll(".videotimetab-resize-handle").forEach((h=>{h.closest(".tab-pane")&&"block"==document.querySelector(".videotime-tab-instance-cover").style.display&&(this.column.style.width=e.pageX-this.column.getBoundingClientRect().left+"px")}))},resizeTabPlayer.prototype.cueVideo=function(e){if(e.target.matches('[data-action="cue"]')){let time=e.target.closest("a").getAttribute("data-start").match(/((([0-9]+):)?(([0-9]+):))?([0-9]+(\.[0-9]+))/),iframe=e.target.closest(".videotimetabs").querySelector(".vimeo-embed iframe"),player=new Player(iframe);e.preventDefault(),e.stopPropagation(),time&&player.setCurrentTime(3600*Number(time[3]||0)+60*Number(time[5]||0)+Number(time[6])).then(player.play.bind(player)).catch(Notification.exception)}},{init:function(){return new resizeTabPlayer}}})); - -//# sourceMappingURL=resize_tab_player.min.js.map \ No newline at end of file +define ("mod_videotime/resize_tab_player",["mod_videotime/player","core/notification"],function(a,b){var c=function(){this.initialize()};c.prototype.column="";c.prototype.initialize=function(){var a=this,b=new ResizeObserver(a.resize),c=new MutationObserver(a.resize);c.observe(document.querySelector("#page-content"),{subtree:!0,childList:!0});document.querySelectorAll(".instance-container, div.videotime-tab-instance").forEach(function(a){b.observe(a)});a.resize();document.querySelectorAll(".videotime-tab-instance").forEach(function(a){a.style.position="absolute"});window.removeEventListener("mousemove",a.mousemoveHandler);window.addEventListener("mousemove",a.mousemoveHandler);window.removeEventListener("dragstart",a.dragstartHandler);window.addEventListener("dragstart",a.dragstartHandler);window.removeEventListener("mouseup",a.dragendHandler);window.addEventListener("mouseup",a.dragendHandler);window.removeEventListener("click",a.cueVideo);window.addEventListener("click",a.cueVideo)};c.prototype.resize=function(){document.querySelectorAll(".instance-container").forEach(function(a){if(!a.offsetWidth){return}a.closest(".videotimetabs").querySelectorAll(".videotime-tab-instance .vimeo-embed iframe").forEach(function(b){var c=b.closest(".videotime-tab-instance"),d=b.closest(".tab-content");Object.assign(c.style,{top:a.offsetTop+"px",left:a.offsetLeft+"px",width:a.offsetWidth+"px"});a.style.minHeight=b.closest(".videotime-tab-instance").offsetHeight+"px";d.querySelectorAll(".videotime-tab-instance-cover").forEach(function(a){Object.assign(a.style,{height:d.offsetHeight+"px",left:d.offsetLeft+"px",top:d.offsetTop+"px",width:d.offsetWidth+"px"})})})})};c.prototype.dragendHandler=function(){document.querySelectorAll(".videotime-tab-instance-cover").forEach(function(a){a.style.display="none"})};c.prototype.dragstartHandler=function(a){if(a.target.classList.contains("videotimetab-resize-handle")){this.column=a.target.closest(".tab-pane").querySelector(".videotimetab-resize");a.stopPropagation();a.preventDefault();document.querySelectorAll(".videotime-tab-instance-cover").forEach(function(a){a.style.display="block"})}};c.prototype.mousemoveHandler=function(a){var b=this;document.querySelectorAll(".videotimetab-resize-handle").forEach(function(c){if(c.closest(".tab-pane")&&"block"==document.querySelector(".videotime-tab-instance-cover").style.display){b.column.style.width=a.pageX-b.column.getBoundingClientRect().left+"px"}})};c.prototype.cueVideo=function(c){if(c.target.matches("[data-action=\"cue\"]")){var d=c.target.closest("a").getAttribute("data-start"),e=d.match(/((([0-9]+):)?(([0-9]+):))?([0-9]+(\.[0-9]+))/),f=c.target.closest(".videotimetabs").querySelector(".vimeo-embed iframe"),g=new a(f);c.preventDefault();c.stopPropagation();if(e){g.setCurrentTime(3600*+(e[3]||0)+60*+(e[5]||0)+ +e[6]).then(g.play.bind(g)).catch(b.exception)}}};return{init:function init(){return new c}}}); +//# sourceMappingURL=resize_tab_player.min.js.map diff --git a/amd/build/resize_tab_player.min.js.map b/amd/build/resize_tab_player.min.js.map index 3efe432e..351cce55 100644 --- a/amd/build/resize_tab_player.min.js.map +++ b/amd/build/resize_tab_player.min.js.map @@ -1 +1 @@ -{"version":3,"file":"resize_tab_player.min.js","sources":["../src/resize_tab_player.js"],"sourcesContent":["/*\n * Position the Vimeo player within tab layout\n *\n * @package mod_videotime\n * @module mod_videotime/resize_tab_player\n * @copyright 2021 bdecent gmbh \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * @module mod_videotime/resize_tab_player\n */\n define(['mod_videotime/player', 'core/notification'], function(Player, Notification) {\n\n var resizeTabPlayer = function() {\n this.initialize();\n };\n\n resizeTabPlayer.prototype.column = '';\n\n /**\n * Intialize listener\n */\n resizeTabPlayer.prototype.initialize = function() {\n var self = this;\n let observer = new ResizeObserver(self.resize),\n mutationobserver = new MutationObserver(self.resize);\n mutationobserver.observe(document.querySelector('#page-content'), {subtree: true, childList: true});\n document.querySelectorAll('.instance-container, div.videotime-tab-instance').forEach((container) => {\n observer.observe(container);\n });\n self.resize();\n document.querySelectorAll('.videotime-tab-instance').forEach((instance) => {\n instance.style.position = 'absolute';\n });\n\n window.removeEventListener('mousemove', self.mousemoveHandler);\n window.addEventListener('mousemove', self.mousemoveHandler);\n\n window.removeEventListener('dragstart', self.dragstartHandler);\n window.addEventListener('dragstart', self.dragstartHandler);\n\n window.removeEventListener('mouseup', self.dragendHandler);\n window.addEventListener('mouseup', self.dragendHandler);\n\n window.removeEventListener('click', self.cueVideo);\n window.addEventListener('click', self.cueVideo);\n };\n\n /**\n * Adjust player position when the page configuration is changed\n */\n resizeTabPlayer.prototype.resize = function() {\n document.querySelectorAll('.instance-container').forEach((container) => {\n if (!container.offsetWidth) {\n // Ignore if it is not visible.\n return;\n }\n container.closest('.videotimetabs').querySelectorAll('.videotime-tab-instance .vimeo-embed iframe')\n .forEach((iframe) => {\n let instance = iframe.closest('.videotime-tab-instance'),\n content = iframe.closest('.tab-content');\n Object.assign(instance.style, {\n top: container.offsetTop + 'px',\n left: container.offsetLeft + 'px',\n width: container.offsetWidth + 'px'\n });\n container.style.minHeight = iframe.closest('.videotime-tab-instance').offsetHeight + 'px';\n content.querySelectorAll('.videotime-tab-instance-cover').forEach((cover) => {\n Object.assign(cover.style, {\n height: content.offsetHeight + 'px',\n left: content.offsetLeft + 'px',\n top: content.offsetTop + 'px',\n width: content.offsetWidth + 'px'\n });\n });\n });\n });\n };\n\n /**\n * Reset handle when drag ends\n */\n resizeTabPlayer.prototype.dragendHandler = function() {\n document.querySelectorAll('.videotime-tab-instance-cover').forEach((cover) => {\n cover.style.display = 'none';\n });\n };\n\n /**\n * Prepare to drag divider\n *\n * @param {event} e mouse event\n */\n resizeTabPlayer.prototype.dragstartHandler = function(e) {\n if (e.target.classList.contains('videotimetab-resize-handle')) {\n this.column = e.target.closest('.tab-pane').querySelector('.videotimetab-resize');\n e.stopPropagation();\n e.preventDefault();\n document.querySelectorAll('.videotime-tab-instance-cover').forEach((cover) => {\n cover.style.display = 'block';\n });\n }\n };\n\n /**\n * Resize the content and player to mouse location\n *\n * @param {event} e mouse event\n */\n resizeTabPlayer.prototype.mousemoveHandler = function(e) {\n document.querySelectorAll('.videotimetab-resize-handle').forEach((h) => {\n if (h.closest('.tab-pane') && document.querySelector('.videotime-tab-instance-cover').style.display == 'block') {\n this.column.style.width = e.pageX - this.column.getBoundingClientRect().left + 'px';\n }\n });\n };\n\n /**\n * Move video to new time when link clicked\n *\n * @param {event} e mouse event\n */\n resizeTabPlayer.prototype.cueVideo = function(e) {\n if (e.target.matches('[data-action=\"cue\"]')) {\n let starttime = e.target.closest('a').getAttribute('data-start'),\n time = starttime.match(/((([0-9]+):)?(([0-9]+):))?([0-9]+(\\.[0-9]+))/),\n iframe = e.target.closest('.videotimetabs').querySelector('.vimeo-embed iframe'),\n player = new Player(iframe);\n e.preventDefault();\n e.stopPropagation();\n if (time) {\n player\n .setCurrentTime(3600 * Number(time[3] || 0) + 60 * Number(time[5] || 0) + Number(time[6]))\n .then(player.play.bind(player))\n .catch(Notification.exception);\n }\n }\n };\n\n return {\n init: function() {\n return new resizeTabPlayer();\n }\n };\n});\n"],"names":["define","Player","Notification","resizeTabPlayer","initialize","prototype","column","observer","ResizeObserver","this","resize","MutationObserver","observe","document","querySelector","subtree","childList","querySelectorAll","forEach","container","instance","style","position","window","removeEventListener","mousemoveHandler","addEventListener","dragstartHandler","dragendHandler","cueVideo","offsetWidth","closest","iframe","content","Object","assign","top","offsetTop","left","offsetLeft","width","minHeight","offsetHeight","cover","height","display","e","target","classList","contains","stopPropagation","preventDefault","h","pageX","getBoundingClientRect","matches","time","getAttribute","match","player","setCurrentTime","Number","then","play","bind","catch","exception","init"],"mappings":";;;;;;;;AAYCA,yCAAO,CAAC,uBAAwB,sBAAsB,SAASC,OAAQC,kBAEhEC,gBAAkB,gBACbC,qBAGTD,gBAAgBE,UAAUC,OAAS,GAKnCH,gBAAgBE,UAAUD,WAAa,eAE/BG,SAAW,IAAIC,eADRC,KAC4BC,QACpB,IAAIC,iBAFZF,KAEkCC,QAC5BE,QAAQC,SAASC,cAAc,iBAAkB,CAACC,SAAS,EAAMC,WAAW,IAC7FH,SAASI,iBAAiB,mDAAmDC,SAASC,YAClFZ,SAASK,QAAQO,cALVV,KAONC,SACLG,SAASI,iBAAiB,2BAA2BC,SAASE,WAC1DA,SAASC,MAAMC,SAAW,cAG9BC,OAAOC,oBAAoB,YAZhB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MAAMwB,QAAU,aAUlC1C,gBAAgBE,UAAUoB,iBAAmB,SAASqB,GAClDjC,SAASI,iBAAiB,+BAA+BC,SAASkC,IAC1DA,EAAErB,QAAQ,cAAyF,SAAzElB,SAASC,cAAc,iCAAiCO,MAAMwB,eACnFvC,OAAOe,MAAMmB,MAAQM,EAAEO,MAAQ5C,KAAKH,OAAOgD,wBAAwBhB,KAAO,UAU3FnC,gBAAgBE,UAAUwB,SAAW,SAASiB,MACtCA,EAAEC,OAAOQ,QAAQ,uBAAwB,KAErCC,KADYV,EAAEC,OAAOhB,QAAQ,KAAK0B,aAAa,cAC9BC,MAAM,gDACvB1B,OAASc,EAAEC,OAAOhB,QAAQ,kBAAkBjB,cAAc,uBAC1D6C,OAAS,IAAI1D,OAAO+B,QACxBc,EAAEK,iBACFL,EAAEI,kBACEM,MACAG,OACCC,eAAe,KAAOC,OAAOL,KAAK,IAAM,GAAK,GAAKK,OAAOL,KAAK,IAAM,GAAKK,OAAOL,KAAK,KACrFM,KAAKH,OAAOI,KAAKC,KAAKL,SACtBM,MAAM/D,aAAagE,aAKzB,CACHC,KAAM,kBACK,IAAIhE"} \ No newline at end of file +{"version":3,"sources":["../src/resize_tab_player.js"],"names":["define","Player","Notification","resizeTabPlayer","initialize","prototype","column","self","observer","ResizeObserver","resize","mutationobserver","MutationObserver","observe","document","querySelector","subtree","childList","querySelectorAll","forEach","container","instance","style","position","window","removeEventListener","mousemoveHandler","addEventListener","dragstartHandler","dragendHandler","cueVideo","offsetWidth","closest","iframe","content","Object","assign","top","offsetTop","left","offsetLeft","width","minHeight","offsetHeight","cover","height","display","e","target","classList","contains","stopPropagation","preventDefault","h","pageX","getBoundingClientRect","matches","starttime","getAttribute","time","match","player","setCurrentTime","then","play","bind","catch","exception","init"],"mappings":"AAYCA,OAAM,mCAAC,CAAC,sBAAD,CAAyB,mBAAzB,CAAD,CAAgD,SAASC,CAAT,CAAiBC,CAAjB,CAA+B,CAElF,GAAIC,CAAAA,CAAe,CAAG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,CAAqD,IAClF,CACJ,CAJD,CAKH,CAND,CAaApC,CAAe,CAACE,SAAhB,CAA0ByB,QAA1B,CAAqC,SAASiB,CAAT,CAAY,CAC7C,GAAIA,CAAC,CAACC,MAAF,CAASQ,OAAT,CAAiB,uBAAjB,CAAJ,CAA6C,CACzC,GAAIC,CAAAA,CAAS,CAAGV,CAAC,CAACC,MAAF,CAAShB,OAAT,CAAiB,GAAjB,EAAsB0B,YAAtB,CAAmC,YAAnC,CAAhB,CACIC,CAAI,CAAGF,CAAS,CAACG,KAAV,CAAgB,8CAAhB,CADX,CAEI3B,CAAM,CAAGc,CAAC,CAACC,MAAF,CAAShB,OAAT,CAAiB,gBAAjB,EAAmCjB,aAAnC,CAAiD,qBAAjD,CAFb,CAGI8C,CAAM,CAAG,GAAI5D,CAAAA,CAAJ,CAAWgC,CAAX,CAHb,CAIAc,CAAC,CAACK,cAAF,GACAL,CAAC,CAACI,eAAF,GACA,GAAIQ,CAAJ,CAAU,CACNE,CAAM,CACLC,cADD,CACgB,OAAcH,CAAI,CAAC,CAAD,CAAJ,EAAW,CAAzB,EAA8B,KAAYA,CAAI,CAAC,CAAD,CAAJ,EAAW,CAAvB,CAA9B,GAAiEA,CAAI,CAAC,CAAD,CADrF,EAECI,IAFD,CAEMF,CAAM,CAACG,IAAP,CAAYC,IAAZ,CAAiBJ,CAAjB,CAFN,EAGCK,KAHD,CAGOhE,CAAY,CAACiE,SAHpB,CAIH,CACJ,CACJ,CAfD,CAiBA,MAAO,CACHC,IAAI,CAAE,eAAW,CACb,MAAO,IAAIjE,CAAAA,CACd,CAHE,CAKV,CArIM,CAAN","sourcesContent":["/*\n * Position the Vimeo player within tab layout\n *\n * @package mod_videotime\n * @module mod_videotime/resize_tab_player\n * @copyright 2021 bdecent gmbh \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * @module mod_videotime/resize_tab_player\n */\n define(['mod_videotime/player', 'core/notification'], function(Player, Notification) {\n\n var resizeTabPlayer = function() {\n this.initialize();\n };\n\n resizeTabPlayer.prototype.column = '';\n\n /**\n * Intialize listener\n */\n resizeTabPlayer.prototype.initialize = function() {\n var self = this;\n let observer = new ResizeObserver(self.resize),\n mutationobserver = new MutationObserver(self.resize);\n mutationobserver.observe(document.querySelector('#page-content'), {subtree: true, childList: true});\n document.querySelectorAll('.instance-container, div.videotime-tab-instance').forEach((container) => {\n observer.observe(container);\n });\n self.resize();\n document.querySelectorAll('.videotime-tab-instance').forEach((instance) => {\n instance.style.position = 'absolute';\n });\n\n window.removeEventListener('mousemove', self.mousemoveHandler);\n window.addEventListener('mousemove', self.mousemoveHandler);\n\n window.removeEventListener('dragstart', self.dragstartHandler);\n window.addEventListener('dragstart', self.dragstartHandler);\n\n window.removeEventListener('mouseup', self.dragendHandler);\n window.addEventListener('mouseup', self.dragendHandler);\n\n window.removeEventListener('click', self.cueVideo);\n window.addEventListener('click', self.cueVideo);\n };\n\n /**\n * Adjust player position when the page configuration is changed\n */\n resizeTabPlayer.prototype.resize = function() {\n document.querySelectorAll('.instance-container').forEach((container) => {\n if (!container.offsetWidth) {\n // Ignore if it is not visible.\n return;\n }\n container.closest('.videotimetabs').querySelectorAll('.videotime-tab-instance .vimeo-embed iframe')\n .forEach((iframe) => {\n let instance = iframe.closest('.videotime-tab-instance'),\n content = iframe.closest('.tab-content');\n Object.assign(instance.style, {\n top: container.offsetTop + 'px',\n left: container.offsetLeft + 'px',\n width: container.offsetWidth + 'px'\n });\n container.style.minHeight = iframe.closest('.videotime-tab-instance').offsetHeight + 'px';\n content.querySelectorAll('.videotime-tab-instance-cover').forEach((cover) => {\n Object.assign(cover.style, {\n height: content.offsetHeight + 'px',\n left: content.offsetLeft + 'px',\n top: content.offsetTop + 'px',\n width: content.offsetWidth + 'px'\n });\n });\n });\n });\n };\n\n /**\n * Reset handle when drag ends\n */\n resizeTabPlayer.prototype.dragendHandler = function() {\n document.querySelectorAll('.videotime-tab-instance-cover').forEach((cover) => {\n cover.style.display = 'none';\n });\n };\n\n /**\n * Prepare to drag divider\n *\n * @param {event} e mouse event\n */\n resizeTabPlayer.prototype.dragstartHandler = function(e) {\n if (e.target.classList.contains('videotimetab-resize-handle')) {\n this.column = e.target.closest('.tab-pane').querySelector('.videotimetab-resize');\n e.stopPropagation();\n e.preventDefault();\n document.querySelectorAll('.videotime-tab-instance-cover').forEach((cover) => {\n cover.style.display = 'block';\n });\n }\n };\n\n /**\n * Resize the content and player to mouse location\n *\n * @param {event} e mouse event\n */\n resizeTabPlayer.prototype.mousemoveHandler = function(e) {\n document.querySelectorAll('.videotimetab-resize-handle').forEach((h) => {\n if (h.closest('.tab-pane') && document.querySelector('.videotime-tab-instance-cover').style.display == 'block') {\n this.column.style.width = e.pageX - this.column.getBoundingClientRect().left + 'px';\n }\n });\n };\n\n /**\n * Move video to new time when link clicked\n *\n * @param {event} e mouse event\n */\n resizeTabPlayer.prototype.cueVideo = function(e) {\n if (e.target.matches('[data-action=\"cue\"]')) {\n let starttime = e.target.closest('a').getAttribute('data-start'),\n time = starttime.match(/((([0-9]+):)?(([0-9]+):))?([0-9]+(\\.[0-9]+))/),\n iframe = e.target.closest('.videotimetabs').querySelector('.vimeo-embed iframe'),\n player = new Player(iframe);\n e.preventDefault();\n e.stopPropagation();\n if (time) {\n player\n .setCurrentTime(3600 * Number(time[3] || 0) + 60 * Number(time[5] || 0) + Number(time[6]))\n .then(player.play.bind(player))\n .catch(Notification.exception);\n }\n }\n };\n\n return {\n init: function() {\n return new resizeTabPlayer();\n }\n };\n});\n"],"file":"resize_tab_player.min.js"} \ No newline at end of file diff --git a/amd/build/videotime-plugin.min.js b/amd/build/videotime-plugin.min.js index 4e4e8106..a6a4bbb0 100644 --- a/amd/build/videotime-plugin.min.js +++ b/amd/build/videotime-plugin.min.js @@ -1,3 +1,2 @@ -define("mod_videotime/videotime-plugin",["mod_videotime/videotime"],(function(VideoTime){var VideoTimePlugin=function(){this.initialized=!1};return VideoTimePlugin.prototype.initializeInfo=function(videotime,instance){if(!(videotime instanceof VideoTime))throw new Error("Coding error. Invalid VideoTime passed to plugin. "+instance.name);this.initialized=!0},VideoTimePlugin})); - -//# sourceMappingURL=videotime-plugin.min.js.map \ No newline at end of file +define ("mod_videotime/videotime-plugin",["mod_videotime/videotime"],function(a){var b=function(){this.initialized=!1};b.prototype.initializeInfo=function(b,c){if(!(b instanceof a)){throw new Error("Coding error. Invalid VideoTime passed to plugin. "+c.name)}this.initialized=!0};return b}); +//# sourceMappingURL=videotime-plugin.min.js.map diff --git a/amd/build/videotime-plugin.min.js.map b/amd/build/videotime-plugin.min.js.map index eacba860..4f528a81 100644 --- a/amd/build/videotime-plugin.min.js.map +++ b/amd/build/videotime-plugin.min.js.map @@ -1 +1 @@ -{"version":3,"file":"videotime-plugin.min.js","sources":["../src/videotime-plugin.js"],"sourcesContent":["\n/**\n * @module mod_videotime/videotime-plugin\n */\n define(['mod_videotime/videotime'], function(VideoTime) {\n var VideoTimePlugin = function() {\n this.initialized = false;\n };\n\n /**\n * @param {VideoTime} videotime\n * @param {object} instance Prefetched VideoTime instance object.\n */\n VideoTimePlugin.prototype.initializeInfo = function(videotime, instance) {\n if (!(videotime instanceof VideoTime)) {\n throw new Error(\"Coding error. Invalid VideoTime passed to plugin. \" + instance.name);\n }\n this.initialized = true;\n };\n\n return VideoTimePlugin;\n });\n"],"names":["define","VideoTime","VideoTimePlugin","initialized","prototype","initializeInfo","videotime","instance","Error","name"],"mappings":"AAICA,wCAAO,CAAC,4BAA4B,SAASC,eACtCC,gBAAkB,gBACbC,aAAc,UAOvBD,gBAAgBE,UAAUC,eAAiB,SAASC,UAAWC,eACrDD,qBAAqBL,iBACjB,IAAIO,MAAM,qDAAuDD,SAASE,WAE/EN,aAAc,GAGhBD"} \ No newline at end of file +{"version":3,"sources":["../src/videotime-plugin.js"],"names":["define","VideoTime","VideoTimePlugin","initialized","prototype","initializeInfo","videotime","instance","Error","name"],"mappings":"AAICA,OAAM,kCAAC,CAAC,yBAAD,CAAD,CAA8B,SAASC,CAAT,CAAoB,CACrD,GAAIC,CAAAA,CAAe,CAAG,UAAW,CAC7B,KAAKC,WAAL,GACH,CAFD,CAQAD,CAAe,CAACE,SAAhB,CAA0BC,cAA1B,CAA2C,SAASC,CAAT,CAAoBC,CAApB,CAA8B,CACrE,GAAI,EAAED,CAAS,WAAYL,CAAAA,CAAvB,CAAJ,CAAuC,CACnC,KAAM,IAAIO,CAAAA,KAAJ,CAAU,qDAAuDD,CAAQ,CAACE,IAA1E,CACT,CACD,KAAKN,WAAL,GACH,CALD,CAOA,MAAOD,CAAAA,CACT,CAjBK,CAAN","sourcesContent":["\n/**\n * @module mod_videotime/videotime-plugin\n */\n define(['mod_videotime/videotime'], function(VideoTime) {\n var VideoTimePlugin = function() {\n this.initialized = false;\n };\n\n /**\n * @param {VideoTime} videotime\n * @param {object} instance Prefetched VideoTime instance object.\n */\n VideoTimePlugin.prototype.initializeInfo = function(videotime, instance) {\n if (!(videotime instanceof VideoTime)) {\n throw new Error(\"Coding error. Invalid VideoTime passed to plugin. \" + instance.name);\n }\n this.initialized = true;\n };\n\n return VideoTimePlugin;\n });\n"],"file":"videotime-plugin.min.js"} \ No newline at end of file diff --git a/amd/build/videotime.min.js b/amd/build/videotime.min.js index bba33f1f..64bb721d 100644 --- a/amd/build/videotime.min.js +++ b/amd/build/videotime.min.js @@ -1,8 +1,2 @@ -/* - * @package mod_videotime - * @copyright 2021 bdecent gmbh - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -define("mod_videotime/videotime",["jquery","mod_videotime/player","core/ajax","core/log","core/templates","core/notification"],(function($,Vimeo,Ajax,Log,Templates,Notification){let VideoTime=function(elementId,cmId,hasPro,interval){this.elementId=elementId,this.cmId=cmId,this.hasPro=hasPro,this.interval=interval,this.player=null,this.resumeTime=null,this.session=null,this.instance=null,this.played=!1,this.playing=!1,this.time=0,this.percent=0,this.currentTime=0,this.playbackRate=1,this.plugins=[],hasPro&&$("body").hasClass("path-course-view")&&!$("body").hasClass("vtinit")&&($("body").addClass("vtinit"),$(document).on("focus","body",this.initializeNewInstances.bind(this))),this.modulecount=$("body .activity.videotime").length};return VideoTime.prototype.getCmId=function(){return this.cmId},VideoTime.prototype.registerPlugin=function(plugin){this.plugins.push(plugin)},VideoTime.prototype.initialize=function(){Log.debug("Initializing Video Time "+this.elementId),this.getInstance().then((instance=>{Log.debug("Initializing Vimeo player with options:"),Log.debug(instance),this.player=new Vimeo(this.elementId,{autopause:instance.autopause,autoplay:instance.autoplay,background:instance.background,byline:instance.byline,color:instance.color,controls:instance.controls,dnt:instance.dnt,height:instance.height,maxheight:instance.maxheight,maxwidth:instance.maxwidth,muted:instance.muted,portrait:instance.portrait,pip:instance.pip,playsinline:instance.playsinline,responsive:instance.responsive,speed:instance.speed,title:instance.title,transparent:instance.transparent,url:instance.vimeo_url,width:instance.width});let url=new URL(window.location.href),q=url.searchParams.get("q"),starttime=(url.searchParams.get("time")||"").match(/^([0-9]+:){0,2}([0-9]+)(\.[0-9]+)$/);starttime?this.setStartTime(starttime[0]).then((function(){return q&&window.find&&window.find(q),!0})).catch(Notification.exception):q&&window.find&&window.find(q),this.addListeners();for(let i=0;i(this.played||(this.hasPro&&(this.getSession(),this.startWatchInterval()),this.view(),this.played=!0),!0))),this.hasPro&&(this.getResumeTime().then((seconds=>(seconds<=0||this.getPlayer().getDuration().then((duration=>{let resumeTime=seconds;return seconds+1>=Math.floor(duration)&&(Log.debug("VIDEO_TIME video finished, resuming at start of video."),resumeTime=0),Log.debug("VIDEO_TIME resuming at "+resumeTime),this.player.on("loaded",(()=>{this.player.setCurrentTime(resumeTime)})),!0})).catch(Notification.exception),!0))).catch(Notification.exception),this.player.on("play",function(){this.playing=!0,Log.debug("VIDEO_TIME play")}.bind(this)),this.player.on("playing",function(){this.playing=!0,Log.debug("VIDEO_TIME playing")}.bind(this)),this.player.on("pause",function(){this.playing=!1,Log.debug("VIDEO_TIME pause")}.bind(this)),this.player.on("stalled",function(){this.playing=!1,Log.debug("VIDEO_TIME stalled")}.bind(this)),this.player.on("suspend",function(){this.playing=!1,Log.debug("VIDEO_TIME suspend")}.bind(this)),this.player.on("abort",function(){this.playing=!1,Log.debug("VIDEO_TIME abort")}.bind(this)),this.player.getPlaybackRate().then(function(playbackRate){this.playbackRate=playbackRate}.bind(this)).catch(Notification.exception),this.player.on("playbackratechange",function(event){this.playbackRate=event.playbackRate}.bind(this)),this.player.on("timeupdate",function(event){this.percent=event.percent,this.currentTime=event.seconds,Log.debug("VIDEO_TIME timeupdate. Percent: "+this.percent+". Current time: "+this.currentTime)}.bind(this)),this.player.on("ended",function(){this.playing=!1,Log.debug("VIDEO_TIME ended"),new Promise(function(resolve){this.getSession().then((function(session){return resolve(session),!0})).catch(Notification.exception)}.bind(this)).then(function(session){return this.setSessionState(session.id,1),session}.bind(this)).then(function(session){return this.setPercent(session.id,1),session}.bind(this)).then(function(session){return this.setCurrentTime(session.id,this.currentTime),session}.bind(this)).catch(Notification.exception).finally(function(){this.getSession().then(function(session){this.getNextActivityButtonData(session.id).then((function(response){let data=JSON.parse(response.data);if(data.instance&&parseInt(data.instance.next_activity_auto)&&!data.is_restricted&&data.hasnextcm){let link=$('.aalink[href="'+data.nextcm_url+'"] img').first();$(".path-course-view").length&&link?link.click():window.location.href=data.nextcm_url}return Templates.render("videotime/next_activity_button",JSON.parse(response.data)).then((function(html){return $("#next-activity-button").html(html),!0})).fail(Notification.exception),!0})).fail(Notification.exception)}.bind(this)).catch(Notification.exception)}.bind(this)).fail(Notification.exception)}.bind(this)),$($("#"+this.elementId).closest(".videotimetabs")).each(function(i,tabs){$(tabs).find('[data-action="cue"]').each(function(index,anchor){let starttime=anchor.getAttribute("data-start"),time=starttime.match(/((([0-9]+):)?(([0-9]+):))?([0-9]+(\.[0-9]+))/);time&&this.player.addCuePoint(3600*Number(time[3]||0)+60*Number(time[5]||0)+Number(time[6]),{starttime:starttime}).catch(Notification.exeception)}.bind(this)),this.player.on("cuepoint",(function(event){event.data.starttime&&($(tabs).find(".videotime-highlight").removeClass("videotime-highlight"),$(tabs).find('[data-action="cue"][data-start="'+event.data.starttime+'"]').closest(".row").addClass("videotime-highlight"),$(".videotime-highlight").each((function(){this.offsetTop&&this.parentNode.scrollTo({top:this.offsetTop-50,left:0,behavior:"smooth"})})))}))}.bind(this)))):Log.debug("Player was not properly initialized for course module "+this.cmId)},VideoTime.prototype.startWatchInterval=function(){this.watchInterval||(this.watchInterval=setInterval(function(){this.getPaused().then((paused=>{paused||(this.time+=this.playbackRate,this.getSession().then(function(session){return this.time%this.interval==0&&(Log.debug("VIDEO_TIME watch_time: "+this.time+". percent: "+this.percent),this.recordWatchTime(session.id,this.time),this.setPercent(session.id,this.percent),this.setCurrentTime(session.id,this.currentTime)),!0}.bind(this)).catch(Notification.exception))}))}.bind(this),1e3))},VideoTime.prototype.setSessionState=function(sessionId,state){return Ajax.call([{methodname:"videotimeplugin_pro_set_session_state",args:{session_id:sessionId,state:state}}])[0]},VideoTime.prototype.setCurrentTime=function(sessionId,currentTime){return Ajax.call([{methodname:"videotimeplugin_pro_set_session_current_time",args:{session_id:sessionId,current_time:currentTime}}])[0]},VideoTime.prototype.setPercent=function(sessionId,percent){return Ajax.call([{methodname:"videotimeplugin_pro_set_percent",args:{session_id:sessionId,percent:percent}}])[0]},VideoTime.prototype.recordWatchTime=function(sessionId,time){return Ajax.call([{methodname:"videotimeplugin_pro_record_watch_time",args:{session_id:sessionId,time:time}}])[0]},VideoTime.prototype.getNextActivityButtonData=function(sessionId){return Ajax.call([{methodname:"videotimeplugin_pro_get_next_activity_button_data",args:{session_id:sessionId}}])[0]},VideoTime.prototype.getInstance=function(){return this.instance?Promise.resolve(this.instance):new Promise((resolve=>{Ajax.call([{methodname:"mod_videotime_get_videotime",args:{cmid:this.cmId}}])[0].then((response=>(this.instance=response,resolve(this.instance),!0))).fail(Notification.exception)}))},VideoTime.prototype.getResumeTime=function(){return this.resumeTime?Promise.resolve(this.resumeTime):new Promise((resolve=>{Ajax.call([{methodname:"videotimeplugin_pro_get_resume_time",args:{cmid:this.cmId}}])[0].then((response=>(this.resumeTime=response.seconds,resolve(this.resumeTime),!0))).fail(Notification.exception)}))},VideoTime.prototype.getSession=function(){return this.session||(this.session=Ajax.call([{methodname:"videotimeplugin_pro_get_new_session",args:{cmid:this.cmId}}])[0].fail((e=>(this.session=null,Notification.exception(e),e)))),this.session},VideoTime.prototype.setStartTime=function(starttime){let time=starttime.match(/((([0-9]+):)?(([0-9]+):))?([0-9]+(\.[0-9]+))/);return time?(this.resumeTime=3600*Number(time[3]||0)+60*Number(time[5]||0)+Number(time[6]),this.player.setCurrentTime(this.resumeTime)):this.player.getCurrentTime()},VideoTime.prototype.view=function(){return Ajax.call([{methodname:"mod_videotime_view_videotime",args:{cmid:this.cmId}}])[0]},VideoTime.prototype.initializeNewInstances=function(){this.modulecount!=$("body .activity.videotime").length&&(this.modulecount=$("body .activity.videotime").length,$("body .activity.videotime").each(function(index,module){if(!$(module).find(".instancename").length&&$(module).find(".vimeo-embed").length&&!$(module).find(".vimeo-embed iframe").length){let instance={cmid:Number($(module).attr("id").replace("module-","")),haspro:!0,interval:this.interval,uniqueid:$(module).find(".vimeo-embed").first().attr("id").replace("vimeo-embed-","")};Templates.render("mod_videotime/videotime_instance",{instance:instance}).then((function(html,js){return Templates.runTemplateJS(js),!0})).fail(Notification.exception)}}.bind(this)))},VideoTime})); - -//# sourceMappingURL=videotime.min.js.map \ No newline at end of file +define ("mod_videotime/videotime",["jquery","mod_videotime/player","core/ajax","core/log","core/templates","core/notification"],function(a,b,c,d,e,f){var g=function(b,c,d,e){this.elementId=b;this.cmId=c;this.hasPro=d;this.interval=e;this.player=null;this.resumeTime=null;this.session=null;this.instance=null;this.played=!1;this.playing=!1;this.time=0;this.percent=0;this.currentTime=0;this.playbackRate=1;this.plugins=[];if(d&&a("body").hasClass("path-course-view")&&!a("body").hasClass("vtinit")){a("body").addClass("vtinit");a(document).on("focus","body",this.initializeNewInstances.bind(this))}this.modulecount=a("body .activity.videotime").length};g.prototype.getCmId=function(){return this.cmId};g.prototype.registerPlugin=function(a){this.plugins.push(a)};g.prototype.initialize=function(){var a=this;d.debug("Initializing Video Time "+this.elementId);this.getInstance().then(function(c){d.debug("Initializing Vimeo player with options:");d.debug(c);a.player=new b(a.elementId,{autopause:c.autopause,autoplay:c.autoplay,background:c.background,byline:c.byline,color:c.color,controls:c.controls,dnt:c.dnt,height:c.height,maxheight:c.maxheight,maxwidth:c.maxwidth,muted:c.muted,portrait:c.portrait,pip:c.pip,playsinline:c.playsinline,responsive:c.responsive,speed:c.speed,title:c.title,transparent:c.transparent,url:c.vimeo_url,width:c.width});var e=new URL(window.location.href),g=e.searchParams.get("q"),h=(e.searchParams.get("time")||"").match(/^([0-9]+:){0,2}([0-9]+)(\.[0-9]+)$/);if(h){a.setStartTime(h[0]).then(function(){if(g&&window.find){window.find(g)}return!0}).catch(f.exception)}else if(g&&window.find){window.find(g)}a.addListeners();for(var j=0,i;j=a){return!0}b.getPlayer().getDuration().then(function(c){var e=a;if(a+1>=Math.floor(c)){d.debug("VIDEO_TIME video finished, resuming at start of video.");e=0}d.debug("VIDEO_TIME resuming at "+e);b.player.on("loaded",function(){b.player.setCurrentTime(e)});return!0}).catch(f.exception);return!0}).catch(f.exception);this.player.on("play",function(){this.playing=!0;d.debug("VIDEO_TIME play")}.bind(this));this.player.on("playing",function(){this.playing=!0;d.debug("VIDEO_TIME playing")}.bind(this));this.player.on("pause",function(){this.playing=!1;d.debug("VIDEO_TIME pause")}.bind(this));this.player.on("stalled",function(){this.playing=!1;d.debug("VIDEO_TIME stalled")}.bind(this));this.player.on("suspend",function(){this.playing=!1;d.debug("VIDEO_TIME suspend")}.bind(this));this.player.on("abort",function(){this.playing=!1;d.debug("VIDEO_TIME abort")}.bind(this));this.player.getPlaybackRate().then(function(a){this.playbackRate=a}.bind(this)).catch(f.exception);this.player.on("playbackratechange",function(a){this.playbackRate=a.playbackRate}.bind(this));this.player.on("timeupdate",function(a){this.percent=a.percent;this.currentTime=a.seconds;d.debug("VIDEO_TIME timeupdate. Percent: "+this.percent+". Current time: "+this.currentTime)}.bind(this));this.player.on("ended",function(){this.playing=!1;d.debug("VIDEO_TIME ended");new Promise(function(a){this.getSession().then(function(b){a(b);return!0}).catch(f.exception)}.bind(this)).then(function(a){this.setSessionState(a.id,1);return a}.bind(this)).then(function(a){this.setPercent(a.id,1);return a}.bind(this)).then(function(a){this.setCurrentTime(a.id,this.currentTime);return a}.bind(this)).catch(f.exception).finally(function(){this.getSession().then(function(b){this.getNextActivityButtonData(b.id).then(function(b){var c=JSON.parse(b.data);if(c.instance&&parseInt(c.instance.next_activity_auto)){if(!c.is_restricted&&c.hasnextcm){var d=a(".aalink[href=\""+c.nextcm_url+"\"] img").first();if(a(".path-course-view").length&&d){d.click()}else{window.location.href=c.nextcm_url}}}e.render("videotime/next_activity_button",JSON.parse(b.data)).then(function(b){a("#next-activity-button").html(b);return!0}).fail(f.exception);return!0}).fail(f.exception)}.bind(this)).catch(f.exception)}.bind(this)).fail(f.exception)}.bind(this));a(a("#"+this.elementId).closest(".videotimetabs")).each(function(b,c){a(c).find("[data-action=\"cue\"]").each(function(a,b){var c=b.getAttribute("data-start"),d=c.match(/((([0-9]+):)?(([0-9]+):))?([0-9]+(\.[0-9]+))/);if(d){this.player.addCuePoint(3600*+(d[3]||0)+60*+(d[5]||0)+ +d[6],{starttime:c}).catch(f.exeception)}}.bind(this));this.player.on("cuepoint",function(b){if(b.data.starttime){a(c).find(".videotime-highlight").removeClass("videotime-highlight");a(c).find("[data-action=\"cue\"][data-start=\""+b.data.starttime+"\"]").closest(".row").addClass("videotime-highlight");a(".videotime-highlight").each(function(){if(this.offsetTop){this.parentNode.scrollTo({top:this.offsetTop-50,left:0,behavior:"smooth"})}})}})}.bind(this))};g.prototype.startWatchInterval=function(){if(this.watchInterval){return}this.watchInterval=setInterval(function(){var a=this;this.getPaused().then(function(b){if(b){return}a.time+=a.playbackRate;a.getSession().then(function(a){if(0==this.time%this.interval){d.debug("VIDEO_TIME watch_time: "+this.time+". percent: "+this.percent);this.recordWatchTime(a.id,this.time);this.setPercent(a.id,this.percent);this.setCurrentTime(a.id,this.currentTime)}return!0}.bind(a)).catch(f.exception)})}.bind(this),1e3)};g.prototype.setSessionState=function(a,b){return c.call([{methodname:"videotimeplugin_pro_set_session_state",args:{session_id:a,state:b}}])[0]};g.prototype.setCurrentTime=function(a,b){return c.call([{methodname:"videotimeplugin_pro_set_session_current_time",args:{session_id:a,current_time:b}}])[0]};g.prototype.setPercent=function(a,b){return c.call([{methodname:"videotimeplugin_pro_set_percent",args:{session_id:a,percent:b}}])[0]};g.prototype.recordWatchTime=function(a,b){return c.call([{methodname:"videotimeplugin_pro_record_watch_time",args:{session_id:a,time:b}}])[0]};g.prototype.getNextActivityButtonData=function(a){return c.call([{methodname:"videotimeplugin_pro_get_next_activity_button_data",args:{session_id:a}}])[0]};g.prototype.getInstance=function(){var a=this;if(this.instance){return Promise.resolve(this.instance)}return new Promise(function(b){c.call([{methodname:"mod_videotime_get_videotime",args:{cmid:a.cmId}}])[0].then(function(c){a.instance=c;b(a.instance);return!0}).fail(f.exception)})};g.prototype.getResumeTime=function(){var a=this;if(this.resumeTime){return Promise.resolve(this.resumeTime)}return new Promise(function(b){c.call([{methodname:"videotimeplugin_pro_get_resume_time",args:{cmid:a.cmId}}])[0].then(function(c){a.resumeTime=c.seconds;b(a.resumeTime);return!0}).fail(f.exception)})};g.prototype.getSession=function(){var a=this;if(this.session){return this.session}this.session=c.call([{methodname:"videotimeplugin_pro_get_new_session",args:{cmid:this.cmId}}])[0].fail(function(b){a.session=null;f.exception(b);return b});return this.session};g.prototype.setStartTime=function(a){var b=a.match(/((([0-9]+):)?(([0-9]+):))?([0-9]+(\.[0-9]+))/);if(b){this.resumeTime=3600*+(b[3]||0)+60*+(b[5]||0)+ +b[6];return this.player.setCurrentTime(this.resumeTime)}return this.player.getCurrentTime()};g.prototype.view=function(){return c.call([{methodname:"mod_videotime_view_videotime",args:{cmid:this.cmId}}])[0]};g.prototype.initializeNewInstances=function(){if(this.modulecount==a("body .activity.videotime").length){return}this.modulecount=a("body .activity.videotime").length;a("body .activity.videotime").each(function(b,c){if(!a(c).find(".instancename").length&&a(c).find(".vimeo-embed").length&&!a(c).find(".vimeo-embed iframe").length){var d={cmid:+a(c).attr("id").replace("module-",""),haspro:!0,interval:this.interval,uniqueid:a(c).find(".vimeo-embed").first().attr("id").replace("vimeo-embed-","")};e.render("mod_videotime/videotime_instance",{instance:d}).then(function(a,b){e.runTemplateJS(b);return!0}).fail(f.exception)}}.bind(this))};return g}); +//# sourceMappingURL=videotime.min.js.map diff --git a/amd/build/videotime.min.js.map b/amd/build/videotime.min.js.map index fad86a91..b80c7de9 100644 --- a/amd/build/videotime.min.js.map +++ b/amd/build/videotime.min.js.map @@ -1 +1 @@ -{"version":3,"file":"videotime.min.js","sources":["../src/videotime.js"],"sourcesContent":["/*\n * @package mod_videotime\n * @copyright 2021 bdecent gmbh \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * @module mod_videotime/videotime\n */\ndefine([\n 'jquery',\n 'mod_videotime/player',\n 'core/ajax',\n 'core/log',\n 'core/templates',\n 'core/notification'\n], function(\n $,\n Vimeo,\n Ajax,\n Log,\n Templates,\n Notification\n) {\n\n let VideoTime = function(elementId, cmId, hasPro, interval) {\n this.elementId = elementId;\n this.cmId = cmId;\n this.hasPro = hasPro;\n this.interval = interval;\n this.player = null;\n this.resumeTime = null;\n this.session = null;\n this.instance = null;\n\n this.played = false;\n\n this.playing = false;\n this.time = 0;\n this.percent = 0;\n this.currentTime = 0;\n this.playbackRate = 1;\n\n this.plugins = [];\n\n if (hasPro && $('body').hasClass('path-course-view') && !$('body').hasClass('vtinit')) {\n $('body').addClass('vtinit');\n $(document).on('focus', 'body', this.initializeNewInstances.bind(this));\n }\n this.modulecount = $('body .activity.videotime').length;\n };\n\n /**\n * Get course module ID of this VideoTime instance.\n *\n * @return {int}\n */\n VideoTime.prototype.getCmId = function() {\n return this.cmId;\n };\n\n /**\n * Register a plugin to hook into VideoTime functionality.\n *\n * @param {VideoTimePlugin} plugin\n */\n VideoTime.prototype.registerPlugin = function(plugin) {\n this.plugins.push(plugin);\n };\n\n VideoTime.prototype.initialize = function() {\n Log.debug('Initializing Video Time ' + this.elementId);\n\n this.getInstance().then((instance) => {\n Log.debug('Initializing Vimeo player with options:');\n Log.debug(instance);\n this.player = new Vimeo(this.elementId, {\n autopause: instance.autopause,\n autoplay: instance.autoplay,\n background: instance.background,\n byline: instance.byline,\n color: instance.color,\n controls: instance.controls,\n dnt: instance.dnt,\n height: instance.height,\n maxheight: instance.maxheight,\n maxwidth: instance.maxwidth,\n muted: instance.muted,\n portrait: instance.portrait,\n pip: instance.pip,\n playsinline: instance.playsinline,\n responsive: instance.responsive,\n speed: instance.speed,\n title: instance.title,\n transparent: instance.transparent,\n url: instance.vimeo_url,\n width: instance.width\n });\n\n let url = new URL(window.location.href),\n q = url.searchParams.get('q'),\n starttime = (url.searchParams.get('time') || '').match(/^([0-9]+:){0,2}([0-9]+)(\\.[0-9]+)$/);\n if (starttime) {\n this.setStartTime(starttime[0]).then(function() {\n if (q && window.find) {\n window.find(q);\n }\n return true;\n }).catch(Notification.exception);\n } else if (q && window.find) {\n window.find(q);\n }\n\n this.addListeners();\n\n for (let i = 0; i < this.plugins.length; i++) {\n const plugin = this.plugins[i];\n plugin.initialize(this, instance);\n }\n\n return true;\n }).catch(Notification.exeption);\n };\n\n /**\n * Get Vimeo player object.\n *\n * @returns {Vimeo}\n */\n VideoTime.prototype.getPlayer = function() {\n return this.player;\n };\n\n /**\n * Get pause state\n *\n * @returns {Promise}\n */\n VideoTime.prototype.getPaused = function() {\n return this.player.getPaused();\n };\n\n\n /**\n * Register player events to respond to user interaction and play progress.\n */\n VideoTime.prototype.addListeners = function() {\n if (!this.player) {\n Log.debug('Player was not properly initialized for course module ' + this.cmId);\n return;\n }\n\n // Fire view event in Moodle on first play only.\n this.player.on('play', () => {\n if (!this.played) {\n if (this.hasPro) {\n // Getting a new session on first play.\n this.getSession();\n this.startWatchInterval();\n }\n this.view();\n this.played = true;\n }\n return true;\n });\n\n // Features beyond this point are for pro only.\n if (!this.hasPro) {\n return;\n }\n\n // If resume is present force seek the player to that point.\n this.getResumeTime().then((seconds) => {\n if (seconds <= 0) {\n return true;\n }\n\n this.getPlayer().getDuration().then((duration) => {\n let resumeTime = seconds;\n // Duration is often a little greater than a resume time at the end of the video.\n // A user may have watched 100 seconds when the video ends, but the duration may be\n // 100.56 seconds. BUT, sometimes the duration is rounded depending on when the\n // video loads, so it may be 101 seconds. Hence the +1 and Math.floor usage.\n if (seconds + 1 >= Math.floor(duration)) {\n Log.debug('VIDEO_TIME video finished, resuming at start of video.');\n resumeTime = 0;\n }\n\n Log.debug('VIDEO_TIME resuming at ' + resumeTime);\n this.player.on('loaded', () => {\n this.player.setCurrentTime(resumeTime);\n });\n return true;\n }).catch(Notification.exception);\n\n return true;\n }).catch(Notification.exception);\n\n // Note: Vimeo player does not support multiple events in a single on() call. Each requires it's own function.\n\n // Catch all events where video plays.\n this.player.on('play', function() {\n this.playing = true;\n Log.debug('VIDEO_TIME play');\n }.bind(this));\n this.player.on('playing', function() {\n this.playing = true;\n Log.debug('VIDEO_TIME playing');\n }.bind(this));\n\n // Catch all events where video stops.\n this.player.on('pause', function() {\n this.playing = false;\n Log.debug('VIDEO_TIME pause');\n }.bind(this));\n this.player.on('stalled', function() {\n this.playing = false;\n Log.debug('VIDEO_TIME stalled');\n }.bind(this));\n this.player.on('suspend', function() {\n this.playing = false;\n Log.debug('VIDEO_TIME suspend');\n }.bind(this));\n this.player.on('abort', function() {\n this.playing = false;\n Log.debug('VIDEO_TIME abort');\n }.bind(this));\n\n this.player.getPlaybackRate().then(function(playbackRate) {\n this.playbackRate = playbackRate;\n }.bind(this)).catch(Notification.exception);\n\n this.player.on('playbackratechange', function(event) {\n this.playbackRate = event.playbackRate;\n }.bind(this));\n\n // Always update internal values for percent and current time watched.\n this.player.on('timeupdate', function(event) {\n this.percent = event.percent;\n this.currentTime = event.seconds;\n Log.debug('VIDEO_TIME timeupdate. Percent: ' + this.percent + '. Current time: ' + this.currentTime);\n }.bind(this));\n\n // Initiate video finish procedure.\n this.player.on('ended', function() {\n this.playing = false;\n Log.debug('VIDEO_TIME ended');\n\n new Promise(function(resolve) {\n this.getSession().then(function(session) {\n resolve(session);\n return true;\n }).catch(Notification.exception);\n }.bind(this)).then(function(session) {\n this.setSessionState(session.id, 1);\n return session;\n }.bind(this)).then(function(session) {\n this.setPercent(session.id, 1);\n return session;\n }.bind(this)).then(function(session) {\n this.setCurrentTime(session.id, this.currentTime);\n return session;\n }.bind(this)).catch(Notification.exception).finally(function() {\n this.getSession().then(function(session) {\n this.getNextActivityButtonData(session.id).then(function(response) {\n let data = JSON.parse(response.data);\n\n if (data.instance && parseInt(data.instance.next_activity_auto)) {\n if (!data.is_restricted && data.hasnextcm) {\n let link = $('.aalink[href=\"' + data.nextcm_url + '\"] img').first();\n if ($('.path-course-view').length && link) {\n link.click();\n } else {\n window.location.href = data.nextcm_url;\n }\n }\n }\n\n Templates.render('videotime/next_activity_button', JSON.parse(response.data))\n .then(function(html) {\n $('#next-activity-button').html(html);\n return true;\n }).fail(Notification.exception);\n return true;\n }).fail(Notification.exception);\n }.bind(this)).catch(Notification.exception);\n }.bind(this)).fail(Notification.exception);\n }.bind(this));\n\n // If this is a tab play set time cues and listener.\n $($('#' + this.elementId).closest('.videotimetabs')).each(function(i, tabs) {\n $(tabs).find('[data-action=\"cue\"]').each(function(index, anchor) {\n let starttime = anchor.getAttribute('data-start'),\n time = starttime.match(/((([0-9]+):)?(([0-9]+):))?([0-9]+(\\.[0-9]+))/);\n if (time) {\n this.player.addCuePoint(\n 3600 * Number(time[3] || 0) + 60 * Number(time[5] || 0) + Number(time[6]),\n {\n starttime: starttime\n }\n ).catch(Notification.exeception);\n }\n }.bind(this));\n\n this.player.on('cuepoint', function(event) {\n if (event.data.starttime) {\n $(tabs).find('.videotime-highlight').removeClass('videotime-highlight');\n $(tabs).find('[data-action=\"cue\"][data-start=\"' + event.data.starttime + '\"]')\n .closest('.row')\n .addClass('videotime-highlight');\n $('.videotime-highlight').each(function() {\n if (this.offsetTop) {\n this.parentNode.scrollTo({\n top: this.offsetTop - 50,\n left: 0,\n behavior: 'smooth'\n });\n }\n });\n }\n });\n }.bind(this));\n };\n\n /**\n * Start interval that will periodically record user progress via Ajax.\n */\n VideoTime.prototype.startWatchInterval = function() {\n if (this.watchInterval) {\n return;\n }\n\n this.watchInterval = setInterval(function() {\n this.getPaused().then(paused => {\n if (paused) {\n return;\n }\n this.time += this.playbackRate;\n\n this.getSession().then(function(session) {\n if (this.time % this.interval === 0) {\n Log.debug('VIDEO_TIME watch_time: ' + this.time + '. percent: ' + this.percent);\n this.recordWatchTime(session.id, this.time);\n this.setPercent(session.id, this.percent);\n this.setCurrentTime(session.id, this.currentTime);\n }\n return true;\n }.bind(this)).catch(Notification.exception);\n });\n }.bind(this), 1000);\n };\n\n /**\n * Set state on session.\n *\n * @param {int} sessionId\n * @param {int} state\n * @returns {Promise}\n */\n VideoTime.prototype.setSessionState = function(sessionId, state) {\n return Ajax.call([{\n methodname: 'videotimeplugin_pro_set_session_state',\n args: {\"session_id\": sessionId, state: state}\n }])[0];\n };\n\n /**\n * Set current watch time for video. Used for resuming.\n *\n * @param {int} sessionId\n * @param {float} currentTime\n * @returns {Promise}\n */\n VideoTime.prototype.setCurrentTime = function(sessionId, currentTime) {\n return Ajax.call([{\n methodname: 'videotimeplugin_pro_set_session_current_time',\n args: {\"session_id\": sessionId, \"current_time\": currentTime}\n }])[0];\n };\n\n /**\n * Set video watch percentage for session.\n *\n * @param {int} sessionId\n * @param {float} percent\n * @returns {Promise}\n */\n VideoTime.prototype.setPercent = function(sessionId, percent) {\n return Ajax.call([{\n methodname: 'videotimeplugin_pro_set_percent',\n args: {\"session_id\": sessionId, percent: percent}\n }])[0];\n };\n\n /**\n * Record watch time for session.\n *\n * @param {int} sessionId\n * @param {float} time\n * @returns {Promise}\n */\n VideoTime.prototype.recordWatchTime = function(sessionId, time) {\n return Ajax.call([{\n methodname: 'videotimeplugin_pro_record_watch_time',\n args: {\"session_id\": sessionId, time: time}\n }])[0];\n };\n\n /**\n * Get data for next activity button.\n *\n * @param {int} sessionId\n * @returns {Promise}\n */\n VideoTime.prototype.getNextActivityButtonData = function(sessionId) {\n return Ajax.call([{\n methodname: 'videotimeplugin_pro_get_next_activity_button_data',\n args: {\"session_id\": sessionId}\n }])[0];\n };\n\n /**\n * Get VideoTime instance for this course module.\n *\n * @returns {Promise}\n */\n VideoTime.prototype.getInstance = function() {\n if (this.instance) {\n return Promise.resolve(this.instance);\n }\n\n return new Promise((resolve) => {\n Ajax.call([{\n methodname: 'mod_videotime_get_videotime',\n args: {cmid: this.cmId}\n }])[0].then((response) => {\n this.instance = response;\n resolve(this.instance);\n return true;\n }).fail(Notification.exception);\n });\n };\n\n /**\n * Get time to resume video as seconds.\n *\n * @returns {Promise}\n */\n VideoTime.prototype.getResumeTime = function() {\n if (this.resumeTime) {\n return Promise.resolve(this.resumeTime);\n }\n\n return new Promise((resolve) => {\n Ajax.call([{\n methodname: 'videotimeplugin_pro_get_resume_time',\n args: {cmid: this.cmId}\n }])[0].then((response) => {\n this.resumeTime = response.seconds;\n resolve(this.resumeTime);\n return true;\n }).fail(Notification.exception);\n });\n };\n\n /**\n * Get new or existing video viewing session.\n *\n * @returns {Promise}\n */\n VideoTime.prototype.getSession = function() {\n if (this.session) {\n return this.session;\n }\n\n this.session = Ajax.call([{\n methodname: 'videotimeplugin_pro_get_new_session',\n args: {cmid: this.cmId}\n }])[0].fail((e) => {\n this.session = null;\n Notification.exception(e);\n return e;\n });\n\n return this.session;\n };\n\n /**\n * Parse start time and set player\n *\n * @param {string} starttime\n * @returns {Promise}\n */\n VideoTime.prototype.setStartTime = function(starttime) {\n let time = starttime.match(/((([0-9]+):)?(([0-9]+):))?([0-9]+(\\.[0-9]+))/);\n if (time) {\n this.resumeTime = 3600 * Number(time[3] || 0) + 60 * Number(time[5] || 0) + Number(time[6]);\n return this.player.setCurrentTime(this.resumeTime);\n }\n return this.player.getCurrentTime();\n };\n\n /**\n * Log the user view of video.\n *\n * @returns {Promise}\n */\n VideoTime.prototype.view = function() {\n return Ajax.call([{\n methodname: 'mod_videotime_view_videotime',\n args: {cmid: this.cmId}\n }])[0];\n };\n\n /**\n * Initialize new labels and preview when editing\n */\n VideoTime.prototype.initializeNewInstances = function() {\n if (this.modulecount == $('body .activity.videotime').length) {\n return;\n }\n this.modulecount = $('body .activity.videotime').length;\n $('body .activity.videotime').each(function(index, module) {\n if (\n !$(module).find('.instancename').length\n && $(module).find('.vimeo-embed').length\n && !$(module).find('.vimeo-embed iframe').length\n ) {\n let instance = {\n cmid: Number($(module).attr('id').replace('module-', '')),\n haspro: true,\n interval: this.interval,\n uniqueid: $(module).find('.vimeo-embed').first().attr('id').replace('vimeo-embed-', '')\n };\n Templates.render('mod_videotime/videotime_instance', {\n instance: instance\n }).then(function(html, js) {\n Templates.runTemplateJS(js);\n return true;\n }).fail(Notification.exception);\n }\n }.bind(this));\n };\n\n return VideoTime;\n});\n"],"names":["define","$","Vimeo","Ajax","Log","Templates","Notification","VideoTime","elementId","cmId","hasPro","interval","player","resumeTime","session","instance","played","playing","time","percent","currentTime","playbackRate","plugins","hasClass","addClass","document","on","this","initializeNewInstances","bind","modulecount","length","prototype","getCmId","registerPlugin","plugin","push","initialize","debug","getInstance","then","autopause","autoplay","background","byline","color","controls","dnt","height","maxheight","maxwidth","muted","portrait","pip","playsinline","responsive","speed","title","transparent","url","vimeo_url","width","URL","window","location","href","q","searchParams","get","starttime","match","setStartTime","find","catch","exception","addListeners","i","exeption","getPlayer","getPaused","getSession","startWatchInterval","view","getResumeTime","seconds","getDuration","duration","Math","floor","setCurrentTime","getPlaybackRate","event","Promise","resolve","setSessionState","id","setPercent","finally","getNextActivityButtonData","response","data","JSON","parse","parseInt","next_activity_auto","is_restricted","hasnextcm","link","nextcm_url","first","click","render","html","fail","closest","each","tabs","index","anchor","getAttribute","addCuePoint","Number","exeception","removeClass","offsetTop","parentNode","scrollTo","top","left","behavior","watchInterval","setInterval","paused","recordWatchTime","sessionId","state","call","methodname","args","cmid","e","getCurrentTime","module","attr","replace","haspro","uniqueid","js","runTemplateJS"],"mappings":";;;;;AASAA,iCAAO,CACH,SACA,uBACA,YACA,WACA,iBACA,sBACD,SACCC,EACAC,MACAC,KACAC,IACAC,UACAC,kBAGIC,UAAY,SAASC,UAAWC,KAAMC,OAAQC,eACzCH,UAAYA,eACZC,KAAOA,UACPC,OAASA,YACTC,SAAWA,cACXC,OAAS,UACTC,WAAa,UACbC,QAAU,UACVC,SAAW,UAEXC,QAAS,OAETC,SAAU,OACVC,KAAO,OACPC,QAAU,OACVC,YAAc,OACdC,aAAe,OAEfC,QAAU,GAEXZ,QAAUT,EAAE,QAAQsB,SAAS,sBAAwBtB,EAAE,QAAQsB,SAAS,YACxEtB,EAAE,QAAQuB,SAAS,UACnBvB,EAAEwB,UAAUC,GAAG,QAAS,OAAQC,KAAKC,uBAAuBC,KAAKF,aAEhEG,YAAc7B,EAAE,4BAA4B8B,eAQrDxB,UAAUyB,UAAUC,QAAU,kBACnBN,KAAKlB,MAQhBF,UAAUyB,UAAUE,eAAiB,SAASC,aACrCb,QAAQc,KAAKD,SAGtB5B,UAAUyB,UAAUK,WAAa,WAC7BjC,IAAIkC,MAAM,2BAA6BX,KAAKnB,gBAEvC+B,cAAcC,MAAMzB,WACrBX,IAAIkC,MAAM,2CACVlC,IAAIkC,MAAMvB,eACLH,OAAS,IAAIV,MAAMyB,KAAKnB,UAAW,CACpCiC,UAAW1B,SAAS0B,UACpBC,SAAU3B,SAAS2B,SACnBC,WAAY5B,SAAS4B,WACrBC,OAAQ7B,SAAS6B,OACjBC,MAAO9B,SAAS8B,MAChBC,SAAU/B,SAAS+B,SACnBC,IAAKhC,SAASgC,IACdC,OAAQjC,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B,UAAUJ,uBAAyB,WACrCD,KAAKG,aAAe7B,EAAE,4BAA4B8B,cAGjDD,YAAc7B,EAAE,4BAA4B8B,OACjD9B,EAAE,4BAA4BkH,KAAK,SAASE,MAAOyB,YAE1C7I,EAAE6I,QAAQtE,KAAK,iBAAiBzC,QAC9B9B,EAAE6I,QAAQtE,KAAK,gBAAgBzC,SAC9B9B,EAAE6I,QAAQtE,KAAK,uBAAuBzC,OAC5C,KACMhB,SAAW,CACX4H,KAAMlB,OAAOxH,EAAE6I,QAAQC,KAAK,MAAMC,QAAQ,UAAW,KACrDC,QAAQ,EACRtI,SAAUgB,KAAKhB,SACfuI,SAAUjJ,EAAE6I,QAAQtE,KAAK,gBAAgBqC,QAAQkC,KAAK,MAAMC,QAAQ,eAAgB,KAExF3I,UAAU0G,OAAO,mCAAoC,CACjDhG,SAAUA,WACXyB,MAAK,SAASwE,KAAMmC,WACnB9I,UAAU+I,cAAcD,KACjB,KACRlC,KAAK3G,aAAaoE,aAE3B7C,KAAKF,SAGJpB"} \ No newline at end of file +{"version":3,"sources":["../src/videotime.js"],"names":["define","$","Vimeo","Ajax","Log","Templates","Notification","VideoTime","elementId","cmId","hasPro","interval","player","resumeTime","session","instance","played","playing","time","percent","currentTime","playbackRate","plugins","hasClass","addClass","document","on","initializeNewInstances","bind","modulecount","length","prototype","getCmId","registerPlugin","plugin","push","initialize","debug","getInstance","then","autopause","autoplay","background","byline","color","controls","dnt","height","maxheight","maxwidth","muted","portrait","pip","playsinline","responsive","speed","title","transparent","url","vimeo_url","width","URL","window","location","href","q","searchParams","get","starttime","match","setStartTime","find","catch","exception","addListeners","i","exeption","getPlayer","getPaused","getSession","startWatchInterval","view","getResumeTime","seconds","getDuration","duration","Math","floor","setCurrentTime","getPlaybackRate","event","Promise","resolve","setSessionState","id","setPercent","finally","getNextActivityButtonData","response","data","JSON","parse","parseInt","next_activity_auto","is_restricted","hasnextcm","link","nextcm_url","first","click","render","html","fail","closest","each","tabs","index","anchor","getAttribute","addCuePoint","exeception","removeClass","offsetTop","parentNode","scrollTo","top","left","behavior","watchInterval","setInterval","paused","recordWatchTime","sessionId","state","call","methodname","args","cmid","e","getCurrentTime","module","attr","replace","haspro","uniqueid","js","runTemplateJS"],"mappings":"AASAA,OAAM,2BAAC,CACH,QADG,CAEH,sBAFG,CAGH,WAHG,CAIH,UAJG,CAKH,gBALG,CAMH,mBANG,CAAD,CAOH,SACCC,CADD,CAECC,CAFD,CAGCC,CAHD,CAICC,CAJD,CAKCC,CALD,CAMCC,CAND,CAOD,CAEE,GAAIC,CAAAA,CAAS,CAAG,SAASC,CAAT,CAAoBC,CAApB,CAA0BC,CAA1B,CAAkCC,CAAlC,CAA4C,CACxD,KAAKH,SAAL,CAAiBA,CAAjB,CACA,KAAKC,IAAL,CAAYA,CAAZ,CACA,KAAKC,MAAL,CAAcA,CAAd,CACA,KAAKC,QAAL,CAAgBA,CAAhB,CACA,KAAKC,MAAL,CAAc,IAAd,CACA,KAAKC,UAAL,CAAkB,IAAlB,CACA,KAAKC,OAAL,CAAe,IAAf,CACA,KAAKC,QAAL,CAAgB,IAAhB,CAEA,KAAKC,MAAL,IAEA,KAAKC,OAAL,IACA,KAAKC,IAAL,CAAY,CAAZ,CACA,KAAKC,OAAL,CAAe,CAAf,CACA,KAAKC,WAAL,CAAmB,CAAnB,CACA,KAAKC,YAAL,CAAoB,CAApB,CAEA,KAAKC,OAAL,CAAe,EAAf,CAEA,GAAIZ,CAAM,EAAIT,CAAC,CAAC,MAAD,CAAD,CAAUsB,QAAV,CAAmB,kBAAnB,CAAV,EAAoD,CAACtB,CAAC,CAAC,MAAD,CAAD,CAAUsB,QAAV,CAAmB,QAAnB,CAAzD,CAAuF,CACnFtB,CAAC,CAAC,MAAD,CAAD,CAAUuB,QAAV,CAAmB,QAAnB,EACAvB,CAAC,CAACwB,QAAD,CAAD,CAAYC,EAAZ,CAAe,OAAf,CAAwB,MAAxB,CAAgC,KAAKC,sBAAL,CAA4BC,IAA5B,CAAiC,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SAA7B,CAAwC,EAAxC,CADF,CAEXC,MAAM,GAFK,CAGXpI,QAAQ,CAAE,KAAKA,QAHJ,CAIXqI,QAAQ,CAAE/I,CAAC,CAAC2I,CAAD,CAAD,CAAUrE,IAAV,CAAe,cAAf,EAA+BqC,KAA/B,GAAuCiC,IAAvC,CAA4C,IAA5C,EAAkDC,OAAlD,CAA0D,cAA1D,CAA0E,EAA1E,CAJC,CAAf,CAMAzI,CAAS,CAACyG,MAAV,CAAiB,kCAAjB,CAAqD,CACjD/F,QAAQ,CAAEA,CADuC,CAArD,EAEGwB,IAFH,CAEQ,SAASwE,CAAT,CAAekC,CAAf,CAAmB,CACvB5I,CAAS,CAAC6I,aAAV,CAAwBD,CAAxB,EACA,QACH,CALD,EAKGjC,IALH,CAKQ1G,CAAY,CAACmE,SALrB,CAMH,CACJ,CAnBkC,CAmBjC7C,IAnBiC,CAmB5B,IAnB4B,CAAnC,CAoBH,CAzBD,CA2BA,MAAOrB,CAAAA,CACV,CAxhBK,CAAN","sourcesContent":["/*\n * @package mod_videotime\n * @copyright 2021 bdecent gmbh \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * @module mod_videotime/videotime\n */\ndefine([\n 'jquery',\n 'mod_videotime/player',\n 'core/ajax',\n 'core/log',\n 'core/templates',\n 'core/notification'\n], function(\n $,\n Vimeo,\n Ajax,\n Log,\n Templates,\n Notification\n) {\n\n let VideoTime = function(elementId, cmId, hasPro, interval) {\n this.elementId = elementId;\n this.cmId = cmId;\n this.hasPro = hasPro;\n this.interval = interval;\n this.player = null;\n this.resumeTime = null;\n this.session = null;\n this.instance = null;\n\n this.played = false;\n\n this.playing = false;\n this.time = 0;\n this.percent = 0;\n this.currentTime = 0;\n this.playbackRate = 1;\n\n this.plugins = [];\n\n if (hasPro && $('body').hasClass('path-course-view') && !$('body').hasClass('vtinit')) {\n $('body').addClass('vtinit');\n $(document).on('focus', 'body', this.initializeNewInstances.bind(this));\n }\n this.modulecount = $('body .activity.videotime').length;\n };\n\n /**\n * Get course module ID of this VideoTime instance.\n *\n * @return {int}\n */\n VideoTime.prototype.getCmId = function() {\n return this.cmId;\n };\n\n /**\n * Register a plugin to hook into VideoTime functionality.\n *\n * @param {VideoTimePlugin} plugin\n */\n VideoTime.prototype.registerPlugin = function(plugin) {\n this.plugins.push(plugin);\n };\n\n VideoTime.prototype.initialize = function() {\n Log.debug('Initializing Video Time ' + this.elementId);\n\n this.getInstance().then((instance) => {\n Log.debug('Initializing Vimeo player with options:');\n Log.debug(instance);\n this.player = new Vimeo(this.elementId, {\n autopause: instance.autopause,\n autoplay: instance.autoplay,\n background: instance.background,\n byline: instance.byline,\n color: instance.color,\n controls: instance.controls,\n dnt: instance.dnt,\n height: instance.height,\n maxheight: instance.maxheight,\n maxwidth: instance.maxwidth,\n muted: instance.muted,\n portrait: instance.portrait,\n pip: instance.pip,\n playsinline: instance.playsinline,\n responsive: instance.responsive,\n speed: instance.speed,\n title: instance.title,\n transparent: instance.transparent,\n url: instance.vimeo_url,\n width: instance.width\n });\n\n let url = new URL(window.location.href),\n q = url.searchParams.get('q'),\n starttime = (url.searchParams.get('time') || '').match(/^([0-9]+:){0,2}([0-9]+)(\\.[0-9]+)$/);\n if (starttime) {\n this.setStartTime(starttime[0]).then(function() {\n if (q && window.find) {\n window.find(q);\n }\n return true;\n }).catch(Notification.exception);\n } else if (q && window.find) {\n window.find(q);\n }\n\n this.addListeners();\n\n for (let i = 0; i < this.plugins.length; i++) {\n const plugin = this.plugins[i];\n plugin.initialize(this, instance);\n }\n\n return true;\n }).catch(Notification.exeption);\n };\n\n /**\n * Get Vimeo player object.\n *\n * @returns {Vimeo}\n */\n VideoTime.prototype.getPlayer = function() {\n return this.player;\n };\n\n /**\n * Get pause state\n *\n * @returns {Promise}\n */\n VideoTime.prototype.getPaused = function() {\n return this.player.getPaused();\n };\n\n\n /**\n * Register player events to respond to user interaction and play progress.\n */\n VideoTime.prototype.addListeners = function() {\n if (!this.player) {\n Log.debug('Player was not properly initialized for course module ' + this.cmId);\n return;\n }\n\n // Fire view event in Moodle on first play only.\n this.player.on('play', () => {\n if (!this.played) {\n if (this.hasPro) {\n // Getting a new session on first play.\n this.getSession();\n this.startWatchInterval();\n }\n this.view();\n this.played = true;\n }\n return true;\n });\n\n // Features beyond this point are for pro only.\n if (!this.hasPro) {\n return;\n }\n\n // If resume is present force seek the player to that point.\n this.getResumeTime().then((seconds) => {\n if (seconds <= 0) {\n return true;\n }\n\n this.getPlayer().getDuration().then((duration) => {\n let resumeTime = seconds;\n // Duration is often a little greater than a resume time at the end of the video.\n // A user may have watched 100 seconds when the video ends, but the duration may be\n // 100.56 seconds. BUT, sometimes the duration is rounded depending on when the\n // video loads, so it may be 101 seconds. Hence the +1 and Math.floor usage.\n if (seconds + 1 >= Math.floor(duration)) {\n Log.debug('VIDEO_TIME video finished, resuming at start of video.');\n resumeTime = 0;\n }\n\n Log.debug('VIDEO_TIME resuming at ' + resumeTime);\n this.player.on('loaded', () => {\n this.player.setCurrentTime(resumeTime);\n });\n return true;\n }).catch(Notification.exception);\n\n return true;\n }).catch(Notification.exception);\n\n // Note: Vimeo player does not support multiple events in a single on() call. Each requires it's own function.\n\n // Catch all events where video plays.\n this.player.on('play', function() {\n this.playing = true;\n Log.debug('VIDEO_TIME play');\n }.bind(this));\n this.player.on('playing', function() {\n this.playing = true;\n Log.debug('VIDEO_TIME playing');\n }.bind(this));\n\n // Catch all events where video stops.\n this.player.on('pause', function() {\n this.playing = false;\n Log.debug('VIDEO_TIME pause');\n }.bind(this));\n this.player.on('stalled', function() {\n this.playing = false;\n Log.debug('VIDEO_TIME stalled');\n }.bind(this));\n this.player.on('suspend', function() {\n this.playing = false;\n Log.debug('VIDEO_TIME suspend');\n }.bind(this));\n this.player.on('abort', function() {\n this.playing = false;\n Log.debug('VIDEO_TIME abort');\n }.bind(this));\n\n this.player.getPlaybackRate().then(function(playbackRate) {\n this.playbackRate = playbackRate;\n }.bind(this)).catch(Notification.exception);\n\n this.player.on('playbackratechange', function(event) {\n this.playbackRate = event.playbackRate;\n }.bind(this));\n\n // Always update internal values for percent and current time watched.\n this.player.on('timeupdate', function(event) {\n this.percent = event.percent;\n this.currentTime = event.seconds;\n Log.debug('VIDEO_TIME timeupdate. Percent: ' + this.percent + '. Current time: ' + this.currentTime);\n }.bind(this));\n\n // Initiate video finish procedure.\n this.player.on('ended', function() {\n this.playing = false;\n Log.debug('VIDEO_TIME ended');\n\n new Promise(function(resolve) {\n this.getSession().then(function(session) {\n resolve(session);\n return true;\n }).catch(Notification.exception);\n }.bind(this)).then(function(session) {\n this.setSessionState(session.id, 1);\n return session;\n }.bind(this)).then(function(session) {\n this.setPercent(session.id, 1);\n return session;\n }.bind(this)).then(function(session) {\n this.setCurrentTime(session.id, this.currentTime);\n return session;\n }.bind(this)).catch(Notification.exception).finally(function() {\n this.getSession().then(function(session) {\n this.getNextActivityButtonData(session.id).then(function(response) {\n let data = JSON.parse(response.data);\n\n if (data.instance && parseInt(data.instance.next_activity_auto)) {\n if (!data.is_restricted && data.hasnextcm) {\n let link = $('.aalink[href=\"' + data.nextcm_url + '\"] img').first();\n if ($('.path-course-view').length && link) {\n link.click();\n } else {\n window.location.href = data.nextcm_url;\n }\n }\n }\n\n Templates.render('videotime/next_activity_button', JSON.parse(response.data))\n .then(function(html) {\n $('#next-activity-button').html(html);\n return true;\n }).fail(Notification.exception);\n return true;\n }).fail(Notification.exception);\n }.bind(this)).catch(Notification.exception);\n }.bind(this)).fail(Notification.exception);\n }.bind(this));\n\n // If this is a tab play set time cues and listener.\n $($('#' + this.elementId).closest('.videotimetabs')).each(function(i, tabs) {\n $(tabs).find('[data-action=\"cue\"]').each(function(index, anchor) {\n let starttime = anchor.getAttribute('data-start'),\n time = starttime.match(/((([0-9]+):)?(([0-9]+):))?([0-9]+(\\.[0-9]+))/);\n if (time) {\n this.player.addCuePoint(\n 3600 * Number(time[3] || 0) + 60 * Number(time[5] || 0) + Number(time[6]),\n {\n starttime: starttime\n }\n ).catch(Notification.exeception);\n }\n }.bind(this));\n\n this.player.on('cuepoint', function(event) {\n if (event.data.starttime) {\n $(tabs).find('.videotime-highlight').removeClass('videotime-highlight');\n $(tabs).find('[data-action=\"cue\"][data-start=\"' + event.data.starttime + '\"]')\n .closest('.row')\n .addClass('videotime-highlight');\n $('.videotime-highlight').each(function() {\n if (this.offsetTop) {\n this.parentNode.scrollTo({\n top: this.offsetTop - 50,\n left: 0,\n behavior: 'smooth'\n });\n }\n });\n }\n });\n }.bind(this));\n };\n\n /**\n * Start interval that will periodically record user progress via Ajax.\n */\n VideoTime.prototype.startWatchInterval = function() {\n if (this.watchInterval) {\n return;\n }\n\n this.watchInterval = setInterval(function() {\n this.getPaused().then(paused => {\n if (paused) {\n return;\n }\n this.time += this.playbackRate;\n\n this.getSession().then(function(session) {\n if (this.time % this.interval === 0) {\n Log.debug('VIDEO_TIME watch_time: ' + this.time + '. percent: ' + this.percent);\n this.recordWatchTime(session.id, this.time);\n this.setPercent(session.id, this.percent);\n this.setCurrentTime(session.id, this.currentTime);\n }\n return true;\n }.bind(this)).catch(Notification.exception);\n });\n }.bind(this), 1000);\n };\n\n /**\n * Set state on session.\n *\n * @param {int} sessionId\n * @param {int} state\n * @returns {Promise}\n */\n VideoTime.prototype.setSessionState = function(sessionId, state) {\n return Ajax.call([{\n methodname: 'videotimeplugin_pro_set_session_state',\n args: {\"session_id\": sessionId, state: state}\n }])[0];\n };\n\n /**\n * Set current watch time for video. Used for resuming.\n *\n * @param {int} sessionId\n * @param {float} currentTime\n * @returns {Promise}\n */\n VideoTime.prototype.setCurrentTime = function(sessionId, currentTime) {\n return Ajax.call([{\n methodname: 'videotimeplugin_pro_set_session_current_time',\n args: {\"session_id\": sessionId, \"current_time\": currentTime}\n }])[0];\n };\n\n /**\n * Set video watch percentage for session.\n *\n * @param {int} sessionId\n * @param {float} percent\n * @returns {Promise}\n */\n VideoTime.prototype.setPercent = function(sessionId, percent) {\n return Ajax.call([{\n methodname: 'videotimeplugin_pro_set_percent',\n args: {\"session_id\": sessionId, percent: percent}\n }])[0];\n };\n\n /**\n * Record watch time for session.\n *\n * @param {int} sessionId\n * @param {float} time\n * @returns {Promise}\n */\n VideoTime.prototype.recordWatchTime = function(sessionId, time) {\n return Ajax.call([{\n methodname: 'videotimeplugin_pro_record_watch_time',\n args: {\"session_id\": sessionId, time: time}\n }])[0];\n };\n\n /**\n * Get data for next activity button.\n *\n * @param {int} sessionId\n * @returns {Promise}\n */\n VideoTime.prototype.getNextActivityButtonData = function(sessionId) {\n return Ajax.call([{\n methodname: 'videotimeplugin_pro_get_next_activity_button_data',\n args: {\"session_id\": sessionId}\n }])[0];\n };\n\n /**\n * Get VideoTime instance for this course module.\n *\n * @returns {Promise}\n */\n VideoTime.prototype.getInstance = function() {\n if (this.instance) {\n return Promise.resolve(this.instance);\n }\n\n return new Promise((resolve) => {\n Ajax.call([{\n methodname: 'mod_videotime_get_videotime',\n args: {cmid: this.cmId}\n }])[0].then((response) => {\n this.instance = response;\n resolve(this.instance);\n return true;\n }).fail(Notification.exception);\n });\n };\n\n /**\n * Get time to resume video as seconds.\n *\n * @returns {Promise}\n */\n VideoTime.prototype.getResumeTime = function() {\n if (this.resumeTime) {\n return Promise.resolve(this.resumeTime);\n }\n\n return new Promise((resolve) => {\n Ajax.call([{\n methodname: 'videotimeplugin_pro_get_resume_time',\n args: {cmid: this.cmId}\n }])[0].then((response) => {\n this.resumeTime = response.seconds;\n resolve(this.resumeTime);\n return true;\n }).fail(Notification.exception);\n });\n };\n\n /**\n * Get new or existing video viewing session.\n *\n * @returns {Promise}\n */\n VideoTime.prototype.getSession = function() {\n if (this.session) {\n return this.session;\n }\n\n this.session = Ajax.call([{\n methodname: 'videotimeplugin_pro_get_new_session',\n args: {cmid: this.cmId}\n }])[0].fail((e) => {\n this.session = null;\n Notification.exception(e);\n return e;\n });\n\n return this.session;\n };\n\n /**\n * Parse start time and set player\n *\n * @param {string} starttime\n * @returns {Promise}\n */\n VideoTime.prototype.setStartTime = function(starttime) {\n let time = starttime.match(/((([0-9]+):)?(([0-9]+):))?([0-9]+(\\.[0-9]+))/);\n if (time) {\n this.resumeTime = 3600 * Number(time[3] || 0) + 60 * Number(time[5] || 0) + Number(time[6]);\n return this.player.setCurrentTime(this.resumeTime);\n }\n return this.player.getCurrentTime();\n };\n\n /**\n * Log the user view of video.\n *\n * @returns {Promise}\n */\n VideoTime.prototype.view = function() {\n return Ajax.call([{\n methodname: 'mod_videotime_view_videotime',\n args: {cmid: this.cmId}\n }])[0];\n };\n\n /**\n * Initialize new labels and preview when editing\n */\n VideoTime.prototype.initializeNewInstances = function() {\n if (this.modulecount == $('body .activity.videotime').length) {\n return;\n }\n this.modulecount = $('body .activity.videotime').length;\n $('body .activity.videotime').each(function(index, module) {\n if (\n !$(module).find('.instancename').length\n && $(module).find('.vimeo-embed').length\n && !$(module).find('.vimeo-embed iframe').length\n ) {\n let instance = {\n cmid: Number($(module).attr('id').replace('module-', '')),\n haspro: true,\n interval: this.interval,\n uniqueid: $(module).find('.vimeo-embed').first().attr('id').replace('vimeo-embed-', '')\n };\n Templates.render('mod_videotime/videotime_instance', {\n instance: instance\n }).then(function(html, js) {\n Templates.runTemplateJS(js);\n return true;\n }).fail(Notification.exception);\n }\n }.bind(this));\n };\n\n return VideoTime;\n});\n"],"file":"videotime.min.js"} \ No newline at end of file