From 44df12fdfef99873af8ceb2b592b117fed9af938 Mon Sep 17 00:00:00 2001 From: Emilien Devos <4016501+unixfox@users.noreply.github.com> Date: Sun, 28 Apr 2024 17:46:20 +0200 Subject: [PATCH] update deps + fix videojs-contrib-quality-menu quality selection --- assets/css/quality-selector.css | 2 +- assets/js/player.js | 10 ++++------ assets/js/silvermine-videojs-quality-selector.min.js | 4 ++-- videojs-dependencies.yml | 10 +++++----- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/assets/css/quality-selector.css b/assets/css/quality-selector.css index f3cc0334..575aa365 100644 --- a/assets/css/quality-selector.css +++ b/assets/css/quality-selector.css @@ -1 +1 @@ -.vjs-quality-selector .vjs-menu-button{margin:0;padding:0;height:100%;width:100%}.vjs-quality-selector .vjs-icon-placeholder{font-family:'VideoJS';font-weight:normal;font-style:normal}.vjs-quality-selector .vjs-icon-placeholder:before{content:'\f110'}.vjs-quality-changing .vjs-big-play-button{display:none}.vjs-quality-changing .vjs-control-bar{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;visibility:visible;opacity:1} +.vjs-quality-selector .vjs-menu-button{margin:0;padding:0;height:100%;width:100%}.vjs-quality-selector .vjs-icon-placeholder{font-family:"VideoJS";font-weight:normal;font-style:normal}.video-js:not(.vjs-v8) .vjs-quality-selector .vjs-icon-placeholder::before{content:""}.vjs-v8 .vjs-quality-selector .vjs-icon-placeholder::before{content:""}.vjs-quality-changing .vjs-big-play-button{display:none}.vjs-quality-changing .vjs-control-bar{display:flex;visibility:visible;opacity:1} \ No newline at end of file diff --git a/assets/js/player.js b/assets/js/player.js index ef1a0ca6..c87ae4fa 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -43,7 +43,7 @@ embed_url = location.origin + '/embed/' + video_data.id + embed_url.search; var save_player_pos_key = 'save_player_pos'; -videojs.Vhs.xhr.beforeRequest = function(options) { +videojs.Vhs.xhr.onRequest = function(options) { // set local if requested not videoplayback if (!options.uri.includes('videoplayback')) { if (!options.uri.includes('local=true')) @@ -398,7 +398,6 @@ if (video_data.params.autoplay) { } if (!video_data.params.listen && video_data.params.quality === 'dash') { - var qualityMenuOptions = {} if (video_data.params.quality_dash !== 'auto') { player.ready(function () { @@ -421,13 +420,12 @@ if (!video_data.params.listen && video_data.params.quality === 'dash') { break; } } - qualityMenuOptions.defaultResolution = (qualityLevels[targetQualityLevel].height + "p"); + player.qualityMenu({ + defaultResolution: qualityLevels[targetQualityLevel].height + }); }); }); } - - console.log(qualityMenuOptions) - player.qualityMenu(qualityMenuOptions); } player.vttThumbnails({ diff --git a/assets/js/silvermine-videojs-quality-selector.min.js b/assets/js/silvermine-videojs-quality-selector.min.js index 1877047d..9a1f10d5 100644 --- a/assets/js/silvermine-videojs-quality-selector.min.js +++ b/assets/js/silvermine-videojs-quality-selector.min.js @@ -1,4 +1,4 @@ -/*! @silvermine/videojs-quality-selector 2022-04-13 v1.1.2-43-gaa06e72-dirty */ +/*! @silvermine/videojs-quality-selector 2024-04-28 v1.1.2-88-g294c48d-dirty */ -!function u(o,c,a){function l(e,n){if(!c[e]){if(!o[e]){var t="function"==typeof require&&require;if(!n&&t)return t(e,!0);if(s)return s(e,!0);var r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}var i=c[e]={exports:{}};o[e][0].call(i.exports,function(n){return l(o[e][1][n]||n)},i,i.exports,u,o,c,a)}return c[e].exports}for(var s="function"==typeof require&&require,n=0;n":">",'"':""","'":"'","`":"`"},W=h.invert(P);h.escape=D(P),h.unescape=D(W),h.result=function(n,e,t){h.isArray(e)||(e=[e]);var r=e.length;if(!r)return h.isFunction(t)?t.call(n):t;for(var i=0;i/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};function Y(n){return"\\"+K[n]}var z=/(.)^/,K={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},G=/\\|'|\r|\n|\u2028|\u2029/g;h.template=function(u,n,e){!n&&e&&(n=e),n=h.defaults({},n,h.templateSettings);var t,r=RegExp([(n.escape||z).source,(n.interpolate||z).source,(n.evaluate||z).source].join("|")+"|$","g"),o=0,c="__p+='";u.replace(r,function(n,e,t,r,i){return c+=u.slice(o,i).replace(G,Y),o=i+n.length,e?c+="'+\n((__t=("+e+"))==null?'':_.escape(__t))+\n'":t?c+="'+\n((__t=("+t+"))==null?'':__t)+\n'":r&&(c+="';\n"+r+"\n__p+='"),n}),c+="';\n",n.variable||(c="with(obj||{}){\n"+c+"}\n"),c="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+c+"return __p;\n";try{t=new Function(n.variable||"obj","_",c)}catch(n){throw n.source=c,n}function i(n){return t.call(this,n,h)}var a=n.variable||"obj";return i.source="function("+a+"){\n"+c+"}",i},h.chain=function(n){var e=h(n);return e._chain=!0,e};function H(n,e){return n._chain?h(e).chain():e}h.mixin=function(t){return h.each(h.functions(t),function(n){var e=h[n]=t[n];h.prototype[n]=function(){var n=[this._wrapped];return i.apply(n,arguments),H(this,e.apply(h,n))}}),h},h.mixin(h),h.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];h.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),"shift"!==e&&"splice"!==e||0!==n.length||delete n[0],H(this,n)}}),h.each(["concat","join","slice"],function(n){var e=r[n];h.prototype[n]=function(){return H(this,e.apply(this._wrapped,arguments))}}),h.prototype.value=function(){return this._wrapped},h.prototype.valueOf=h.prototype.toJSON=h.prototype.value,h.prototype.toString=function(){return String(this._wrapped)},"function"==typeof define&&define.amd&&define("underscore",[],function(){return h})}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],3:[function(n,e,t){"use strict";var i=n("underscore"),u=n("../events");e.exports=function(n){var r=n.getComponent("MenuItem");return n.extend(r,{constructor:function(n,e){var t=e.source;if(!i.isObject(t))throw new Error('was not provided a "source" object, but rather: '+typeof t);e=i.extend({selectable:!0,label:t.label},e),r.call(this,n,e),this.source=t},handleClick:function(n){r.prototype.handleClick.call(this,n),this.player().trigger(u.QUALITY_REQUESTED,this.source)}})}},{"../events":5,underscore:2}],4:[function(n,e,t){"use strict";var i=n("underscore"),u=n("../events"),o=n("./QualityOption"),c="vjs-quality-changing";e.exports=function(n){var e,r=n.getComponent("MenuButton"),t=o(n);return e=n.extend(r,{constructor:function(t,n){r.call(this,t,n),t.on(u.QUALITY_REQUESTED,function(n,e){this.setSelectedSource(e),t.addClass(c),t.one("loadeddata",function(){t.removeClass(c)})}.bind(this)),t.on(u.PLAYER_SOURCES_CHANGED,function(){this.update()}.bind(this)),t.on(u.QUALITY_SELECTED,function(n,e){this.setSelectedSource(e)}.bind(this)),t.one("ready",function(){this.selectedSrc=t.src(),this.update()}.bind(this)),this.controlText("Open quality selector menu")},setSelectedSource:function(n){var e=n?n.src:void 0;this.selectedSrc!==e&&(this.selectedSrc=e,i.each(this.items,function(n){n.selected(n.source.src===e)}))},createItems:function(){var e=this.player(),n=e.currentSources();return n=n.filter(function(n){return null==n.hidequalityoption}),i.map(n,function(n){return new t(e,{source:n,selected:n.src===this.selectedSrc})}.bind(this))},buildWrapperCSSClass:function(){return"vjs-quality-selector "+r.prototype.buildWrapperCSSClass.call(this)}}),n.registerComponent("QualitySelector",e),e}},{"../events":5,"./QualityOption":3,underscore:2}],5:[function(n,e,t){"use strict";e.exports={QUALITY_REQUESTED:"qualityRequested",QUALITY_SELECTED:"qualitySelected",PLAYER_SOURCES_CHANGED:"playerSourcesChanged"}},{}],6:[function(n,e,t){"use strict";var c=n("underscore"),r=n("./events"),i=n("./components/QualitySelector"),u=n("./middleware/SourceInterceptor"),a=n("./util/SafeSeek");e.exports=function(n){n=n||window.videojs,i(n),u(n),n.hook("setup",function(o){o.on(r.QUALITY_REQUESTED,function(n,e){var t=o.currentSources(),r=o.currentTime(),i=o.playbackRate(),u=o.paused();c.each(t,function(n){n.selected=!1}),c.findWhere(t,{src:e.src}).selected=!0,o._qualitySelectorSafeSeek&&o._qualitySelectorSafeSeek.onQualitySelectionChange(),o.src(t),o.ready(function(){o._qualitySelectorSafeSeek&&!o._qualitySelectorSafeSeek.hasFinished()||(o._qualitySelectorSafeSeek=new a(o,r),o.playbackRate(i)),u||o.play()})})})},e.exports.EVENTS=r},{"./components/QualitySelector":4,"./events":5,"./middleware/SourceInterceptor":7,"./util/SafeSeek":9,underscore:2}],7:[function(n,e,t){"use strict";var u=n("underscore"),o=n("../events");e.exports=function(n){n.use("*",function(i){return{setSource:function(n,e){var t,r=i.currentSources();i._qualitySelectorSafeSeek&&i._qualitySelectorSafeSeek.onPlayerSourcesChange(),u.isEqual(r,i._qualitySelectorPreviousSources)||(i.trigger(o.PLAYER_SOURCES_CHANGED,r),i._qualitySelectorPreviousSources=r),t=u.find(r,function(n){return!0===n.selected||"true"===n.selected||"selected"===n.selected})||n,i.trigger(o.QUALITY_SELECTED,t),e(null,t)}}})}},{"../events":5,underscore:2}],8:[function(n,e,t){"use strict";n("./index")()},{"./index":6}],9:[function(n,e,t){"use strict";var r=n("class.extend");e.exports=r.extend({init:function(n,e){this._player=n,this._seekToTime=e,this._hasFinished=!1,this._keepThisInstanceWhenPlayerSourcesChange=!1,this._seekWhenSafe()},_seekWhenSafe:function(){this._player.readyState()<3?(this._seekFn=this._seek.bind(this),this._player.one("canplay",this._seekFn)):this._seek()},onPlayerSourcesChange:function(){this._keepThisInstanceWhenPlayerSourcesChange?this._keepThisInstanceWhenPlayerSourcesChange=!1:this.cancel()},onQualitySelectionChange:function(){this.hasFinished()||(this._keepThisInstanceWhenPlayerSourcesChange=!0)},_seek:function(){this._player.currentTime(this._seekToTime),this._keepThisInstanceWhenPlayerSourcesChange=!1,this._hasFinished=!0},hasFinished:function(){return this._hasFinished},cancel:function(){this._player.off("canplay",this._seekFn),this._keepThisInstanceWhenPlayerSourcesChange=!1,this._hasFinished=!0}})},{"class.extend":1}]},{},[8]); +!function r(o,i,a){function u(e,n){if(!i[e]){if(!o[e]){var t="function"==typeof require&&require;if(!n&&t)return t(e,!0);if(c)return c(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}t=i[e]={exports:{}},o[e][0].call(t.exports,function(n){return u(o[e][1][n]||n)},t,t.exports,r,o,i,a)}return i[e].exports}for(var c="function"==typeof require&&require,n=0;n"+n+""}var i,a=n("../internals/an-object"),u=n("../internals/object-define-properties"),c=n("../internals/enum-bug-keys"),s=n("../internals/hidden-keys"),l=n("../internals/html"),f=n("../internals/document-create-element"),n=n("../internals/shared-key"),p="prototype",y="script",h=n("IE_PROTO"),d=function(){try{i=document.domain&&new ActiveXObject("htmlfile")}catch(n){}var n;d=i?function(n){n.write(o("")),n.close();var e=n.parentWindow.Object;return n=null,e}(i):((n=f("iframe")).style.display="none",l.appendChild(n),n.src=String("javascript:"),(n=n.contentWindow.document).open(),n.write(o("document.F=Object")),n.close(),n.F);for(var e=c.length;e--;)delete d[p][c[e]];return d()};s[h]=!0,e.exports=Object.create||function(n,e){var t;return null!==n?(r[p]=a(n),t=new r,r[p]=null,t[h]=n):t=d(),void 0===e?t:u(t,e)}},{"../internals/an-object":2,"../internals/document-create-element":13,"../internals/enum-bug-keys":17,"../internals/hidden-keys":25,"../internals/html":26,"../internals/object-define-properties":38,"../internals/shared-key":52}],38:[function(n,e,t){var r=n("../internals/descriptors"),a=n("../internals/object-define-property"),u=n("../internals/an-object"),c=n("../internals/object-keys");e.exports=r?Object.defineProperties:function(n,e){u(n);for(var t,r=c(e),o=r.length,i=0;io;)a(r,t=e[o++])&&(~c(i,t)||i.push(t));return i}},{"../internals/array-includes":3,"../internals/has":24,"../internals/hidden-keys":25,"../internals/to-indexed-object":56}],45:[function(n,e,t){var r=n("../internals/object-keys-internal"),o=n("../internals/enum-bug-keys");e.exports=Object.keys||function(n){return r(n,o)}},{"../internals/enum-bug-keys":17,"../internals/object-keys-internal":44}],46:[function(n,e,t){"use strict";var r={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!r.call({1:2},1);t.f=i?function(n){n=o(this,n);return!!n&&n.enumerable}:r},{}],47:[function(n,e,t){var r=n("../internals/get-built-in"),o=n("../internals/object-get-own-property-names"),i=n("../internals/object-get-own-property-symbols"),a=n("../internals/an-object");e.exports=r("Reflect","ownKeys")||function(n){var e=o.f(a(n)),t=i.f;return t?e.concat(t(n)):e}},{"../internals/an-object":2,"../internals/get-built-in":22,"../internals/object-get-own-property-names":41,"../internals/object-get-own-property-symbols":42}],48:[function(n,e,t){n=n("../internals/global");e.exports=n},{"../internals/global":23}],49:[function(n,e,t){var u=n("../internals/global"),c=n("../internals/create-non-enumerable-property"),s=n("../internals/has"),l=n("../internals/set-global"),r=n("../internals/inspect-source"),n=n("../internals/internal-state"),o=n.get,f=n.enforce,p=String(String).split("String");(e.exports=function(n,e,t,r){var o=!!r&&!!r.unsafe,i=!!r&&!!r.enumerable,a=!!r&&!!r.noTargetGet;"function"==typeof t&&("string"!=typeof e||s(t,"name")||c(t,"name",e),(r=f(t)).source||(r.source=p.join("string"==typeof e?e:""))),n!==u?(o?!a&&n[e]&&(i=!0):delete n[e],i?n[e]=t:c(n,e,t)):i?n[e]=t:l(e,t)})(Function.prototype,"toString",function(){return"function"==typeof this&&o(this).source||r(this)})},{"../internals/create-non-enumerable-property":10,"../internals/global":23,"../internals/has":24,"../internals/inspect-source":29,"../internals/internal-state":30,"../internals/set-global":51}],50:[function(n,e,t){e.exports=function(n){if(null==n)throw TypeError("Can't call method on "+n);return n}},{}],51:[function(n,e,t){var r=n("../internals/global"),o=n("../internals/create-non-enumerable-property");e.exports=function(e,t){try{o(r,e,t)}catch(n){r[e]=t}return t}},{"../internals/create-non-enumerable-property":10,"../internals/global":23}],52:[function(n,e,t){var r=n("../internals/shared"),o=n("../internals/uid"),i=r("keys");e.exports=function(n){return i[n]||(i[n]=o(n))}},{"../internals/shared":54,"../internals/uid":61}],53:[function(n,e,t){var r=n("../internals/global"),o=n("../internals/set-global"),n="__core-js_shared__",n=r[n]||o(n,{});e.exports=n},{"../internals/global":23,"../internals/set-global":51}],54:[function(n,e,t){var r=n("../internals/is-pure"),o=n("../internals/shared-store");(e.exports=function(n,e){return o[n]||(o[n]=void 0!==e?e:{})})("versions",[]).push({version:"3.11.0",mode:r?"pure":"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})},{"../internals/is-pure":34,"../internals/shared-store":53}],55:[function(n,e,t){var r=n("../internals/to-integer"),o=Math.max,i=Math.min;e.exports=function(n,e){n=r(n);return n<0?o(n+e,0):i(n,e)}},{"../internals/to-integer":57}],56:[function(n,e,t){var r=n("../internals/indexed-object"),o=n("../internals/require-object-coercible");e.exports=function(n){return r(o(n))}},{"../internals/indexed-object":28,"../internals/require-object-coercible":50}],57:[function(n,e,t){var r=Math.ceil,o=Math.floor;e.exports=function(n){return isNaN(n=+n)?0:(0":">",'"':""","'":"'","`":"`"},Qn=Un(Wn),Yn=Un(mn(Wn)),Vn=en.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},zn=/(.)^/,Gn={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},Hn=/\\|'|\r|\n|\u2028|\u2029/g;function Kn(n){return"\\"+Gn[n]}var $n=/^\s*(\w|\$)+\s*$/;var Jn=0;function Xn(n,e,t,r,o){if(!(r instanceof e))return n.apply(t,o);t=_n(n.prototype),o=n.apply(t,o);return j(o)?o:t}var Zn=m(function(o,i){var a=Zn.placeholder,u=function(){for(var n=0,e=i.length,t=Array(e),r=0;r video.js: version: 8.10.0 shasum: 603a49909ef33f839264da8b73513f9daf592b57 videojs-contrib-quality-levels: - version: 4.0.0 - shasum: faa8096594cdbfc3ccbefe8572fc20531ba23f3d + version: 4.1.0 + shasum: 44c2d2167114a5c8418548b10a25cb409d6cba51 videojs-contrib-quality-menu: - version: 1.0.0 - shasum: f5e8f855358e20854de23d7607634b5aabf4e9ac + version: 1.0.1 + shasum: 991f641afabf1b346088f290efcf689688e42368 videojs-markers: version: 1.0.1