Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@vimeo/player

Package Overview
Dependencies
Maintainers
2
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vimeo/player - npm Package Compare versions

Comparing version 2.19.0 to 2.20.0

src/lib/timing-object.types.ts

4

dist/player.min.js

@@ -1,2 +0,2 @@

/*! @vimeo/player v2.19.0 | (c) 2023 Vimeo | MIT License | https://github.com/vimeo/player.js */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).Vimeo=e.Vimeo||{},e.Vimeo.Player=t())}(this,function(){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var e="undefined"!=typeof global&&"[object global]"==={}.toString.call(global);function i(e,t){return 0===e.indexOf(t.toLowerCase())?e:"".concat(t.toLowerCase()).concat(e.substr(0,1).toUpperCase()).concat(e.substr(1))}function c(e){return/^(https?:)?\/\/((player|www)\.)?vimeo\.com(?=$|\/)/.test(e)}function l(e){return/^https:\/\/player\.vimeo\.com\/video\/\d+/.test(e)}function s(e){var t,n=0<arguments.length&&void 0!==e?e:{},r=n.id,o=n.url,i=r||o;if(!i)throw new Error("An id or url must be passed, either in an options object or as a data-vimeo-id or data-vimeo-url attribute.");if(t=i,!isNaN(parseFloat(t))&&isFinite(t)&&Math.floor(t)==t)return"https://vimeo.com/".concat(i);if(c(i))return i.replace("http:","https:");if(r)throw new TypeError("“".concat(r,"” is not a valid video id."));throw new TypeError("“".concat(i,"” is not a vimeo.com url."))}var t=void 0!==Array.prototype.indexOf,n="undefined"!=typeof window&&void 0!==window.postMessage;if(!(e||t&&n))throw new Error("Sorry, the Vimeo Player API is not available in this browser.");var o,a,u,f,d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function h(){if(void 0===this)throw new TypeError("Constructor WeakMap requires 'new'");if(f(this,"_id","_WeakMap_"+v()+"."+v()),0<arguments.length)throw new TypeError("WeakMap iterable is not supported")}function m(e,t){if(!p(e)||!a.call(e,"_id"))throw new TypeError(t+" method called on incompatible receiver "+typeof e)}function v(){return Math.random().toString().substring(2)}function p(e){return Object(e)===e}(o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:d).WeakMap||(a=Object.prototype.hasOwnProperty,u=Object.defineProperty&&function(){try{return 1===Object.defineProperty({},"x",{value:1}).x}catch(e){}}(),f=function(e,t,n){u?Object.defineProperty(e,t,{configurable:!0,writable:!0,value:n}):e[t]=n},o.WeakMap=(f(h.prototype,"delete",function(e){if(m(this,"delete"),!p(e))return!1;var t=e[this._id];return!(!t||t[0]!==e)&&(delete e[this._id],!0)}),f(h.prototype,"get",function(e){if(m(this,"get"),p(e)){var t=e[this._id];return t&&t[0]===e?t[1]:void 0}}),f(h.prototype,"has",function(e){if(m(this,"has"),!p(e))return!1;var t=e[this._id];return!(!t||t[0]!==e)}),f(h.prototype,"set",function(e,t){if(m(this,"set"),!p(e))throw new TypeError("Invalid value used as weak map key");var n=e[this._id];return n&&n[0]===e?n[1]=t:f(e,this._id,[e,t]),this}),f(h,"_polyfill",!0),h));var y,g=(function(e){var t,n,r;r=function(){var t,n,r,o,i,a,e=Object.prototype.toString,u="undefined"!=typeof setImmediate?function(e){return setImmediate(e)}:setTimeout;try{Object.defineProperty({},"x",{}),t=function(e,t,n,r){return Object.defineProperty(e,t,{value:n,writable:!0,configurable:!1!==r})}}catch(e){t=function(e,t,n){return e[t]=n,e}}function l(e,t){this.fn=e,this.self=t,this.next=void 0}function c(e,t){r.add(e,t),n=n||u(r.drain)}function s(e){var t,n=typeof e;return null==e||"object"!=n&&"function"!=n||(t=e.then),"function"==typeof t&&t}function f(){for(var e=0;e<this.chain.length;e++)!function(e,t,n){var r,o;try{!1===t?n.reject(e.msg):(r=!0===t?e.msg:t.call(void 0,e.msg))===n.promise?n.reject(TypeError("Promise-chain cycle")):(o=s(r))?o.call(r,n.resolve,n.reject):n.resolve(r)}catch(e){n.reject(e)}}(this,1===this.state?this.chain[e].success:this.chain[e].failure,this.chain[e]);this.chain.length=0}function d(e){var n,r=this;if(!r.triggered){r.triggered=!0,r.def&&(r=r.def);try{(n=s(e))?c(function(){var t=new v(r);try{n.call(e,function(){d.apply(t,arguments)},function(){h.apply(t,arguments)})}catch(e){h.call(t,e)}}):(r.msg=e,r.state=1,0<r.chain.length&&c(f,r))}catch(e){h.call(new v(r),e)}}}function h(e){var t=this;t.triggered||(t.triggered=!0,t.def&&(t=t.def),t.msg=e,t.state=2,0<t.chain.length&&c(f,t))}function m(e,n,r,o){for(var t=0;t<n.length;t++)!function(t){e.resolve(n[t]).then(function(e){r(t,e)},o)}(t)}function v(e){this.def=e,this.triggered=!1}function p(e){this.promise=e,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function y(e){if("function"!=typeof e)throw TypeError("Not a function");if(0!==this.__NPO__)throw TypeError("Not a promise");this.__NPO__=1;var r=new p(this);this.then=function(e,t){var n={success:"function"!=typeof e||e,failure:"function"==typeof t&&t};return n.promise=new this.constructor(function(e,t){if("function"!=typeof e||"function"!=typeof t)throw TypeError("Not a function");n.resolve=e,n.reject=t}),r.chain.push(n),0!==r.state&&c(f,r),n.promise},this.catch=function(e){return this.then(void 0,e)};try{e.call(void 0,function(e){d.call(r,e)},function(e){h.call(r,e)})}catch(e){h.call(r,e)}}var g=t({},"constructor",y,!(r={add:function(e,t){a=new l(e,t),i?i.next=a:o=a,i=a,a=void 0},drain:function(){var e=o;for(o=i=n=void 0;e;)e.fn.call(e.self),e=e.next}}));return t(y.prototype=g,"__NPO__",0,!1),t(y,"resolve",function(n){return n&&"object"==typeof n&&1===n.__NPO__?n:new this(function(e,t){if("function"!=typeof e||"function"!=typeof t)throw TypeError("Not a function");e(n)})}),t(y,"reject",function(n){return new this(function(e,t){if("function"!=typeof e||"function"!=typeof t)throw TypeError("Not a function");t(n)})}),t(y,"all",function(t){var a=this;return"[object Array]"!=e.call(t)?a.reject(TypeError("Not an array")):0===t.length?a.resolve([]):new a(function(n,e){if("function"!=typeof n||"function"!=typeof e)throw TypeError("Not a function");var r=t.length,o=Array(r),i=0;m(a,t,function(e,t){o[e]=t,++i===r&&n(o)},e)})}),t(y,"race",function(t){var r=this;return"[object Array]"!=e.call(t)?r.reject(TypeError("Not an array")):new r(function(n,e){if("function"!=typeof n||"function"!=typeof e)throw TypeError("Not a function");m(r,t,function(e,t){n(t)},e)})}),y},(n=d)[t="Promise"]=n[t]||r(),e.exports&&(e.exports=n[t])}(y={exports:{}}),y.exports),w=new WeakMap;function b(e,t,n){var r=w.get(e.element)||{};t in r||(r[t]=[]),r[t].push(n),w.set(e.element,r)}function k(e,t){return(w.get(e.element)||{})[t]||[]}function E(e,t,n){var r=w.get(e.element)||{};if(!r[t])return!0;if(!n)return r[t]=[],w.set(e.element,r),!0;var o=r[t].indexOf(n);return-1!==o&&r[t].splice(o,1),w.set(e.element,r),r[t]&&0===r[t].length}function T(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return console.warn(e),{}}return e}function P(e,t,n){var r,o;e.element.contentWindow&&e.element.contentWindow.postMessage&&(r={method:t},void 0!==n&&(r.value=n),8<=(o=parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/,"$1")))&&o<10&&(r=JSON.stringify(r)),e.element.contentWindow.postMessage(r,e.origin))}function _(n,r){var t,e,o=[];(r=T(r)).event?("error"===r.event&&k(n,r.data.method).forEach(function(e){var t=new Error(r.data.message);t.name=r.data.name,e.reject(t),E(n,r.data.method,e)}),o=k(n,"event:".concat(r.event)),t=r.data):!r.method||(e=function(e,t){var n=k(e,t);if(n.length<1)return!1;var r=n.shift();return E(e,t,r),r}(n,r.method))&&(o.push(e),t=r.value),o.forEach(function(e){try{if("function"==typeof e)return void e.call(n,t);e.resolve(t)}catch(e){}})}var M=["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 N(r,e){var t=1<arguments.length&&void 0!==e?e:{};return M.reduce(function(e,t){var n=r.getAttribute("data-vimeo-".concat(t));return!n&&""!==n||(e[t]=""===n?1:n),e},t)}function F(e,t){var n=e.html;if(!t)throw new TypeError("An element must be provided");if(null!==t.getAttribute("data-vimeo-initialized"))return t.querySelector("iframe");var r=document.createElement("div");return r.innerHTML=n,t.appendChild(r.firstChild),t.setAttribute("data-vimeo-initialized","true"),t.querySelector("iframe")}function x(i,e,t){var a=1<arguments.length&&void 0!==e?e:{},u=2<arguments.length?t:void 0;return new Promise(function(t,n){if(!c(i))throw new TypeError("“".concat(i,"” is not a vimeo.com url."));var e="https://vimeo.com/api/oembed.json?url=".concat(encodeURIComponent(i));for(var r in a)a.hasOwnProperty(r)&&(e+="&".concat(r,"=").concat(encodeURIComponent(a[r])));var o=new("XDomainRequest"in window?XDomainRequest:XMLHttpRequest);o.open("GET",e,!0),o.onload=function(){if(404!==o.status)if(403!==o.status)try{var e=JSON.parse(o.responseText);if(403===e.domain_status_code)return F(e,u),void n(new Error("“".concat(i,"” is not embeddable.")));t(e)}catch(e){n(e)}else n(new Error("“".concat(i,"” is not embeddable.")));else n(new Error("“".concat(i,"” was not found.")))},o.onerror=function(){var e=o.status?" (".concat(o.status,")"):"";n(new Error("There was an error fetching the embed code from Vimeo".concat(e,".")))},o.send()})}var C,j,A,S=new WeakMap,q=new WeakMap,V={},Player=function(){function Player(u){var e,t,l=this,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Player),window.jQuery&&u instanceof jQuery&&(1<u.length&&window.console&&console.warn&&console.warn("A jQuery object with multiple elements was passed, using the first element."),u=u[0]),"undefined"!=typeof document&&"string"==typeof u&&(u=document.getElementById(u)),e=u,!Boolean(e&&1===e.nodeType&&"nodeName"in e&&e.ownerDocument&&e.ownerDocument.defaultView))throw new TypeError("You must pass either a valid element or a valid id.");if("IFRAME"===u.nodeName||(t=u.querySelector("iframe"))&&(u=t),"IFRAME"===u.nodeName&&!c(u.getAttribute("src")||""))throw new Error("The player element passed isn’t a Vimeo embed.");if(S.has(u))return S.get(u);this._window=u.ownerDocument.defaultView,this.element=u,this.origin="*";var r,o=new g(function(i,a){var e;l._onMessage=function(e){if(c(e.origin)&&l.element.contentWindow===e.source){"*"===l.origin&&(l.origin=e.origin);var t=T(e.data);if(t&&"error"===t.event&&t.data&&"ready"===t.data.method){var n=new Error(t.data.message);return n.name=t.data.name,void a(n)}var r=t&&"ready"===t.event,o=t&&"ping"===t.method;if(r||o)return l.element.setAttribute("data-ready","true"),void i();_(l,t)}},l._window.addEventListener("message",l._onMessage),"IFRAME"!==l.element.nodeName&&x(s(e=N(u,n)),e,u).then(function(e){var t,n,r,o=F(e,u);return l.element=o,l._originalElement=u,t=u,n=o,r=w.get(t),w.set(n,r),w.delete(t),S.set(l.element,l),e}).catch(a)});return q.set(this,o),S.set(this.element,this),"IFRAME"===this.element.nodeName&&P(this,"ping"),V.isEnabled&&(r=function(){return V.exit()},this.fullscreenchangeHandler=function(){(V.isFullscreen?b:E)(l,"event:exitFullscreen",r),l.ready().then(function(){P(l,"fullscreenchange",V.isFullscreen)})},V.on("fullscreenchange",this.fullscreenchangeHandler)),this}var e,t,n;return e=Player,(t=[{key:"callMethod",value:function(n,e){var r=this,o=1<arguments.length&&void 0!==e?e:{};return new g(function(e,t){return r.ready().then(function(){b(r,n,{resolve:e,reject:t}),P(r,n,o)}).catch(t)})}},{key:"get",value:function(n){var r=this;return new g(function(e,t){return n=i(n,"get"),r.ready().then(function(){b(r,n,{resolve:e,reject:t}),P(r,n)}).catch(t)})}},{key:"set",value:function(n,r){var o=this;return new g(function(e,t){if(n=i(n,"set"),null==r)throw new TypeError("There must be a value to set.");return o.ready().then(function(){b(o,n,{resolve:e,reject:t}),P(o,n,r)}).catch(t)})}},{key:"on",value:function(e,t){if(!e)throw new TypeError("You must pass an event name.");if(!t)throw new TypeError("You must pass a callback function.");if("function"!=typeof t)throw new TypeError("The callback must be a function.");0===k(this,"event:".concat(e)).length&&this.callMethod("addEventListener",e).catch(function(){}),b(this,"event:".concat(e),t)}},{key:"off",value:function(e,t){if(!e)throw new TypeError("You must pass an event name.");if(t&&"function"!=typeof t)throw new TypeError("The callback must be a function.");E(this,"event:".concat(e),t)&&this.callMethod("removeEventListener",e).catch(function(e){})}},{key:"loadVideo",value:function(e){return this.callMethod("loadVideo",e)}},{key:"ready",value:function(){var e=q.get(this)||new g(function(e,t){t(new Error("Unknown player. Probably unloaded."))});return g.resolve(e)}},{key:"addCuePoint",value:function(e,t){var n=1<arguments.length&&void 0!==t?t:{};return this.callMethod("addCuePoint",{time:e,data:n})}},{key:"removeCuePoint",value:function(e){return this.callMethod("removeCuePoint",e)}},{key:"enableTextTrack",value:function(e,t){if(!e)throw new TypeError("You must pass a language.");return this.callMethod("enableTextTrack",{language:e,kind:t})}},{key:"disableTextTrack",value:function(){return this.callMethod("disableTextTrack")}},{key:"pause",value:function(){return this.callMethod("pause")}},{key:"play",value:function(){return this.callMethod("play")}},{key:"requestFullscreen",value:function(){return V.isEnabled?V.request(this.element):this.callMethod("requestFullscreen")}},{key:"exitFullscreen",value:function(){return V.isEnabled?V.exit():this.callMethod("exitFullscreen")}},{key:"getFullscreen",value:function(){return V.isEnabled?g.resolve(V.isFullscreen):this.get("fullscreen")}},{key:"requestPictureInPicture",value:function(){return this.callMethod("requestPictureInPicture")}},{key:"exitPictureInPicture",value:function(){return this.callMethod("exitPictureInPicture")}},{key:"getPictureInPicture",value:function(){return this.get("pictureInPicture")}},{key:"remotePlaybackPrompt",value:function(){return this.callMethod("remotePlaybackPrompt")}},{key:"unload",value:function(){return this.callMethod("unload")}},{key:"destroy",value:function(){var n=this;return new g(function(e){var t;q.delete(n),S.delete(n.element),n._originalElement&&(S.delete(n._originalElement),n._originalElement.removeAttribute("data-vimeo-initialized")),n.element&&"IFRAME"===n.element.nodeName&&n.element.parentNode&&(n.element.parentNode.parentNode&&n._originalElement&&n._originalElement!==n.element.parentNode?n.element.parentNode.parentNode.removeChild(n.element.parentNode):n.element.parentNode.removeChild(n.element)),n.element&&"DIV"===n.element.nodeName&&n.element.parentNode&&(n.element.removeAttribute("data-vimeo-initialized"),(t=n.element.querySelector("iframe"))&&t.parentNode&&(t.parentNode.parentNode&&n._originalElement&&n._originalElement!==t.parentNode?t.parentNode.parentNode.removeChild(t.parentNode):t.parentNode.removeChild(t))),n._window.removeEventListener("message",n._onMessage),V.isEnabled&&V.off("fullscreenchange",n.fullscreenchangeHandler),e()})}},{key:"getAutopause",value:function(){return this.get("autopause")}},{key:"setAutopause",value:function(e){return this.set("autopause",e)}},{key:"getBuffered",value:function(){return this.get("buffered")}},{key:"getCameraProps",value:function(){return this.get("cameraProps")}},{key:"setCameraProps",value:function(e){return this.set("cameraProps",e)}},{key:"getChapters",value:function(){return this.get("chapters")}},{key:"getCurrentChapter",value:function(){return this.get("currentChapter")}},{key:"getColor",value:function(){return this.get("color")}},{key:"setColor",value:function(e){return this.set("color",e)}},{key:"getCuePoints",value:function(){return this.get("cuePoints")}},{key:"getCurrentTime",value:function(){return this.get("currentTime")}},{key:"setCurrentTime",value:function(e){return this.set("currentTime",e)}},{key:"getDuration",value:function(){return this.get("duration")}},{key:"getEnded",value:function(){return this.get("ended")}},{key:"getLoop",value:function(){return this.get("loop")}},{key:"setLoop",value:function(e){return this.set("loop",e)}},{key:"setMuted",value:function(e){return this.set("muted",e)}},{key:"getMuted",value:function(){return this.get("muted")}},{key:"getPaused",value:function(){return this.get("paused")}},{key:"getPlaybackRate",value:function(){return this.get("playbackRate")}},{key:"setPlaybackRate",value:function(e){return this.set("playbackRate",e)}},{key:"getPlayed",value:function(){return this.get("played")}},{key:"getQualities",value:function(){return this.get("qualities")}},{key:"getQuality",value:function(){return this.get("quality")}},{key:"setQuality",value:function(e){return this.set("quality",e)}},{key:"getRemotePlaybackAvailability",value:function(){return this.get("remotePlaybackAvailability")}},{key:"getRemotePlaybackState",value:function(){return this.get("remotePlaybackState")}},{key:"getSeekable",value:function(){return this.get("seekable")}},{key:"getSeeking",value:function(){return this.get("seeking")}},{key:"getTextTracks",value:function(){return this.get("textTracks")}},{key:"getVideoEmbedCode",value:function(){return this.get("videoEmbedCode")}},{key:"getVideoId",value:function(){return this.get("videoId")}},{key:"getVideoTitle",value:function(){return this.get("videoTitle")}},{key:"getVideoWidth",value:function(){return this.get("videoWidth")}},{key:"getVideoHeight",value:function(){return this.get("videoHeight")}},{key:"getVideoUrl",value:function(){return this.get("videoUrl")}},{key:"getVolume",value:function(){return this.get("volume")}},{key:"setVolume",value:function(e){return this.set("volume",e)}}])&&r(e.prototype,t),n&&r(e,n),Player}();return e||(C=function(){for(var e,t=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],n=0,r=t.length,o={};n<r;n++)if((e=t[n])&&e[1]in document){for(n=0;n<e.length;n++)o[t[0][n]]=e[n];return o}return!1}(),j={fullscreenchange:C.fullscreenchange,fullscreenerror:C.fullscreenerror},A={request:function(o){return new Promise(function(e,t){function n(){A.off("fullscreenchange",n),e()}A.on("fullscreenchange",n);var r=(o=o||document.documentElement)[C.requestFullscreen]();r instanceof Promise&&r.then(n).catch(t)})},exit:function(){return new Promise(function(t,e){var n,r;A.isFullscreen?(n=function e(){A.off("fullscreenchange",e),t()},A.on("fullscreenchange",n),(r=document[C.exitFullscreen]())instanceof Promise&&r.then(n).catch(e)):t()})},on:function(e,t){var n=j[e];n&&document.addEventListener(n,t)},off:function(e,t){var n=j[e];n&&document.removeEventListener(n,t)}},Object.defineProperties(A,{isFullscreen:{get:function(){return Boolean(document[C.fullscreenElement])}},element:{enumerable:!0,get:function(){return document[C.fullscreenElement]}},isEnabled:{enumerable:!0,get:function(){return Boolean(document[C.fullscreenEnabled])}}}),V=A,function(e){function n(e){"console"in window&&console.error&&console.error("There was an error creating an embed: ".concat(e))}var t=0<arguments.length&&void 0!==e?e:document;[].slice.call(t.querySelectorAll("[data-vimeo-id], [data-vimeo-url]")).forEach(function(t){try{if(null!==t.getAttribute("data-vimeo-defer"))return;var e=N(t);x(s(e),e,t).then(function(e){return F(e,t)}).catch(n)}catch(e){n(e)}})}(),function(e){var r=0<arguments.length&&void 0!==e?e:document;window.VimeoPlayerResizeEmbeds_||(window.VimeoPlayerResizeEmbeds_=!0,window.addEventListener("message",function(e){if(c(e.origin)&&e.data&&"spacechange"===e.data.event)for(var t=r.querySelectorAll("iframe"),n=0;n<t.length;n++)if(t[n].contentWindow===e.source){t[n].parentElement.style.paddingBottom="".concat(e.data.data[0].bottom,"px");break}}))}(),function(e){var a=0<arguments.length&&void 0!==e?e:document;window.VimeoSeoMetadataAppended||(window.VimeoSeoMetadataAppended=!0,window.addEventListener("message",function(e){if(c(e.origin)){var t=T(e.data);if(t&&"ready"===t.event)for(var n=a.querySelectorAll("iframe"),r=0;r<n.length;r++){var o=n[r],i=o.contentWindow===e.source;l(o.src)&&i&&new Player(o).callMethod("appendVideoMetadata",window.location.href)}}}))}(),function(e){var a,u=0<arguments.length&&void 0!==e?e:document;window.VimeoCheckedUrlTimeParam||(window.VimeoCheckedUrlTimeParam=!0,a=function(e){"console"in window&&console.error&&console.error("There was an error getting video Id: ".concat(e))},window.addEventListener("message",function(e){if(c(e.origin)){var t=T(e.data);if(t&&"ready"===t.event)for(var n=u.querySelectorAll("iframe"),r=0;r<n.length;r++){var o=n[r],i=o.contentWindow===e.source;l(o.src)&&i&&function(){var r=new Player(o);r.getVideoId().then(function(e){var t,n=new RegExp("[?&]vimeo_t_".concat(e,"=([^&#]*)")).exec(window.location.href);n&&n[1]&&(t=decodeURI(n[1]),r.setCurrentTime(t))}).catch(a)}()}}}))}()),Player});
/*! @vimeo/player v2.20.0 | (c) 2023 Vimeo | MIT License | https://github.com/vimeo/player.js */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).Vimeo=e.Vimeo||{},e.Vimeo.Player=t())}(this,function(){"use strict";var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(e,t){return e(t={exports:{}},t.exports),t.exports}var d=e(function(e){var t=function(a){var f,e=Object.prototype,s=e.hasOwnProperty,t="function"==typeof Symbol?Symbol:{},o=t.iterator||"@@iterator",n=t.asyncIterator||"@@asyncIterator",r=t.toStringTag||"@@toStringTag";function i(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{i({},"")}catch(e){i=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var i,a,u,c,o=t&&t.prototype instanceof g?t:g,l=Object.create(o.prototype),s=new O(r||[]);return l._invoke=(i=e,a=n,u=s,c=d,function(e,t){if(c===y)throw new Error("Generator is already running");if(c===v){if("throw"===e)throw t;return S()}for(u.method=e,u.arg=t;;){var n=u.delegate;if(n){var r=function e(t,n){var r=t.iterator[n.method];if(r===f){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=f,e(t,n),"throw"===n.method))return m;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var o=h(r,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var i=o.arg;if(!i)return n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m;{if(!i.done)return i;n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=f)}n.delegate=null;return m}(n,u);if(r){if(r===m)continue;return r}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if(c===d)throw c=v,u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);c=y;var o=h(i,a,u);if("normal"===o.type){if(c=u.done?v:p,o.arg===m)continue;return{value:o.arg,done:u.done}}"throw"===o.type&&(c=v,u.method="throw",u.arg=o.arg)}}),l}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}a.wrap=u;var d="suspendedStart",p="suspendedYield",y="executing",v="completed",m={};function g(){}function c(){}function l(){}var w={};w[o]=function(){return this};var b=Object.getPrototypeOf,k=b&&b(b(_([])));k&&k!==e&&s.call(k,o)&&(w=k);var x=l.prototype=g.prototype=Object.create(w);function E(e){["next","throw","return"].forEach(function(t){i(e,t,function(e){return this._invoke(t,e)})})}function P(c,l){var t;this._invoke=function(n,r){function e(){return new l(function(e,t){!function t(e,n,r,o){var i=h(c[e],c,n);if("throw"!==i.type){var a=i.arg,u=a.value;return u&&"object"==typeof u&&s.call(u,"__await")?l.resolve(u.__await).then(function(e){t("next",e,r,o)},function(e){t("throw",e,r,o)}):l.resolve(u).then(function(e){a.value=e,r(a)},function(e){return t("throw",e,r,o)})}o(i.arg)}(n,r,e,t)})}return t=t?t.then(e,e):e()}}function T(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function j(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function _(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n<t.length;)if(s.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=f,e.done=!0,e};return r.next=r}}return{next:S}}function S(){return{value:f,done:!0}}return((c.prototype=x.constructor=l).constructor=c).displayName=i(l,r,"GeneratorFunction"),a.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===c||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,i(e,r,"GeneratorFunction")),e.prototype=Object.create(x),e},a.awrap=function(e){return{__await:e}},E(P.prototype),P.prototype[n]=function(){return this},a.AsyncIterator=P,a.async=function(e,t,n,r,o){void 0===o&&(o=Promise);var i=new P(u(e,t,n,r),o);return a.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},E(x),i(x,r,"Generator"),x[o]=function(){return this},x.toString=function(){return"[object Generator]"},a.keys=function(n){var r=[];for(var e in n)r.push(e);return r.reverse(),function e(){for(;r.length;){var t=r.pop();if(t in n)return e.value=t,e.done=!1,e}return e.done=!0,e}},a.values=_,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=f,this.done=!1,this.delegate=null,this.method="next",this.arg=f,this.tryEntries.forEach(j),!e)for(var t in this)"t"===t.charAt(0)&&s.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=f)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function e(e,t){return i.type="throw",i.arg=n,r.next=e,t&&(r.method="next",r.arg=f),!!t}for(var t=this.tryEntries.length-1;0<=t;--t){var o=this.tryEntries[t],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var a=s.call(o,"catchLoc"),u=s.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&s.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),j(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r,o=n.completion;return"throw"===o.type&&(r=o.arg,j(n)),r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:_(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=f),m}},a}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}});function c(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}var p=function(u){return function(){var e=this,a=arguments;return new Promise(function(t,n){var r=u.apply(e,a);function o(e){c(r,t,n,o,i,"next",e)}function i(e){c(r,t,n,o,i,"throw",e)}o(void 0)})}};var l=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var t=function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e},n="undefined"!=typeof global&&"[object global]"==={}.toString.call(global);function i(e,t){return 0===e.indexOf(t.toLowerCase())?e:"".concat(t.toLowerCase()).concat(e.substr(0,1).toUpperCase()).concat(e.substr(1))}function s(e){return/^(https?:)?\/\/((player|www)\.)?vimeo\.com(?=$|\/)/.test(e)}function f(e){return/^https:\/\/player\.vimeo\.com\/video\/\d+/.test(e)}function h(e){var t,n=0<arguments.length&&void 0!==e?e:{},r=n.id,o=n.url,i=r||o;if(!i)throw new Error("An id or url must be passed, either in an options object or as a data-vimeo-id or data-vimeo-url attribute.");if(t=i,!isNaN(parseFloat(t))&&isFinite(t)&&Math.floor(t)==t)return"https://vimeo.com/".concat(i);if(s(i))return i.replace("http:","https:");if(r)throw new TypeError("“".concat(r,"” is not a valid video id."));throw new TypeError("“".concat(i,"” is not a vimeo.com url."))}function y(t,e,n,r,o){var i=3<arguments.length&&void 0!==r?r:"addEventListener",a=4<arguments.length&&void 0!==o?o:"removeEventListener",u="string"==typeof e?[e]:e;return u.forEach(function(e){t[i](e,n)}),{cancel:function(){return u.forEach(function(e){return t[a](e,n)})}}}var a,u,v,m,g=void 0!==Array.prototype.indexOf,w="undefined"!=typeof window&&void 0!==window.postMessage;if(!(n||g&&w))throw new Error("Sorry, the Vimeo Player API is not available in this browser.");function b(){if(void 0===this)throw new TypeError("Constructor WeakMap requires 'new'");if(m(this,"_id","_WeakMap_"+x()+"."+x()),0<arguments.length)throw new TypeError("WeakMap iterable is not supported")}function k(e,t){if(!E(e)||!u.call(e,"_id"))throw new TypeError(t+" method called on incompatible receiver "+typeof e)}function x(){return Math.random().toString().substring(2)}function E(e){return Object(e)===e}(a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:o).WeakMap||(u=Object.prototype.hasOwnProperty,v=Object.defineProperty&&function(){try{return 1===Object.defineProperty({},"x",{value:1}).x}catch(e){}}(),m=function(e,t,n){v?Object.defineProperty(e,t,{configurable:!0,writable:!0,value:n}):e[t]=n},a.WeakMap=(m(b.prototype,"delete",function(e){if(k(this,"delete"),!E(e))return!1;var t=e[this._id];return!(!t||t[0]!==e)&&(delete e[this._id],!0)}),m(b.prototype,"get",function(e){if(k(this,"get"),E(e)){var t=e[this._id];return t&&t[0]===e?t[1]:void 0}}),m(b.prototype,"has",function(e){if(k(this,"has"),!E(e))return!1;var t=e[this._id];return!(!t||t[0]!==e)}),m(b.prototype,"set",function(e,t){if(k(this,"set"),!E(e))throw new TypeError("Invalid value used as weak map key");var n=e[this._id];return n&&n[0]===e?n[1]=t:m(e,this._id,[e,t]),this}),m(b,"_polyfill",!0),b));var P=e(function(e){var t,n,r;r=function(){var t,n,r,o,i,a,e=Object.prototype.toString,u="undefined"!=typeof setImmediate?function(e){return setImmediate(e)}:setTimeout;try{Object.defineProperty({},"x",{}),t=function(e,t,n,r){return Object.defineProperty(e,t,{value:n,writable:!0,configurable:!1!==r})}}catch(e){t=function(e,t,n){return e[t]=n,e}}function c(e,t){this.fn=e,this.self=t,this.next=void 0}function l(e,t){r.add(e,t),n=n||u(r.drain)}function s(e){var t,n=typeof e;return null==e||"object"!=n&&"function"!=n||(t=e.then),"function"==typeof t&&t}function f(){for(var e=0;e<this.chain.length;e++)!function(e,t,n){var r,o;try{!1===t?n.reject(e.msg):(r=!0===t?e.msg:t.call(void 0,e.msg))===n.promise?n.reject(TypeError("Promise-chain cycle")):(o=s(r))?o.call(r,n.resolve,n.reject):n.resolve(r)}catch(e){n.reject(e)}}(this,1===this.state?this.chain[e].success:this.chain[e].failure,this.chain[e]);this.chain.length=0}function h(e){var n,r=this;if(!r.triggered){r.triggered=!0,r.def&&(r=r.def);try{(n=s(e))?l(function(){var t=new y(r);try{n.call(e,function(){h.apply(t,arguments)},function(){d.apply(t,arguments)})}catch(e){d.call(t,e)}}):(r.msg=e,r.state=1,0<r.chain.length&&l(f,r))}catch(e){d.call(new y(r),e)}}}function d(e){var t=this;t.triggered||(t.triggered=!0,t.def&&(t=t.def),t.msg=e,t.state=2,0<t.chain.length&&l(f,t))}function p(e,n,r,o){for(var t=0;t<n.length;t++)!function(t){e.resolve(n[t]).then(function(e){r(t,e)},o)}(t)}function y(e){this.def=e,this.triggered=!1}function v(e){this.promise=e,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function m(e){if("function"!=typeof e)throw TypeError("Not a function");if(0!==this.__NPO__)throw TypeError("Not a promise");this.__NPO__=1;var r=new v(this);this.then=function(e,t){var n={success:"function"!=typeof e||e,failure:"function"==typeof t&&t};return n.promise=new this.constructor(function(e,t){if("function"!=typeof e||"function"!=typeof t)throw TypeError("Not a function");n.resolve=e,n.reject=t}),r.chain.push(n),0!==r.state&&l(f,r),n.promise},this.catch=function(e){return this.then(void 0,e)};try{e.call(void 0,function(e){h.call(r,e)},function(e){d.call(r,e)})}catch(e){d.call(r,e)}}var g=t({},"constructor",m,!(r={add:function(e,t){a=new c(e,t),i?i.next=a:o=a,i=a,a=void 0},drain:function(){var e=o;for(o=i=n=void 0;e;)e.fn.call(e.self),e=e.next}}));return t(m.prototype=g,"__NPO__",0,!1),t(m,"resolve",function(n){return n&&"object"==typeof n&&1===n.__NPO__?n:new this(function(e,t){if("function"!=typeof e||"function"!=typeof t)throw TypeError("Not a function");e(n)})}),t(m,"reject",function(n){return new this(function(e,t){if("function"!=typeof e||"function"!=typeof t)throw TypeError("Not a function");t(n)})}),t(m,"all",function(t){var a=this;return"[object Array]"!=e.call(t)?a.reject(TypeError("Not an array")):0===t.length?a.resolve([]):new a(function(n,e){if("function"!=typeof n||"function"!=typeof e)throw TypeError("Not a function");var r=t.length,o=Array(r),i=0;p(a,t,function(e,t){o[e]=t,++i===r&&n(o)},e)})}),t(m,"race",function(t){var r=this;return"[object Array]"!=e.call(t)?r.reject(TypeError("Not an array")):new r(function(n,e){if("function"!=typeof n||"function"!=typeof e)throw TypeError("Not a function");p(r,t,function(e,t){n(t)},e)})}),m},(n=o)[t="Promise"]=n[t]||r(),e.exports&&(e.exports=n[t])}),T=new WeakMap;function j(e,t,n){var r=T.get(e.element)||{};t in r||(r[t]=[]),r[t].push(n),T.set(e.element,r)}function O(e,t){return(T.get(e.element)||{})[t]||[]}function _(e,t,n){var r=T.get(e.element)||{};if(!r[t])return!0;if(!n)return r[t]=[],T.set(e.element,r),!0;var o=r[t].indexOf(n);return-1!==o&&r[t].splice(o,1),T.set(e.element,r),r[t]&&0===r[t].length}function S(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return console.warn(e),{}}return e}function M(e,t,n){var r,o;e.element.contentWindow&&e.element.contentWindow.postMessage&&(r={method:t},void 0!==n&&(r.value=n),8<=(o=parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/,"$1")))&&o<10&&(r=JSON.stringify(r)),e.element.contentWindow.postMessage(r,e.origin))}function C(n,r){var t,e,o=[];(r=S(r)).event?("error"===r.event&&O(n,r.data.method).forEach(function(e){var t=new Error(r.data.message);t.name=r.data.name,e.reject(t),_(n,r.data.method,e)}),o=O(n,"event:".concat(r.event)),t=r.data):!r.method||(e=function(e,t){var n=O(e,t);if(n.length<1)return!1;var r=n.shift();return _(e,t,r),r}(n,r.method))&&(o.push(e),t=r.value),o.forEach(function(e){try{if("function"==typeof e)return void e.call(n,t);e.resolve(t)}catch(e){}})}var F=["autopause","autoplay","background","byline","color","colors","controls","dnt","height","id","interactive_params","keyboard","loop","maxheight","maxwidth","muted","playsinline","portrait","responsive","speed","texttrack","title","transparent","url","width"];function N(r,e){var t=1<arguments.length&&void 0!==e?e:{};return F.reduce(function(e,t){var n=r.getAttribute("data-vimeo-".concat(t));return!n&&""!==n||(e[t]=""===n?1:n),e},t)}function L(e,t){var n=e.html;if(!t)throw new TypeError("An element must be provided");if(null!==t.getAttribute("data-vimeo-initialized"))return t.querySelector("iframe");var r=document.createElement("div");return r.innerHTML=n,t.appendChild(r.firstChild),t.setAttribute("data-vimeo-initialized","true"),t.querySelector("iframe")}function R(i,e,t){var a=1<arguments.length&&void 0!==e?e:{},u=2<arguments.length?t:void 0;return new Promise(function(t,n){if(!s(i))throw new TypeError("“".concat(i,"” is not a vimeo.com url."));var e="https://vimeo.com/api/oembed.json?url=".concat(encodeURIComponent(i));for(var r in a)a.hasOwnProperty(r)&&(e+="&".concat(r,"=").concat(encodeURIComponent(a[r])));var o=new("XDomainRequest"in window?XDomainRequest:XMLHttpRequest);o.open("GET",e,!0),o.onload=function(){if(404!==o.status)if(403!==o.status)try{var e=JSON.parse(o.responseText);if(403===e.domain_status_code)return L(e,u),void n(new Error("“".concat(i,"” is not embeddable.")));t(e)}catch(e){n(e)}else n(new Error("“".concat(i,"” is not embeddable.")));else n(new Error("“".concat(i,"” was not found.")))},o.onerror=function(){var e=o.status?" (".concat(o.status,")"):"";n(new Error("There was an error fetching the embed code from Vimeo".concat(e,".")))},o.send()})}var A=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},q=e(function(n){function r(e,t){return n.exports=r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(e,t)}n.exports=r});var I=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&q(e,t)},V=e(function(t){function n(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=n=function(e){return typeof e}:t.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}t.exports=n});var D=function(e,t){return!t||"object"!==V(t)&&"function"!=typeof t?A(e):t},W=e(function(t){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}t.exports=n});var z=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")};var U=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}},G=e(function(r){function o(e,t,n){return U()?r.exports=o=Reflect.construct:r.exports=o=function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&q(o,n.prototype),o},o.apply(null,arguments)}r.exports=o}),H=e(function(t){function r(e){var n="function"==typeof Map?new Map:void 0;return t.exports=r=function(e){if(null===e||!z(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return G(e,arguments,W(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),q(t,e)},r(e)}t.exports=r});var Y=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e};function B(t,e){var n,r=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)),r}function Q(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?B(Object(n),!0).forEach(function(e){Y(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):B(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function J(r){var o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var e,t,n=W(r);return t=o?(e=W(this).constructor,Reflect.construct(n,arguments,e)):n.apply(this,arguments),D(this,t)}}var X,$,K,Z={role:"viewer",autoPlayMuted:!0,allowedDrift:.3,maxAllowedDrift:1,minCheckInterval:.1,maxRateAdjustment:.2,maxTimeToCatchUp:1},ee=function(e){I(a,e);var r,n,o,i=J(a);function a(e,t){var o,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=3<arguments.length?arguments[3]:void 0;return l(this,a),o=i.call(this),Y(A(o),"logger",void 0),Y(A(o),"speedAdjustment",0),Y(A(o),"adjustSpeed",function(){var n=p(d.mark(function e(t,n){var r;return d.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o.speedAdjustment===n)return e.abrupt("return");e.next=2;break;case 2:return e.next=4,t.getPlaybackRate();case 4:return e.t0=e.sent,e.t1=o.speedAdjustment,e.t2=e.t0-e.t1,e.t3=n,r=e.t2+e.t3,o.log("New playbackRate: ".concat(r)),e.next=12,t.setPlaybackRate(r);case 12:o.speedAdjustment=n;case 13:case"end":return e.stop()}},e)}));return function(e,t){return n.apply(this,arguments)}}()),o.logger=r,o.init(t,e,Q(Q({},Z),n)),o}return t(a,[{key:"disconnect",value:function(){this.dispatchEvent(new Event("disconnect"))}},{key:"init",value:(o=p(d.mark(function e(t,n,r){var o,i,a,u=this;return d.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.waitForTOReadyState(t,"open");case 2:if("viewer"===r.role)return e.next=5,this.updatePlayer(t,n,r);e.next=10;break;case 5:o=y(t,"change",function(){return u.updatePlayer(t,n,r)}),i=this.maintainPlaybackPosition(t,n,r),this.addEventListener("disconnect",function(){i.cancel(),o.cancel()}),e.next=14;break;case 10:return e.next=12,this.updateTimingObject(t,n);case 12:a=y(n,["seeked","play","pause","ratechange"],function(){return u.updateTimingObject(t,n)},"on","off"),this.addEventListener("disconnect",function(){return a.cancel()});case 14:case"end":return e.stop()}},e,this)})),function(e,t,n){return o.apply(this,arguments)})},{key:"updateTimingObject",value:(n=p(d.mark(function e(t,n){return d.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=t,e.next=3,n.getCurrentTime();case 3:return e.t1=e.sent,e.next=6,n.getPaused();case 6:if(!e.sent){e.next=10;break}e.t2=0,e.next=13;break;case 10:return e.next=12,n.getPlaybackRate();case 12:e.t2=e.sent;case 13:e.t3=e.t2,e.t4={position:e.t1,velocity:e.t3},e.t0.update.call(e.t0,e.t4);case 16:case"end":return e.stop()}},e)})),function(e,t){return n.apply(this,arguments)})},{key:"updatePlayer",value:(r=p(d.mark(function e(t,n,r){var o,i,a;return d.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o=t.query(),i=o.position,a=o.velocity,"number"==typeof i&&n.setCurrentTime(i),"number"!=typeof a){e.next=25;break}if(0===a)return e.next=6,n.getPaused();e.next=11;break;case 6:if(e.t0=e.sent,!1!==e.t0){e.next=9;break}n.pause();case 9:e.next=25;break;case 11:if(0<a)return e.next=14,n.getPaused();e.next=25;break;case 14:if(e.t1=e.sent,!0===e.t1)return e.next=18,n.play().catch(function(){var t=p(d.mark(function e(t){return d.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("NotAllowedError"===t.name&&r.autoPlayMuted)return e.next=3,n.setMuted(!0);e.next=5;break;case 3:return e.next=5,n.play().catch(function(e){return console.error("Couldn't play the video from TimingSrcConnector. Error:",e)});case 5:case"end":return e.stop()}},e)}));return function(e){return t.apply(this,arguments)}}());e.next=19;break;case 18:this.updatePlayer(t,n,r);case 19:return e.next=21,n.getPlaybackRate();case 21:if(e.t2=e.sent,e.t3=a,e.t2===e.t3){e.next=25;break}n.setPlaybackRate(a);case 25:case"end":return e.stop()}},e,this)})),function(e,t,n){return r.apply(this,arguments)})},{key:"maintainPlaybackPosition",value:function(a,u,e){var c=this,l=e.allowedDrift,s=e.maxAllowedDrift,t=e.minCheckInterval,f=e.maxRateAdjustment,h=e.maxTimeToCatchUp,n=1e3*Math.min(h,Math.max(t,s)),r=function(){var e=p(d.mark(function e(){var t,n,r,o,i;return d.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=0===a.query().velocity,e.t0){e.next=6;break}return e.next=4,u.getPaused();case 4:e.t1=e.sent,e.t0=!0===e.t1;case 6:if(e.t0)return e.abrupt("return");e.next=8;break;case 8:return e.t2=a.query().position,e.next=11,u.getCurrentTime();case 11:if(e.t3=e.sent,t=e.t2-e.t3,n=Math.abs(t),c.log("Drift: ".concat(t)),s<n)return e.next=18,c.adjustSpeed(u,0);e.next=22;break;case 18:u.setCurrentTime(a.query().position),c.log("Resync by currentTime"),e.next=29;break;case 22:if(l<n)return i=(r=n/h)<(o=f)?(o-r)/2:o,e.next=28,c.adjustSpeed(u,i*Math.sign(t));e.next=29;break;case 28:c.log("Resync by playbackRate");case 29:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),o=setInterval(function(){return r()},n);return{cancel:function(){return clearInterval(o)}}}},{key:"log",value:function(e){var t;null!==(t=this.logger)&&void 0!==t&&t.call(this,"TimingSrcConnector: ".concat(e))}},{key:"waitForTOReadyState",value:function(n,r){return new Promise(function(t){!function e(){n.readyState===r?t():n.addEventListener("readystatechange",e,{once:!0})}()})}}]),a}(H(EventTarget)),te=new WeakMap,ne=new WeakMap,re={},Player=function(){function Player(u){var e,t,c=this,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(l(this,Player),window.jQuery&&u instanceof jQuery&&(1<u.length&&window.console&&console.warn&&console.warn("A jQuery object with multiple elements was passed, using the first element."),u=u[0]),"undefined"!=typeof document&&"string"==typeof u&&(u=document.getElementById(u)),e=u,!Boolean(e&&1===e.nodeType&&"nodeName"in e&&e.ownerDocument&&e.ownerDocument.defaultView))throw new TypeError("You must pass either a valid element or a valid id.");if("IFRAME"===u.nodeName||(t=u.querySelector("iframe"))&&(u=t),"IFRAME"===u.nodeName&&!s(u.getAttribute("src")||""))throw new Error("The player element passed isn’t a Vimeo embed.");if(te.has(u))return te.get(u);this._window=u.ownerDocument.defaultView,this.element=u,this.origin="*";var r,o=new P(function(i,a){var e;c._onMessage=function(e){if(s(e.origin)&&c.element.contentWindow===e.source){"*"===c.origin&&(c.origin=e.origin);var t=S(e.data);if(t&&"error"===t.event&&t.data&&"ready"===t.data.method){var n=new Error(t.data.message);return n.name=t.data.name,void a(n)}var r=t&&"ready"===t.event,o=t&&"ping"===t.method;if(r||o)return c.element.setAttribute("data-ready","true"),void i();C(c,t)}},c._window.addEventListener("message",c._onMessage),"IFRAME"!==c.element.nodeName&&R(h(e=N(u,n)),e,u).then(function(e){var t,n,r,o=L(e,u);return c.element=o,c._originalElement=u,t=u,n=o,r=T.get(t),T.set(n,r),T.delete(t),te.set(c.element,c),e}).catch(a)});return ne.set(this,o),te.set(this.element,this),"IFRAME"===this.element.nodeName&&M(this,"ping"),re.isEnabled&&(r=function(){return re.exit()},this.fullscreenchangeHandler=function(){(re.isFullscreen?j:_)(c,"event:exitFullscreen",r),c.ready().then(function(){M(c,"fullscreenchange",re.isFullscreen)})},re.on("fullscreenchange",this.fullscreenchangeHandler)),this}var n;return t(Player,[{key:"callMethod",value:function(n,e){var r=this,o=1<arguments.length&&void 0!==e?e:{};return new P(function(e,t){return r.ready().then(function(){j(r,n,{resolve:e,reject:t}),M(r,n,o)}).catch(t)})}},{key:"get",value:function(n){var r=this;return new P(function(e,t){return n=i(n,"get"),r.ready().then(function(){j(r,n,{resolve:e,reject:t}),M(r,n)}).catch(t)})}},{key:"set",value:function(n,r){var o=this;return new P(function(e,t){if(n=i(n,"set"),null==r)throw new TypeError("There must be a value to set.");return o.ready().then(function(){j(o,n,{resolve:e,reject:t}),M(o,n,r)}).catch(t)})}},{key:"on",value:function(e,t){if(!e)throw new TypeError("You must pass an event name.");if(!t)throw new TypeError("You must pass a callback function.");if("function"!=typeof t)throw new TypeError("The callback must be a function.");0===O(this,"event:".concat(e)).length&&this.callMethod("addEventListener",e).catch(function(){}),j(this,"event:".concat(e),t)}},{key:"off",value:function(e,t){if(!e)throw new TypeError("You must pass an event name.");if(t&&"function"!=typeof t)throw new TypeError("The callback must be a function.");_(this,"event:".concat(e),t)&&this.callMethod("removeEventListener",e).catch(function(e){})}},{key:"loadVideo",value:function(e){return this.callMethod("loadVideo",e)}},{key:"ready",value:function(){var e=ne.get(this)||new P(function(e,t){t(new Error("Unknown player. Probably unloaded."))});return P.resolve(e)}},{key:"addCuePoint",value:function(e,t){var n=1<arguments.length&&void 0!==t?t:{};return this.callMethod("addCuePoint",{time:e,data:n})}},{key:"removeCuePoint",value:function(e){return this.callMethod("removeCuePoint",e)}},{key:"enableTextTrack",value:function(e,t){if(!e)throw new TypeError("You must pass a language.");return this.callMethod("enableTextTrack",{language:e,kind:t})}},{key:"disableTextTrack",value:function(){return this.callMethod("disableTextTrack")}},{key:"pause",value:function(){return this.callMethod("pause")}},{key:"play",value:function(){return this.callMethod("play")}},{key:"requestFullscreen",value:function(){return re.isEnabled?re.request(this.element):this.callMethod("requestFullscreen")}},{key:"exitFullscreen",value:function(){return re.isEnabled?re.exit():this.callMethod("exitFullscreen")}},{key:"getFullscreen",value:function(){return re.isEnabled?P.resolve(re.isFullscreen):this.get("fullscreen")}},{key:"requestPictureInPicture",value:function(){return this.callMethod("requestPictureInPicture")}},{key:"exitPictureInPicture",value:function(){return this.callMethod("exitPictureInPicture")}},{key:"getPictureInPicture",value:function(){return this.get("pictureInPicture")}},{key:"remotePlaybackPrompt",value:function(){return this.callMethod("remotePlaybackPrompt")}},{key:"unload",value:function(){return this.callMethod("unload")}},{key:"destroy",value:function(){var n=this;return new P(function(e){var t;ne.delete(n),te.delete(n.element),n._originalElement&&(te.delete(n._originalElement),n._originalElement.removeAttribute("data-vimeo-initialized")),n.element&&"IFRAME"===n.element.nodeName&&n.element.parentNode&&(n.element.parentNode.parentNode&&n._originalElement&&n._originalElement!==n.element.parentNode?n.element.parentNode.parentNode.removeChild(n.element.parentNode):n.element.parentNode.removeChild(n.element)),n.element&&"DIV"===n.element.nodeName&&n.element.parentNode&&(n.element.removeAttribute("data-vimeo-initialized"),(t=n.element.querySelector("iframe"))&&t.parentNode&&(t.parentNode.parentNode&&n._originalElement&&n._originalElement!==t.parentNode?t.parentNode.parentNode.removeChild(t.parentNode):t.parentNode.removeChild(t))),n._window.removeEventListener("message",n._onMessage),re.isEnabled&&re.off("fullscreenchange",n.fullscreenchangeHandler),e()})}},{key:"getAutopause",value:function(){return this.get("autopause")}},{key:"setAutopause",value:function(e){return this.set("autopause",e)}},{key:"getBuffered",value:function(){return this.get("buffered")}},{key:"getCameraProps",value:function(){return this.get("cameraProps")}},{key:"setCameraProps",value:function(e){return this.set("cameraProps",e)}},{key:"getChapters",value:function(){return this.get("chapters")}},{key:"getCurrentChapter",value:function(){return this.get("currentChapter")}},{key:"getColor",value:function(){return this.get("color")}},{key:"getColors",value:function(){return P.all([this.get("colorOne"),this.get("colorTwo"),this.get("colorThree"),this.get("colorFour")])}},{key:"setColor",value:function(e){return this.set("color",e)}},{key:"setColors",value:function(e){if(!Array.isArray(e))return new P(function(e,t){return t(new TypeError("Argument must be an array."))});var t=new P(function(e){return e(null)}),n=[e[0]?this.set("colorOne",e[0]):t,e[1]?this.set("colorTwo",e[1]):t,e[2]?this.set("colorThree",e[2]):t,e[3]?this.set("colorFour",e[3]):t];return P.all(n)}},{key:"getCuePoints",value:function(){return this.get("cuePoints")}},{key:"getCurrentTime",value:function(){return this.get("currentTime")}},{key:"setCurrentTime",value:function(e){return this.set("currentTime",e)}},{key:"getDuration",value:function(){return this.get("duration")}},{key:"getEnded",value:function(){return this.get("ended")}},{key:"getLoop",value:function(){return this.get("loop")}},{key:"setLoop",value:function(e){return this.set("loop",e)}},{key:"setMuted",value:function(e){return this.set("muted",e)}},{key:"getMuted",value:function(){return this.get("muted")}},{key:"getPaused",value:function(){return this.get("paused")}},{key:"getPlaybackRate",value:function(){return this.get("playbackRate")}},{key:"setPlaybackRate",value:function(e){return this.set("playbackRate",e)}},{key:"getPlayed",value:function(){return this.get("played")}},{key:"getQualities",value:function(){return this.get("qualities")}},{key:"getQuality",value:function(){return this.get("quality")}},{key:"setQuality",value:function(e){return this.set("quality",e)}},{key:"getRemotePlaybackAvailability",value:function(){return this.get("remotePlaybackAvailability")}},{key:"getRemotePlaybackState",value:function(){return this.get("remotePlaybackState")}},{key:"getSeekable",value:function(){return this.get("seekable")}},{key:"getSeeking",value:function(){return this.get("seeking")}},{key:"getTextTracks",value:function(){return this.get("textTracks")}},{key:"getVideoEmbedCode",value:function(){return this.get("videoEmbedCode")}},{key:"getVideoId",value:function(){return this.get("videoId")}},{key:"getVideoTitle",value:function(){return this.get("videoTitle")}},{key:"getVideoWidth",value:function(){return this.get("videoWidth")}},{key:"getVideoHeight",value:function(){return this.get("videoHeight")}},{key:"getVideoUrl",value:function(){return this.get("videoUrl")}},{key:"getVolume",value:function(){return this.get("volume")}},{key:"setVolume",value:function(e){return this.set("volume",e)}},{key:"setTimingSrc",value:(n=p(d.mark(function e(t,n){var r,o=this;return d.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}throw new TypeError("A Timing Object must be provided.");case 2:return e.next=4,this.ready();case 4:return r=new ee(this,t,n),M(this,"notifyTimingObjectConnect"),r.addEventListener("disconnect",function(){return M(o,"notifyTimingObjectDisconnect")}),e.abrupt("return",r);case 8:case"end":return e.stop()}},e,this)})),function(e,t){return n.apply(this,arguments)})}]),Player}();return n||(X=function(){for(var e,t=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],n=0,r=t.length,o={};n<r;n++)if((e=t[n])&&e[1]in document){for(n=0;n<e.length;n++)o[t[0][n]]=e[n];return o}return!1}(),$={fullscreenchange:X.fullscreenchange,fullscreenerror:X.fullscreenerror},K={request:function(o){return new Promise(function(e,t){function n(){K.off("fullscreenchange",n),e()}K.on("fullscreenchange",n);var r=(o=o||document.documentElement)[X.requestFullscreen]();r instanceof Promise&&r.then(n).catch(t)})},exit:function(){return new Promise(function(t,e){var n,r;K.isFullscreen?(n=function e(){K.off("fullscreenchange",e),t()},K.on("fullscreenchange",n),(r=document[X.exitFullscreen]())instanceof Promise&&r.then(n).catch(e)):t()})},on:function(e,t){var n=$[e];n&&document.addEventListener(n,t)},off:function(e,t){var n=$[e];n&&document.removeEventListener(n,t)}},Object.defineProperties(K,{isFullscreen:{get:function(){return Boolean(document[X.fullscreenElement])}},element:{enumerable:!0,get:function(){return document[X.fullscreenElement]}},isEnabled:{enumerable:!0,get:function(){return Boolean(document[X.fullscreenEnabled])}}}),re=K,function(e){function n(e){"console"in window&&console.error&&console.error("There was an error creating an embed: ".concat(e))}var t=0<arguments.length&&void 0!==e?e:document;[].slice.call(t.querySelectorAll("[data-vimeo-id], [data-vimeo-url]")).forEach(function(t){try{if(null!==t.getAttribute("data-vimeo-defer"))return;var e=N(t);R(h(e),e,t).then(function(e){return L(e,t)}).catch(n)}catch(e){n(e)}})}(),function(e){var r=0<arguments.length&&void 0!==e?e:document;window.VimeoPlayerResizeEmbeds_||(window.VimeoPlayerResizeEmbeds_=!0,window.addEventListener("message",function(e){if(s(e.origin)&&e.data&&"spacechange"===e.data.event)for(var t=r.querySelectorAll("iframe"),n=0;n<t.length;n++)if(t[n].contentWindow===e.source){t[n].parentElement.style.paddingBottom="".concat(e.data.data[0].bottom,"px");break}}))}(),function(e){var a=0<arguments.length&&void 0!==e?e:document;window.VimeoSeoMetadataAppended||(window.VimeoSeoMetadataAppended=!0,window.addEventListener("message",function(e){if(s(e.origin)){var t=S(e.data);if(t&&"ready"===t.event)for(var n=a.querySelectorAll("iframe"),r=0;r<n.length;r++){var o=n[r],i=o.contentWindow===e.source;f(o.src)&&i&&new Player(o).callMethod("appendVideoMetadata",window.location.href)}}}))}(),function(e){var a,u=0<arguments.length&&void 0!==e?e:document;window.VimeoCheckedUrlTimeParam||(window.VimeoCheckedUrlTimeParam=!0,a=function(e){"console"in window&&console.error&&console.error("There was an error getting video Id: ".concat(e))},window.addEventListener("message",function(e){if(s(e.origin)){var t=S(e.data);if(t&&"ready"===t.event)for(var n=u.querySelectorAll("iframe"),r=0;r<n.length;r++){var o=n[r],i=o.contentWindow===e.source;f(o.src)&&i&&function(){var r=new Player(o);r.getVideoId().then(function(e){var t,n=new RegExp("[?&]vimeo_t_".concat(e,"=([^&#]*)")).exec(window.location.href);n&&n[1]&&(t=decodeURI(n[1]),r.setCurrentTime(t))}).catch(a)}()}}}))}()),Player});
{
"name": "@vimeo/player",
"version": "2.19.0",
"version": "2.20.0",
"description": "Interact with and control an embedded Vimeo Player.",

@@ -56,2 +56,3 @@ "license": "MIT",

"@babel/core": "^7.11.4",
"@babel/eslint-parser": "7.11.0",
"@babel/plugin-proposal-object-rest-spread": "^7.11.0",

@@ -63,3 +64,3 @@ "@babel/plugin-syntax-export-default-from": "^7.10.4",

"@babel/preset-env": "^7.11.0",
"@babel/register": "^7.10.5",
"@babel/register": "^7.11.0",
"@vimeo/eslint-config-player": "^5.0.1",

@@ -77,3 +78,3 @@ "ava": "^3.15.0",

"jquery": "^3.4.1",
"jsdom": "^16.4.0",
"jsdom": "^22.0.0",
"maxmin": "^3.0.0",

@@ -101,10 +102,7 @@ "npm-run-all": "^4.1.5",

],
"plugins": [
"@babel/transform-runtime"
],
"env": {
"test": {
"presets": [
"@babel/preset-env"
],
"plugins": [
"@babel/transform-runtime"
],
"sourceMaps": "inline"

@@ -111,0 +109,0 @@ }

@@ -187,3 +187,5 @@ # Vimeo Player API [![npm](https://img.shields.io/npm/v/@vimeo/player.svg?cacheSeconds=120)](https://www.npmjs.com/package/@vimeo/player) [![Coverage](https://img.shields.io/codecov/c/github/vimeo/player.js.svg?cacheSeconds=120)](https://codecov.io/gh/vimeo/player.js) ![Badge size](https://img.badgesize.io/https://raw.githubusercontent.com/vimeo/player.js/master/dist/player.min.js?compression=gzip&label=gzip)

+ [getColor](#getcolor-promisestring-error)
+ [getColors](#getcolors-promisestring-error)
+ [setColor](#setcolorcolor-string-promisestring-contrasterrortypeerrorerror)
+ [setColors](#setcolorscolors-string-promisestring-contrasterrortypeerrorerror)
+ [addCuePoint](#addcuepointtime-number-data-object-promisestring-unsupportederrorrangeerrorerror)

@@ -215,2 +217,3 @@ + [removeCuePoint](#removecuepointid-string-promisestring-unsupportederrorinvalidcuepointerror)

+ [setVolume](#setvolumevolume-number-promisenumber-rangeerrorerror)
+ [setTimingSrc](#settimingsrctimingobject-timingobject-options-timingsrcconnectoroptions-promisetimingsrcconnector)
+ [getQualities](#getqualities-promiseobject-error)

@@ -791,4 +794,3 @@ + [getQuality](#getquality-promisestring-error)

Get the color for this player.
Get the accent color for this player. Note that this is deprecated in place of `getColors`.
```js

@@ -800,9 +802,23 @@ player.getColor().then(function(color) {

});
```
### getColors(): Promise&lt;string[], Error&gt;
Get all colors used for this player.
The return value is an array of primary, accent, text/icon, and background.
```js
player.getColors().then(function(colors) {
// colors = [primary, accent, text/icon, background]
}).catch(function(error) {
// an error occurred
});
```
### setColor(color: string): Promise&lt;string, (ContrastError|TypeError|Error)&gt;
Set the color of this player to a hex or rgb string. Setting the color may fail
Set the accent color of this player to a hex or rgb string. Setting the color may fail
if the owner of the video has set their embed preferences to force a specific
color.
color. Note that this setter is deprecated and should be replaced with `setColors`.

@@ -814,7 +830,32 @@ ```js

switch (error.name) {
case 'ContrastError':
// the color was set, but the contrast is outside of the acceptable
// range
case 'TypeError':
// the string was not a valid hex or rgb color
break;
case 'EmbedSettingsError':
// the owner of the video has chosen to use a specific color
break;
default:
// some other error occurred
break;
}
});
```
### setColors(colors: string[]): Promise&lt;string[], (ContrastError|TypeError|Error)&gt;
Set all colors of this player with an array of hex values. Setting the color may fail
if the owner of the video has set their embed preferences to force a specific
color.
```js
player.setColors(['abc', 'def', '123', '456']).then(function(color) {
// colors were successfully set
// Array order: [primary, accent, text/icon, background]
}).catch(function(error) {
switch (error.name) {
case 'TypeError':

@@ -1277,2 +1318,37 @@ // the string was not a valid hex or rgb color

### setTimingSrc(timingObject: TimingObject, options?: TimingSrcConnectorOptions): Promise&lt;TimingSrcConnector&gt;
Syncs a Timing Object to the video player (https://webtiming.github.io/timingobject/)
```console
npm install @vimeo/player timing-object
```
```html
<div id="handstick"></div>
```
```js
import Player from '@vimeo/player';
import {TimingObject} from 'timing-object';
const player = new Player('handstick', {
id: 19231868,
width: 640
});
const timingObject = new TimingObject();
player.setTimingSrc(timingObject)
// any update to the timing object will reflect in the player
player.setTimingSrc(timingObject, {role: 'controller'})
// any update to the player will reflect in the timing object
```
See [TimingSrcConnectorOptions](src/lib/timing-src-connector.types.ts) for available options.
See this [demo app](https://salmoro.github.io/vimeo-timing-object-demo/dist) which syncs video playback in real-time for all viewers.
### getQualities(): Promise&lt;object[], Error&gt;

@@ -1279,0 +1355,0 @@

@@ -15,2 +15,3 @@ /**

'color',
'colors',
'controls',

@@ -17,0 +18,0 @@ 'dnt',

@@ -105,1 +105,24 @@ /**

}
/* eslint-disable max-params */
/**
* A utility method for attaching and detaching event handlers
*
* @param {EventTarget} target
* @param {string | string[]} eventName
* @param {function} callback
* @param {'addEventListener' | 'on'} onName
* @param {'removeEventListener' | 'off'} offName
* @return {{cancel: (function(): void)}}
*/
export const subscribe = (target, eventName, callback, onName = 'addEventListener', offName = 'removeEventListener') => {
const eventNames = typeof eventName === 'string' ? [eventName] : eventName;
eventNames.forEach((evName) => {
target[onName](evName, callback);
});
return {
cancel: () => eventNames.forEach((evName) => target[offName](evName, callback))
};
};

@@ -19,2 +19,3 @@ import './lib/compatibility-check';

import { initializeScreenfull } from './lib/screenfull.js';
import { TimingSrcConnector } from './lib/timing-src-connector';

@@ -746,3 +747,3 @@ const playerMap = new WeakMap();

/**
* A promise to get the color of the player.
* A promise to get the accent color of the player.
*

@@ -753,3 +754,3 @@ * @promise GetColorPromise

/**
* Get the color for this player.
* Get the accent color for this player. Note this is deprecated in place of `getColorTwo`.
*

@@ -763,4 +764,24 @@ * @return {GetColorPromise}

/**
* A promise to set the color of the player.
* A promise to get all colors for the player in an array.
*
* @promise GetColorsPromise
* @fulfill {string[]} The hex colors of the player.
*/
/**
* Get all the colors for this player in an array: [colorOne, colorTwo, colorThree, colorFour]
*
* @return {GetColorPromise}
*/
getColors() {
return Promise.all([
this.get('colorOne'),
this.get('colorTwo'),
this.get('colorThree'),
this.get('colorFour')
]);
}
/**
* A promise to set the accent color of the player.
*
* @promise SetColorPromise

@@ -775,5 +796,6 @@ * @fulfill {string} The color was successfully set.

/**
* Set the color of this player to a hex or rgb string. Setting the
* Set the accent color of this player to a hex or rgb string. Setting the
* color may fail if the owner of the video has set their embed
* preferences to force a specific color.
* Note this is deprecated in place of `setColorTwo`.
*

@@ -788,2 +810,38 @@ * @param {string} color The hex or rgb color string to set.

/**
* A promise to set all colors for the player.
*
* @promise SetColorsPromise
* @fulfill {string[]} The colors were successfully set.
* @reject {TypeError} The string was not a valid hex or rgb color.
* @reject {ContrastError} The color was set, but the contrast is
* outside of the acceptable range.
* @reject {EmbedSettingsError} The owner of the player has chosen to
* use a specific color.
*/
/**
* Set the colors of this player to a hex or rgb string. Setting the
* color may fail if the owner of the video has set their embed
* preferences to force a specific color.
* The colors should be passed in as an array: [colorOne, colorTwo, colorThree, colorFour].
* If a color should not be set, the index in the array can be left as null.
*
* @param {string[]} colors Array of the hex or rgb color strings to set.
* @return {SetColorsPromise}
*/
setColors(colors) {
if (!Array.isArray(colors)) {
return new Promise((resolve, reject) => reject(new TypeError('Argument must be an array.')));
}
const nullPromise = new Promise((resolve) => resolve(null));
const colorPromises = [
colors[0] ? this.set('colorOne', colors[0]) : nullPromise,
colors[1] ? this.set('colorTwo', colors[1]) : nullPromise,
colors[2] ? this.set('colorThree', colors[2]) : nullPromise,
colors[3] ? this.set('colorFour', colors[3]) : nullPromise
];
return Promise.all(colorPromises);
}
/**
* A representation of a cue point.

@@ -1268,2 +1326,27 @@ *

}
/** @typedef {import('./lib/timing-object.types').TimingObject} TimingObject */
/** @typedef {import('./lib/timing-src-connector.types').TimingSrcConnectorOptions} TimingSrcConnectorOptions */
/** @typedef {import('./lib/timing-src-connector').TimingSrcConnector} TimingSrcConnector */
/**
* Connects a TimingObject to the video player (https://webtiming.github.io/timingobject/)
*
* @param {TimingObject} timingObject
* @param {TimingSrcConnectorOptions} options
*
* @return {Promise<TimingSrcConnector>}
*/
async setTimingSrc(timingObject, options) {
if (!timingObject) {
throw new TypeError('A Timing Object must be provided.');
}
await this.ready();
const connector = new TimingSrcConnector(this, timingObject, options);
postMessage(this, 'notifyTimingObjectConnect');
connector.addEventListener('disconnect', () => postMessage(this, 'notifyTimingObjectDisconnect'));
return connector;
}
}

@@ -1270,0 +1353,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc