1/*! @vimeo/player v2.10.0 | (c) 2019 Vimeo | MIT License | https://github.com/vimeo/player.js */ 2(function (global, factory) { 3 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 4 typeof define === 'function' && define.amd ? define(factory) : 5 (global = global || self, (global.Vimeo = global.Vimeo || {}, global.Vimeo.Player = factory())); 6}(this,
vendor: 19,959 bytes, lines 6-726
6function () { 'use strict'; 7 8 function _classCallCheck(instance, Constructor) { 9 if (!(instance instanceof Constructor)) { 10 throw new TypeError("Cannot call a class as a function"); 11 } 12 } 13 14 function _defineProperties(target, props) { 15 for (var i = 0; i < props.length; i++) { 16 var descriptor = props[i]; 17 descriptor.enumerable = descriptor.enumerable || false; 18 descriptor.configurable = true; 19 if ("value" in descriptor) descriptor.writable = true; 20 Object.defineProperty(target, descriptor.key, descriptor); 21 } 22 } 23 24 function _createClass(Constructor, protoProps, staticProps) { 25 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 26 if (staticProps) _defineProperties(Constructor, staticProps); 27 return Constructor; 28 } 29 30 /** 31 * @module lib/functions 32 */ 33 34 /** 35 * Check to see this is a node environment. 36 * @type {Boolean} 37 */ 38 39 /* global global */ 40 var isNode = typeof global !== 'undefined' && {}.toString.call(global) === '[object global]'; 41 /** 42 * Get the name of the method for a given getter or setter. 43 * 44 * @param {string} prop The name of the property. 45 * @param {string} type Either âgetâ or âsetâ. 46 * @return {string} 47 */ 48 49 function getMethodName(prop, type) { 50 if (prop.indexOf(type.toLowerCase()) === 0) { 51 return prop; 52 } 53 54 return "".concat(type.toLowerCase()).concat(prop.substr(0, 1).toUpperCase()).concat(prop.substr(1)); 55 } 56 /** 57 * Check to see if the object is a DOM Element. 58 * 59 * @param {*} element The object to check. 60 * @return {boolean} 61 */ 62 63 function isDomElement(element) { 64 return Boolean(element && element.nodeType === 1 && 'nodeName' in element && element.ownerDocument && element.ownerDocument.defaultView); 65 } 66 /** 67 * Check to see whether the value is a number. 68 * 69 * @see http://dl.dropboxusercontent.com/u/35146/js/tests/isNumber.html 70 * @param {*} value The value to check. 71 * @param {boolean} integer Check if the value is an integer. 72 * @return {boolean} 73 */ 74 75 function isInteger(value) { 76 // eslint-disable-next-line eqeqeq 77 return !isNaN(parseFloat(value)) && isFinite(value) && Math.floor(value) == value; 78 } 79 /** 80 * Check to see if the URL is a Vimeo url. 81 * 82 * @param {string} url The url string. 83 * @return {boolean} 84 */ 85 86 function isVimeoUrl(url) { 87 return /^(https?:)?\/\/((player|www)\.)?vimeo\.com(?=$|\/)/.test(url); 88 } 89 /** 90 * Get the Vimeo URL from an element. 91 * The element must have either a data-vimeo-id or data-vimeo-url attribute. 92 * 93 * @param {object} oEmbedParameters The oEmbed parameters. 94 * @return {string} 95 */ 96 97 function getVimeoUrl() { 98 var oEmbedParameters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 99 var id = oEmbedParameters.id; 100 var url = oEmbedParameters.url; 101 var idOrUrl = id || url; 102 103 if (!idOrUrl) { 104 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.'); 105 } 106 107 if (isInteger(idOrUrl)) { 108 return "https://vimeo.com/".concat(idOrUrl); 109 } 110 111 if (isVimeoUrl(idOrUrl)) { 112 return idOrUrl.replace('http:', 'https:'); 113 } 114 115 if (id) { 116 throw new TypeError("\u201C".concat(id, "\u201D is not a valid video id.")); 117 } 118 119 throw new TypeError("\u201C".concat(idOrUrl, "\u201D is not a vimeo.com url.")); 120 } 121 122 var arrayIndexOfSupport = typeof Array.prototype.indexOf !== 'undefined'; 123 var postMessageSupport = typeof window !== 'undefined' && typeof window.postMessage !== 'undefined'; 124 125 if (!isNode && (!arrayIndexOfSupport || !postMessageSupport)) { 126 throw new Error('Sorry, the Vimeo Player API is not available in this browser.'); 127 } 128 129 var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; 130 131 function createCommonjsModule(fn, module) { 132 return module = { exports: {} }, fn(module, module.exports), module.exports; 133 } 134 135 /*! 136 * weakmap-polyfill v2.0.0 - ECMAScript6 WeakMap polyfill 137 * https://github.com/polygonplanet/weakmap-polyfill 138 * Copyright (c) 2015-2016 polygon planet <[email protected]> 139 * @license MIT 140 */ 141 (function (self) { 142 143 if (self.WeakMap) { 144 return; 145 } 146 147 var hasOwnProperty = Object.prototype.hasOwnProperty; 148 149 var defineProperty = function (object, name, value) { 150 if (Object.defineProperty) { 151 Object.defineProperty(object, name, { 152 configurable: true, 153 writable: true, 154 value: value 155 }); 156 } else { 157 object[name] = value; 158 } 159 }; 160 161 self.WeakMap = function () { 162 // ECMA-262 23.3 WeakMap Objects 163 function WeakMap() { 164 if (this === void 0) { 165 throw new TypeError("Constructor WeakMap requires 'new'"); 166 } 167 168 defineProperty(this, '_id', genId('_WeakMap')); // ECMA-262 23.3.1.1 WeakMap([iterable]) 169 170 if (arguments.length > 0) { 171 // Currently, WeakMap `iterable` argument is not supported 172 throw new TypeError('WeakMap iterable is not supported'); 173 } 174 } // ECMA-262 23.3.3.2 WeakMap.prototype.delete(key) 175 176 177 defineProperty(WeakMap.prototype, 'delete', function (key) { 178 checkInstance(this, 'delete'); 179 180 if (!isObject(key)) { 181 return false; 182 } 183 184 var entry = key[this._id]; 185 186 if (entry && entry[0] === key) { 187 delete key[this._id]; 188 return true; 189 } 190 191 return false; 192 }); // ECMA-262 23.3.3.3 WeakMap.prototype.get(key) 193 194 defineProperty(WeakMap.prototype, 'get', function (key) { 195 checkInstance(this, 'get'); 196 197 if (!isObject(key)) { 198 return void 0; 199 } 200 201 var entry = key[this._id]; 202 203 if (entry && entry[0] === key) { 204 return entry[1]; 205 } 206 207 return void 0; 208 }); // ECMA-262 23.3.3.4 WeakMap.prototype.has(key) 209 210 defineProperty(WeakMap.prototype, 'has', function (key) { 211 checkInstance(this, 'has'); 212 213 if (!isObject(key)) { 214 return false; 215 } 216 217 var entry = key[this._id]; 218 219 if (entry && entry[0] === key) { 220 return true; 221 } 222 223 return false; 224 }); // ECMA-262 23.3.3.5 WeakMap.prototype.set(key, value) 225 226 defineProperty(WeakMap.prototype, 'set', function (key, value) { 227 checkInstance(this, 'set'); 228 229 if (!isObject(key)) { 230 throw new TypeError('Invalid value used as weak map key'); 231 } 232 233 var entry = key[this._id]; 234 235 if (entry && entry[0] === key) { 236 entry[1] = value; 237 return this; 238 } 239 240 defineProperty(key, this._id, [key, value]); 241 return this; 242 }); 243 244 function checkInstance(x, methodName) { 245 if (!isObject(x) || !hasOwnProperty.call(x, '_id')) { 246 throw new TypeError(methodName + ' method called on incompatible receiver ' + typeof x); 247 } 248 } 249 250 function genId(prefix) { 251 return prefix + '_' + rand() + '.' + rand(); 252 } 253 254 function rand() { 255 return Math.random().toString().substring(2); 256 } 257 258 defineProperty(WeakMap, '_polyfill', true); 259 return WeakMap; 260 }(); 261 262 function isObject(x) { 263 return Object(x) === x; 264 } 265 })(typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : commonjsGlobal); 266 267 var npo_src = createCommonjsModule(function (module) { 268 /*! Native Promise Only 269 v0.8.1 (c) Kyle Simpson 270 MIT License: http://getify.mit-license.org 271 */ 272 (function UMD(name, context, definition) { 273 // special form of UMD for polyfilling across evironments 274 context[name] = context[name] || definition(); 275 276 if (module.exports) { 277 module.exports = context[name]; 278 } 279 })("Promise", typeof commonjsGlobal != "undefined" ? commonjsGlobal : commonjsGlobal, function DEF() { 280 281 var builtInProp, 282 cycle, 283 scheduling_queue, 284 ToString = Object.prototype.toString, 285 timer = typeof setImmediate != "undefined" ? function timer(fn) { 286 return setImmediate(fn); 287 } : setTimeout; // dammit, IE8. 288 289 try { 290 Object.defineProperty({}, "x", {}); 291 292 builtInProp = function builtInProp(obj, name, val, config) { 293 return Object.defineProperty(obj, name, { 294 value: val, 295 writable: true, 296 configurable: config !== false 297 }); 298 }; 299 } catch (err) { 300 builtInProp = function builtInProp(obj, name, val) { 301 obj[name] = val; 302 return obj; 303 }; 304 } // Note: using a queue instead of array for efficiency 305 306 307 scheduling_queue = function Queue() { 308 var first, last, item; 309 310 function Item(fn, self) { 311 this.fn = fn; 312 this.self = self; 313 this.next = void 0; 314 } 315 316 return { 317 add: function add(fn, self) { 318 item = new Item(fn, self); 319 320 if (last) { 321 last.next = item; 322 } else { 323 first = item; 324 } 325 326 last = item; 327 item = void 0; 328 }, 329 drain: function drain() { 330 var f = first; 331 first = last = cycle = void 0; 332 333 while (f) { 334 f.fn.call(f.self); 335 f = f.next; 336 } 337 } 338 }; 339 }(); 340 341 function schedule(fn, self) { 342 scheduling_queue.add(fn, self); 343 344 if (!cycle) { 345 cycle = timer(scheduling_queue.drain); 346 } 347 } // promise duck typing 348 349 350 function isThenable(o) { 351 var _then, 352 o_type = typeof o; 353 354 if (o != null && (o_type == "object" || o_type == "function")) { 355 _then = o.then; 356 } 357 358 return typeof _then == "function" ? _then : false; 359 } 360 361 function notify() { 362 for (var i = 0; i < this.chain.length; i++) { 363 notifyIsolated(this, this.state === 1 ? this.chain[i].success : this.chain[i].failure, this.chain[i]); 364 } 365 366 this.chain.length = 0; 367 } // NOTE: This is a separate function to isolate 368 // the `try..catch` so that other code can be 369 // optimized better 370 371 372 function notifyIsolated(self, cb, chain) { 373 var ret, _then; 374 375 try { 376 if (cb === false) { 377 chain.reject(self.msg); 378 } else { 379 if (cb === true) { 380 ret = self.msg; 381 } else { 382 ret = cb.call(void 0, self.msg); 383 } 384 385 if (ret === chain.promise) { 386 chain.reject(TypeError("Promise-chain cycle")); 387 } else if (_then = isThenable(ret)) { 388 _then.call(ret, chain.resolve, chain.reject); 389 } else { 390 chain.resolve(ret); 391 } 392 } 393 } catch (err) { 394 chain.reject(err); 395 } 396 } 397 398 function resolve(msg) { 399 var _then, 400 self = this; // already triggered? 401 402 403 if (self.triggered) { 404 return; 405 } 406 407 self.triggered = true; // unwrap 408 409 if (self.def) { 410 self = self.def; 411 } 412 413 try { 414 if (_then = isThenable(msg)) { 415 schedule(function () { 416 var def_wrapper = new MakeDefWrapper(self); 417 418 try { 419 _then.call(msg, function $resolve$() { 420 resolve.apply(def_wrapper, arguments); 421 }, function $reject$() { 422 reject.apply(def_wrapper, arguments); 423 }); 424 } catch (err) { 425 reject.call(def_wrapper, err); 426 } 427 }); 428 } else { 429 self.msg = msg; 430 self.state = 1; 431 432 if (self.chain.length > 0) { 433 schedule(notify, self); 434 } 435 } 436 } catch (err) { 437 reject.call(new MakeDefWrapper(self), err); 438 } 439 } 440 441 function reject(msg) { 442 var self = this; // already triggered? 443 444 if (self.triggered) { 445 return; 446 } 447 448 self.triggered = true; // unwrap 449 450 if (self.def) { 451 self = self.def; 452 } 453 454 self.msg = msg; 455 self.state = 2; 456 457 if (self.chain.length > 0) { 458 schedule(notify, self); 459 } 460 } 461 462 function iteratePromises(Constructor, arr, resolver, rejecter) { 463 for (var idx = 0; idx < arr.length; idx++) { 464 (function IIFE(idx) { 465 Constructor.resolve(arr[idx]).then(function $resolver$(msg) { 466 resolver(idx, msg); 467 }, rejecter); 468 })(idx); 469 } 470 } 471 472 function MakeDefWrapper(self) { 473 this.def = self; 474 this.triggered = false; 475 } 476 477 function MakeDef(self) { 478 this.promise = self; 479 this.state = 0; 480 this.triggered = false; 481 this.chain = []; 482 this.msg = void 0; 483 } 484 485 function Promise(executor) { 486 if (typeof executor != "function") { 487 throw TypeError("Not a function"); 488 } 489 490 if (this.__NPO__ !== 0) { 491 throw TypeError("Not a promise"); 492 } // instance shadowing the inherited "brand" 493 // to signal an already "initialized" promise 494 495 496 this.__NPO__ = 1; 497 var def = new MakeDef(this); 498 499 this["then"] = function then(success, failure) { 500 var o = { 501 success: typeof success == "function" ? success : true, 502 failure: typeof failure == "function" ? failure : false 503 }; // Note: `then(..)` itself can be borrowed to be used against 504 // a different promise constructor for making the chained promise, 505 // by substituting a different `this` binding. 506 507 o.promise = new this.constructor(function extractChain(resolve, reject) { 508 if (typeof resolve != "function" || typeof reject != "function") { 509 throw TypeError("Not a function"); 510 } 511 512 o.resolve = resolve; 513 o.reject = reject; 514 }); 515 def.chain.push(o); 516 517 if (def.state !== 0) { 518 schedule(notify, def); 519 } 520 521 return o.promise; 522 }; 523 524 this["catch"] = function $catch$(failure) { 525 return this.then(void 0, failure); 526 }; 527 528 try { 529 executor.call(void 0, function publicResolve(msg) { 530 resolve.call(def, msg); 531 }, function publicReject(msg) { 532 reject.call(def, msg); 533 }); 534 } catch (err) { 535 reject.call(def, err); 536 } 537 } 538 539 var PromisePrototype = builtInProp({}, "constructor", Promise, 540 /*configurable=*/ 541 false); // Note: Android 4 cannot use `Object.defineProperty(..)` here 542 543 Promise.prototype = PromisePrototype; // built-in "brand" to signal an "uninitialized" promise 544 545 builtInProp(PromisePrototype, "__NPO__", 0, 546 /*configurable=*/ 547 false); 548 builtInProp(Promise, "resolve", function Promise$resolve(msg) { 549 var Constructor = this; // spec mandated checks 550 // note: best "isPromise" check that's practical for now 551 552 if (msg && typeof msg == "object" && msg.__NPO__ === 1) { 553 return msg; 554 } 555 556 return new Constructor(function executor(resolve, reject) { 557 if (typeof resolve != "function" || typeof reject != "function") { 558 throw TypeError("Not a function"); 559 } 560 561 resolve(msg); 562 }); 563 }); 564 builtInProp(Promise, "reject", function Promise$reject(msg) { 565 return new this(function executor(resolve, reject) { 566 if (typeof resolve != "function" || typeof reject != "function") { 567 throw TypeError("Not a function"); 568 } 569 570 reject(msg); 571 }); 572 }); 573 builtInProp(Promise, "all", function Promise$all(arr) { 574 var Constructor = this; // spec mandated checks 575 576 if (ToString.call(arr) != "[object Array]") { 577 return Constructor.reject(TypeError("Not an array")); 578 } 579 580 if (arr.length === 0) { 581 return Constructor.resolve([]); 582 } 583 584 return new Constructor(function executor(resolve, reject) { 585 if (typeof resolve != "function" || typeof reject != "function") { 586 throw TypeError("Not a function"); 587 } 588 589 var len = arr.length, 590 msgs = Array(len), 591 count = 0; 592 iteratePromises(Constructor, arr, function resolver(idx, msg) { 593 msgs[idx] = msg; 594 595 if (++count === len) { 596 resolve(msgs); 597 } 598 }, reject); 599 }); 600 }); 601 builtInProp(Promise, "race", function Promise$race(arr) { 602 var Constructor = this; // spec mandated checks 603 604 if (ToString.call(arr) != "[object Array]") { 605 return Constructor.reject(TypeError("Not an array")); 606 } 607 608 return new Constructor(function executor(resolve, reject) { 609 if (typeof resolve != "function" || typeof reject != "function") { 610 throw TypeError("Not a function"); 611 } 612 613 iteratePromises(Constructor, arr, function resolver(idx, msg) { 614 resolve(msg); 615 }, reject); 616 }); 617 }); 618 return Promise; 619 }); 620 }); 621 622 /** 623 * @module lib/callbacks 624 */ 625 var callbackMap = new WeakMap(); 626 /** 627 * Store a callback for a method or event for a player. 628 * 629 * @param {Player} player The player object. 630 * @param {string} name The method or event name. 631 * @param {(function(this:Player, *): void|{resolve: function, reject: function})} callback 632 * The callback to call or an object with resolve and reject functions for a promise. 633 * @return {void} 634 */ 635 636 function storeCallback(player, name, callback) { 637 var playerCallbacks = callbackMap.get(player.element) || {}; 638 639 if (!(name in playerCallbacks)) { 640 playerCallbacks[name] = []; 641 } 642 643 playerCallbacks[name].push(callback); 644 callbackMap.set(player.element, playerCallbacks); 645 } 646 /** 647 * Get the callbacks for a player and event or method. 648 * 649 * @param {Player} player The player object. 650 * @param {string} name The method or event name 651 * @return {function[]} 652 */ 653 654 function getCallbacks(player, name) { 655 var playerCallbacks = callbackMap.get(player.element) || {}; 656 return playerCallbacks[name] || []; 657 } 658 /** 659 * Remove a stored callback for a method or event for a player. 660 * 661 * @param {Player} player The player object. 662 * @param {string} name The method or event name 663 * @param {function} [callback] The specific callback to remove. 664 * @return {boolean} Was this the last callback? 665 */ 666 667 function removeCallback(player, name, callback) { 668 var playerCallbacks = callbackMap.get(player.element) || {}; 669 670 if (!playerCallbacks[name]) { 671 return true; 672 } // If no callback is passed, remove all callbacks for the event 673 674 675 if (!callback) { 676 playerCallbacks[name] = []; 677 callbackMap.set(player.element, playerCallbacks); 678 return true; 679 } 680 681 var index = playerCallbacks[name].indexOf(callback); 682 683 if (index !== -1) { 684 playerCallbacks[name].splice(index, 1); 685 } 686 687 callbackMap.set(player.element, playerCallbacks); 688 return playerCallbacks[name] && playerCallbacks[name].length === 0; 689 } 690 /** 691 * Return the first stored callback for a player and event or method. 692 * 693 * @param {Player} player The player object. 694 * @param {string} name The method or event name. 695 * @return {function} The callback, or false if there were none 696 */ 697 698 function shiftCallbacks(player, name) { 699 var playerCallbacks = getCallbacks(player, name); 700 701 if (playerCallbacks.length < 1) { 702 return false; 703 } 704 705 var callback = playerCallbacks.shift(); 706 removeCallback(player, name, callback); 707 return callback; 708 } 709 /** 710 * Move callbacks associated with an element to another element. 711 * 712 * @param {HTMLElement} oldElement The old element. 713 * @param {HTMLElement} newElement The new element. 714 * @return {void} 715 */ 716 717 function swapCallbacks(oldElement, newElement) { 718 var playerCallbacks = callbackMap.get(oldElement); 719 callbackMap.set(newElement, playerCallbacks); 720 callbackMap.delete(oldElement); 721 } 722 723 /** 724 * @module lib/embed 725 */ 726 var oEmbedParameters = ['autopause', 'autoplay', 'background', 'byline', 'color', '
vendor: 4,084 bytes, lines 726-846
726controls', 'dnt', 'height', 'id', 'loop', 'maxheight', 'maxwidth', 'muted', 'playsinline', 'portrait', 'responsive', 'speed', 'texttrack', 'title', 'transparent', 'url', 'width']; 727 /** 728 * Get the 'data-vimeo'-prefixed attributes from an element as an object. 729 * 730 * @param {HTMLElement} element The element. 731 * @param {Object} [defaults={}] The default values to use. 732 * @return {Object<string, string>} 733 */ 734 735 function getOEmbedParameters(element) { 736 var defaults = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 737 return oEmbedParameters.reduce(function (params, param) { 738 var value = element.getAttribute("data-vimeo-".concat(param)); 739 740 if (value || value === '') { 741 params[param] = value === '' ? 1 : value; 742 } 743 744 return params; 745 }, defaults); 746 } 747 /** 748 * Create an embed from oEmbed data inside an element. 749 * 750 * @param {object} data The oEmbed data. 751 * @param {HTMLElement} element The element to put the iframe in. 752 * @return {HTMLIFrameElement} The iframe embed. 753 */ 754 755 function createEmbed(_ref, element) { 756 var html = _ref.html; 757 758 if (!element) { 759 throw new TypeError('An element must be provided'); 760 } 761 762 if (element.getAttribute('data-vimeo-initialized') !== null) { 763 return element.querySelector('iframe'); 764 } 765 766 var div = document.createElement('div'); 767 div.innerHTML = html; 768 element.appendChild(div.firstChild); 769 element.setAttribute('data-vimeo-initialized', 'true'); 770 return element.querySelector('iframe'); 771 } 772 /** 773 * Make an oEmbed call for the specified URL. 774 * 775 * @param {string} videoUrl The vimeo.com url for the video. 776 * @param {Object} [params] Parameters to pass to oEmbed. 777 * @param {HTMLElement} element The element. 778 * @return {Promise} 779 */ 780 781 function getOEmbedData(videoUrl) { 782 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 783 var element = arguments.length > 2 ? arguments[2] : undefined; 784 return new Promise(function (resolve, reject) { 785 if (!isVimeoUrl(videoUrl)) { 786 throw new TypeError("\u201C".concat(videoUrl, "\u201D is not a vimeo.com url.")); 787 } 788 789 var url = "https://vimeo.com/api/oembed.json?url=".concat(encodeURIComponent(videoUrl)); 790 791 for (var param in params) { 792 if (params.hasOwnProperty(param)) { 793 url += "&".concat(param, "=").concat(encodeURIComponent(params[param])); 794 } 795 } 796 797 var xhr = 'XDomainRequest' in window ? new XDomainRequest() : new XMLHttpRequest(); 798 xhr.open('GET', url, true); 799 800 xhr.onload = function () { 801 if (xhr.status === 404) { 802 reject(new Error("\u201C".concat(videoUrl, "\u201D was not found."))); 803 return; 804 } 805 806 if (xhr.status === 403) { 807 reject(new Error("\u201C".concat(videoUrl, "\u201D is not embeddable."))); 808 return; 809 } 810 811 try { 812 var json = JSON.parse(xhr.responseText); // Check api response for 403 on oembed 813 814 if (json.domain_status_code === 403) { 815 // We still want to create the embed to give users visual feedback 816 createEmbed(json, element); 817 reject(new Error("\u201C".concat(videoUrl, "\u201D is not embeddable."))); 818 return; 819 } 820 821 resolve(json); 822 } catch (error) { 823 reject(error); 824 } 825 }; 826 827 xhr.onerror = function () { 828 var status = xhr.status ? " (".concat(xhr.status, ")") : ''; 829 reject(new Error("There was an error fetching the embed code from Vimeo".concat(status, "."))); 830 }; 831 832 xhr.send(); 833 }); 834 } 835 /** 836 * Initialize all embeds within a specific element 837 * 838 * @param {HTMLElement} [parent=document] The parent element. 839 * @return {void} 840 */ 841 842 function initializeEmbeds() { 843 var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; 844 var elements = [].slice.call(parent.querySelectorAll('[data-vimeo-id], [data-vimeo-url]')); 845 846 var handleError = function handleError(error) {
vendor: 2,477 bytes, lines 847-936
847 if ('console' in window && console.error) { 848 console.error("There was an error creating an embed: ".concat(error)); 849 } 850 }; 851 852 elements.forEach(function (element) { 853 try { 854 // Skip any that have data-vimeo-defer 855 if (element.getAttribute('data-vimeo-defer') !== null) { 856 return; 857 } 858 859 var params = getOEmbedParameters(element); 860 var url = getVimeoUrl(params); 861 getOEmbedData(url, params, element).then(function (data) { 862 return createEmbed(data, element); 863 }).catch(handleError); 864 } catch (error) { 865 handleError(error); 866 } 867 }); 868 } 869 /** 870 * Resize embeds when messaged by the player. 871 * 872 * @param {HTMLElement} [parent=document] The parent element. 873 * @return {void} 874 */ 875 876 function resizeEmbeds() { 877 var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; 878 879 // Prevent execution if users include the player.js script multiple times. 880 if (window.VimeoPlayerResizeEmbeds_) { 881 return; 882 } 883 884 window.VimeoPlayerResizeEmbeds_ = true; 885 886 var onMessage = function onMessage(event) { 887 if (!isVimeoUrl(event.origin)) { 888 return; 889 } // 'spacechange' is fired only on embeds with cards 890 891 892 if (!event.data || event.data.event !== 'spacechange') { 893 return; 894 } 895 896 var iframes = parent.querySelectorAll('iframe'); 897 898 for (var i = 0; i < iframes.length; i++) { 899 if (iframes[i].contentWindow !== event.source) { 900 continue; 901 } // Change padding-bottom of the enclosing div to accommodate 902 // card carousel without distorting aspect ratio 903 904 905 var space = iframes[i].parentElement; 906 space.style.paddingBottom = "".concat(event.data.data[0].bottom, "px"); 907 break; 908 } 909 }; 910 911 if (window.addEventListener) { 912 window.addEventListener('message', onMessage, false); 913 } else if (window.attachEvent) { 914 window.attachEvent('onmessage', onMessage); 915 } 916 } 917 918 /** 919 * @module lib/postmessage 920 */ 921 /** 922 * Parse a message received from postMessage. 923 * 924 * @param {*} data The data received from postMessage. 925 * @return {object} 926 */ 927 928 function parseMessageData(data) { 929 if (typeof data === 'string') { 930 try { 931 data = JSON.parse(data); 932 } catch (error) { 933 // If the message cannot be parsed, throw the error as a warning 934 console.warn(error); 935 return {}; 936 }
vendor: 26,000 bytes, lines 936-1805
936 937 } 938 939 return data; 940 } 941 /** 942 * Post a message to the specified target. 943 * 944 * @param {Player} player The player object to use. 945 * @param {string} method The API method to call. 946 * @param {object} params The parameters to send to the player. 947 * @return {void} 948 */ 949 950 function postMessage(player, method, params) { 951 if (!player.element.contentWindow || !player.element.contentWindow.postMessage) { 952 return; 953 } 954 955 var message = { 956 method: method 957 }; 958 959 if (params !== undefined) { 960 message.value = params; 961 } // IE 8 and 9 do not support passing messages, so stringify them 962 963 964 var ieVersion = parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/, '$1')); 965 966 if (ieVersion >= 8 && ieVersion < 10) { 967 message = JSON.stringify(message); 968 } 969 970 player.element.contentWindow.postMessage(message, player.origin); 971 } 972 /** 973 * Parse the data received from a message event. 974 * 975 * @param {Player} player The player that received the message. 976 * @param {(Object|string)} data The message data. Strings will be parsed into JSON. 977 * @return {void} 978 */ 979 980 function processData(player, data) { 981 data = parseMessageData(data); 982 var callbacks = []; 983 var param; 984 985 if (data.event) { 986 if (data.event === 'error') { 987 var promises = getCallbacks(player, data.data.method); 988 promises.forEach(function (promise) { 989 var error = new Error(data.data.message); 990 error.name = data.data.name; 991 promise.reject(error); 992 removeCallback(player, data.data.method, promise); 993 }); 994 } 995 996 callbacks = getCallbacks(player, "event:".concat(data.event)); 997 param = data.data; 998 } else if (data.method) { 999 var callback = shiftCallbacks(player, data.method); 1000 1001 if (callback) { 1002 callbacks.push(callback); 1003 param = data.value; 1004 } 1005 } 1006 1007 callbacks.forEach(function (callback) { 1008 try { 1009 if (typeof callback === 'function') { 1010 callback.call(player, param); 1011 return; 1012 } 1013 1014 callback.resolve(param); 1015 } catch (e) {// empty 1016 } 1017 }); 1018 } 1019 1020 var playerMap = new WeakMap(); 1021 var readyMap = new WeakMap(); 1022 1023 var Player = 1024 /*#__PURE__*/ 1025 function () { 1026 /** 1027 * Create a Player. 1028 * 1029 * @param {(HTMLIFrameElement|HTMLElement|string|jQuery)} element A reference to the Vimeo 1030 * player iframe, and id, or a jQuery object. 1031 * @param {object} [options] oEmbed parameters to use when creating an embed in the element. 1032 * @return {Player} 1033 */ 1034 function Player(element) { 1035 var _this = this; 1036 1037 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 1038 1039 _classCallCheck(this, Player); 1040 1041 /* global jQuery */ 1042 if (window.jQuery && element instanceof jQuery) { 1043 if (element.length > 1 && window.console && console.warn) { 1044 console.warn('A jQuery object with multiple elements was passed, using the first element.'); 1045 } 1046 1047 element = element[0]; 1048 } // Find an element by ID 1049 1050 1051 if (typeof document !== 'undefined' && typeof element === 'string') { 1052 element = document.getElementById(element); 1053 } // Not an element! 1054 1055 1056 if (!isDomElement(element)) { 1057 throw new TypeError('You must pass either a valid element or a valid id.'); 1058 } 1059 1060 var win = element.ownerDocument.defaultView; // Already initialized an embed in this div, so grab the iframe 1061 1062 if (element.nodeName !== 'IFRAME') { 1063 var iframe = element.querySelector('iframe'); 1064 1065 if (iframe) { 1066 element = iframe; 1067 } 1068 } // iframe url is not a Vimeo url 1069 1070 1071 if (element.nodeName === 'IFRAME' && !isVimeoUrl(element.getAttribute('src') || '')) { 1072 throw new Error('The player element passed isnât a Vimeo embed.'); 1073 } // If there is already a player object in the map, return that 1074 1075 1076 if (playerMap.has(element)) { 1077 return playerMap.get(element); 1078 } 1079 1080 this.element = element; 1081 this.origin = '*'; 1082 var readyPromise = new npo_src(function (resolve, reject) { 1083 var onMessage = function onMessage(event) { 1084 if (!isVimeoUrl(event.origin) || _this.element.contentWindow !== event.source) { 1085 return; 1086 } 1087 1088 if (_this.origin === '*') { 1089 _this.origin = event.origin; 1090 } 1091 1092 var data = parseMessageData(event.data); 1093 var isError = data && data.event === 'error'; 1094 var isReadyError = isError && data.data && data.data.method === 'ready'; 1095 1096 if (isReadyError) { 1097 var error = new Error(data.data.message); 1098 error.name = data.data.name; 1099 reject(error); 1100 return; 1101 } 1102 1103 var isReadyEvent = data && data.event === 'ready'; 1104 var isPingResponse = data && data.method === 'ping'; 1105 1106 if (isReadyEvent || isPingResponse) { 1107 _this.element.setAttribute('data-ready', 'true'); 1108 1109 resolve(); 1110 return; 1111 } 1112 1113 processData(_this, data); 1114 }; 1115 1116 if (win.addEventListener) { 1117 win.addEventListener('message', onMessage, false); 1118 } else if (win.attachEvent) { 1119 win.attachEvent('onmessage', onMessage); 1120 } 1121 1122 if (_this.element.nodeName !== 'IFRAME') { 1123 var params = getOEmbedParameters(element, options); 1124 var url = getVimeoUrl(params); 1125 getOEmbedData(url, params, element).then(function (data) { 1126 var iframe = createEmbed(data, element); // Overwrite element with the new iframe, 1127 // but store reference to the original element 1128 1129 _this.element = iframe; 1130 _this._originalElement = element; 1131 swapCallbacks(element, iframe); 1132 playerMap.set(_this.element, _this); 1133 return data; 1134 }).catch(reject); 1135 } 1136 }); // Store a copy of this Player in the map 1137 1138 readyMap.set(this, readyPromise); 1139 playerMap.set(this.element, this); // Send a ping to the iframe so the ready promise will be resolved if 1140 // the player is already ready. 1141 1142 if (this.element.nodeName === 'IFRAME') { 1143 postMessage(this, 'ping'); 1144 } 1145 1146 return this; 1147 } 1148 /** 1149 * Get a promise for a method. 1150 * 1151 * @param {string} name The API method to call. 1152 * @param {Object} [args={}] Arguments to send via postMessage. 1153 * @return {Promise} 1154 */ 1155 1156 1157 _createClass(Player, [{ 1158 key: "callMethod", 1159 value: function callMethod(name) { 1160 var _this2 = this; 1161 1162 var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 1163 return new npo_src(function (resolve, reject) { 1164 // We are storing the resolve/reject handlers to call later, so we 1165 // canât return here. 1166 // eslint-disable-next-line promise/always-return 1167 return _this2.ready().then(function () { 1168 storeCallback(_this2, name, { 1169 resolve: resolve, 1170 reject: reject 1171 }); 1172 postMessage(_this2, name, args); 1173 }).catch(reject); 1174 }); 1175 } 1176 /** 1177 * Get a promise for the value of a player property. 1178 * 1179 * @param {string} name The property name 1180 * @return {Promise} 1181 */ 1182 1183 }, { 1184 key: "get", 1185 value: function get(name) { 1186 var _this3 = this; 1187 1188 return new npo_src(function (resolve, reject) { 1189 name = getMethodName(name, 'get'); // We are storing the resolve/reject handlers to call later, so we 1190 // canât return here. 1191 // eslint-disable-next-line promise/always-return 1192 1193 return _this3.ready().then(function () { 1194 storeCallback(_this3, name, { 1195 resolve: resolve, 1196 reject: reject 1197 }); 1198 postMessage(_this3, name); 1199 }).catch(reject); 1200 }); 1201 } 1202 /** 1203 * Get a promise for setting the value of a player property. 1204 * 1205 * @param {string} name The API method to call. 1206 * @param {mixed} value The value to set. 1207 * @return {Promise} 1208 */ 1209 1210 }, { 1211 key: "set", 1212 value: function set(name, value) { 1213 var _this4 = this; 1214 1215 return new npo_src(function (resolve, reject) { 1216 name = getMethodName(name, 'set'); 1217 1218 if (value === undefined || value === null) { 1219 throw new TypeError('There must be a value to set.'); 1220 } // We are storing the resolve/reject handlers to call later, so we 1221 // canât return here. 1222 // eslint-disable-next-line promise/always-return 1223 1224 1225 return _this4.ready().then(function () { 1226 storeCallback(_this4, name, { 1227 resolve: resolve, 1228 reject: reject 1229 }); 1230 postMessage(_this4, name, value); 1231 }).catch(reject); 1232 }); 1233 } 1234 /** 1235 * Add an event listener for the specified event. Will call the 1236 * callback with a single parameter, `data`, that contains the data for 1237 * that event. 1238 * 1239 * @param {string} eventName The name of the event. 1240 * @param {function(*)} callback The function to call when the event fires. 1241 * @return {void} 1242 */ 1243 1244 }, { 1245 key: "on", 1246 value: function on(eventName, callback) { 1247 if (!eventName) { 1248 throw new TypeError('You must pass an event name.'); 1249 } 1250 1251 if (!callback) { 1252 throw new TypeError('You must pass a callback function.'); 1253 } 1254 1255 if (typeof callback !== 'function') { 1256 throw new TypeError('The callback must be a function.'); 1257 } 1258 1259 var callbacks = getCallbacks(this, "event:".concat(eventName)); 1260 1261 if (callbacks.length === 0) { 1262 this.callMethod('addEventListener', eventName).catch(function () {// Ignore the error. There will be an error event fired that 1263 // will trigger the error callback if they are listening. 1264 }); 1265 } 1266 1267 storeCallback(this, "event:".concat(eventName), callback); 1268 } 1269 /** 1270 * Remove an event listener for the specified event. Will remove all 1271 * listeners for that event if a `callback` isnât passed, or only that 1272 * specific callback if it is passed. 1273 * 1274 * @param {string} eventName The name of the event. 1275 * @param {function} [callback] The specific callback to remove. 1276 * @return {void} 1277 */ 1278 1279 }, { 1280 key: "off", 1281 value: function off(eventName, callback) { 1282 if (!eventName) { 1283 throw new TypeError('You must pass an event name.'); 1284 } 1285 1286 if (callback && typeof callback !== 'function') { 1287 throw new TypeError('The callback must be a function.'); 1288 } 1289 1290 var lastCallback = removeCallback(this, "event:".concat(eventName), callback); // If there are no callbacks left, remove the listener 1291 1292 if (lastCallback) { 1293 this.callMethod('removeEventListener', eventName).catch(function (e) {// Ignore the error. There will be an error event fired that 1294 // will trigger the error callback if they are listening. 1295 }); 1296 } 1297 } 1298 /** 1299 * A promise to load a new video. 1300 * 1301 * @promise LoadVideoPromise 1302 * @fulfill {number} The video with this id successfully loaded. 1303 * @reject {TypeError} The id was not a number. 1304 */ 1305 1306 /** 1307 * Load a new video into this embed. The promise will be resolved if 1308 * the video is successfully loaded, or it will be rejected if it could 1309 * not be loaded. 1310 * 1311 * @param {number|object} options The id of the video or an object with embed options. 1312 * @return {LoadVideoPromise} 1313 */ 1314 1315 }, { 1316 key: "loadVideo", 1317 value: function loadVideo(options) { 1318 return this.callMethod('loadVideo', options); 1319 } 1320 /** 1321 * A promise to perform an action when the Player is ready. 1322 * 1323 * @todo document errors 1324 * @promise LoadVideoPromise 1325 * @fulfill {void} 1326 */ 1327 1328 /** 1329 * Trigger a function when the player iframe has initialized. You do not 1330 * need to wait for `ready` to trigger to begin adding event listeners 1331 * or calling other methods. 1332 * 1333 * @return {ReadyPromise} 1334 */ 1335 1336 }, { 1337 key: "ready", 1338 value: function ready() { 1339 var readyPromise = readyMap.get(this) || new npo_src(function (resolve, reject) { 1340 reject(new Error('Unknown player. Probably unloaded.')); 1341 }); 1342 return npo_src.resolve(readyPromise); 1343 } 1344 /** 1345 * A promise to add a cue point to the player. 1346 * 1347 * @promise AddCuePointPromise 1348 * @fulfill {string} The id of the cue point to use for removeCuePoint. 1349 * @reject {RangeError} the time was less than 0 or greater than the 1350 * videoâs duration. 1351 * @reject {UnsupportedError} Cue points are not supported with the current 1352 * player or browser. 1353 */ 1354 1355 /** 1356 * Add a cue point to the player. 1357 * 1358 * @param {number} time The time for the cue point. 1359 * @param {object} [data] Arbitrary data to be returned with the cue point. 1360 * @return {AddCuePointPromise} 1361 */ 1362 1363 }, { 1364 key: "addCuePoint", 1365 value: function addCuePoint(time) { 1366 var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 1367 return this.callMethod('addCuePoint', { 1368 time: time, 1369 data: data 1370 }); 1371 } 1372 /** 1373 * A promise to remove a cue point from the player. 1374 * 1375 * @promise AddCuePointPromise 1376 * @fulfill {string} The id of the cue point that was removed. 1377 * @reject {InvalidCuePoint} The cue point with the specified id was not 1378 * found. 1379 * @reject {UnsupportedError} Cue points are not supported with the current 1380 * player or browser. 1381 */ 1382 1383 /** 1384 * Remove a cue point from the video. 1385 * 1386 * @param {string} id The id of the cue point to remove. 1387 * @return {RemoveCuePointPromise} 1388 */ 1389 1390 }, { 1391 key: "removeCuePoint", 1392 value: function removeCuePoint(id) { 1393 return this.callMethod('removeCuePoint', id); 1394 } 1395 /** 1396 * A representation of a text track on a video. 1397 * 1398 * @typedef {Object} VimeoTextTrack 1399 * @property {string} language The ISO language code. 1400 * @property {string} kind The kind of track it is (captions or subtitles). 1401 * @property {string} label The humanâreadable label for the track. 1402 */ 1403 1404 /** 1405 * A promise to enable a text track. 1406 * 1407 * @promise EnableTextTrackPromise 1408 * @fulfill {VimeoTextTrack} The text track that was enabled. 1409 * @reject {InvalidTrackLanguageError} No track was available with the 1410 * specified language. 1411 * @reject {InvalidTrackError} No track was available with the specified 1412 * language and kind. 1413 */ 1414 1415 /** 1416 * Enable the text track with the specified language, and optionally the 1417 * specified kind (captions or subtitles). 1418 * 1419 * When set via the API, the track language will not change the viewerâs 1420 * stored preference. 1421 * 1422 * @param {string} language The twoâletter language code. 1423 * @param {string} [kind] The kind of track to enable (captions or subtitles). 1424 * @return {EnableTextTrackPromise} 1425 */ 1426 1427 }, { 1428 key: "enableTextTrack", 1429 value: function enableTextTrack(language, kind) { 1430 if (!language) { 1431 throw new TypeError('You must pass a language.'); 1432 } 1433 1434 return this.callMethod('enableTextTrack', { 1435 language: language, 1436 kind: kind 1437 }); 1438 } 1439 /** 1440 * A promise to disable the active text track. 1441 * 1442 * @promise DisableTextTrackPromise 1443 * @fulfill {void} The track was disabled. 1444 */ 1445 1446 /** 1447 * Disable the currently-active text track. 1448 * 1449 * @return {DisableTextTrackPromise} 1450 */ 1451 1452 }, { 1453 key: "disableTextTrack", 1454 value: function disableTextTrack() { 1455 return this.callMethod('disableTextTrack'); 1456 } 1457 /** 1458 * A promise to pause the video. 1459 * 1460 * @promise PausePromise 1461 * @fulfill {void} The video was paused. 1462 */ 1463 1464 /** 1465 * Pause the video if itâs playing. 1466 * 1467 * @return {PausePromise} 1468 */ 1469 1470 }, { 1471 key: "pause", 1472 value: function pause() { 1473 return this.callMethod('pause'); 1474 } 1475 /** 1476 * A promise to play the video. 1477 * 1478 * @promise PlayPromise 1479 * @fulfill {void} The video was played. 1480 */ 1481 1482 /** 1483 * Play the video if itâs paused. **Note:** on iOS and some other 1484 * mobile devices, you cannot programmatically trigger play. Once the 1485 * viewer has tapped on the play button in the player, however, you 1486 * will be able to use this function. 1487 * 1488 * @return {PlayPromise} 1489 */ 1490 1491 }, { 1492 key: "play", 1493 value: function play() { 1494 return this.callMethod('play'); 1495 } 1496 /** 1497 * A promise to unload the video. 1498 * 1499 * @promise UnloadPromise 1500 * @fulfill {void} The video was unloaded. 1501 */ 1502 1503 /** 1504 * Return the player to its initial state. 1505 * 1506 * @return {UnloadPromise} 1507 */ 1508 1509 }, { 1510 key: "unload", 1511 value: function unload() { 1512 return this.callMethod('unload'); 1513 } 1514 /** 1515 * Cleanup the player and remove it from the DOM 1516 * 1517 * It won't be usable and a new one should be constructed 1518 * in order to do any operations. 1519 * 1520 * @return {Promise} 1521 */ 1522 1523 }, { 1524 key: "destroy", 1525 value: function destroy() { 1526 var _this5 = this; 1527 1528 return new npo_src(function (resolve) { 1529 readyMap.delete(_this5); 1530 playerMap.delete(_this5.element); 1531 1532 if (_this5._originalElement) { 1533 playerMap.delete(_this5._originalElement); 1534 1535 _this5._originalElement.removeAttribute('data-vimeo-initialized'); 1536 } 1537 1538 if (_this5.element && _this5.element.nodeName === 'IFRAME' && _this5.element.parentNode) { 1539 _this5.element.parentNode.removeChild(_this5.element); 1540 } 1541 1542 resolve(); 1543 }); 1544 } 1545 /** 1546 * A promise to get the autopause behavior of the video. 1547 * 1548 * @promise GetAutopausePromise 1549 * @fulfill {boolean} Whether autopause is turned on or off. 1550 * @reject {UnsupportedError} Autopause is not supported with the current 1551 * player or browser. 1552 */ 1553 1554 /** 1555 * Get the autopause behavior for this player. 1556 * 1557 * @return {GetAutopausePromise} 1558 */ 1559 1560 }, { 1561 key: "getAutopause", 1562 value: function getAutopause() { 1563 return this.get('autopause'); 1564 } 1565 /** 1566 * A promise to set the autopause behavior of the video. 1567 * 1568 * @promise SetAutopausePromise 1569 * @fulfill {boolean} Whether autopause is turned on or off. 1570 * @reject {UnsupportedError} Autopause is not supported with the current 1571 * player or browser. 1572 */ 1573 1574 /** 1575 * Enable or disable the autopause behavior of this player. 1576 * 1577 * By default, when another video is played in the same browser, this 1578 * player will automatically pause. Unless you have a specific reason 1579 * for doing so, we recommend that you leave autopause set to the 1580 * default (`true`). 1581 * 1582 * @param {boolean} autopause 1583 * @return {SetAutopausePromise} 1584 */ 1585 1586 }, { 1587 key: "setAutopause", 1588 value: function setAutopause(autopause) { 1589 return this.set('autopause', autopause); 1590 } 1591 /** 1592 * A promise to get the buffered property of the video. 1593 * 1594 * @promise GetBufferedPromise 1595 * @fulfill {Array} Buffered Timeranges converted to an Array. 1596 */ 1597 1598 /** 1599 * Get the buffered property of the video. 1600 * 1601 * @return {GetBufferedPromise} 1602 */ 1603 1604 }, { 1605 key: "getBuffered", 1606 value: function getBuffered() { 1607 return this.get('buffered'); 1608 } 1609 /** 1610 * A promise to get the color of the player. 1611 * 1612 * @promise GetColorPromise 1613 * @fulfill {string} The hex color of the player. 1614 */ 1615 1616 /** 1617 * Get the color for this player. 1618 * 1619 * @return {GetColorPromise} 1620 */ 1621 1622 }, { 1623 key: "getColor", 1624 value: function getColor() { 1625 return this.get('color'); 1626 } 1627 /** 1628 * A promise to set the color of the player. 1629 * 1630 * @promise SetColorPromise 1631 * @fulfill {string} The color was successfully set. 1632 * @reject {TypeError} The string was not a valid hex or rgb color. 1633 * @reject {ContrastError} The color was set, but the contrast is 1634 * outside of the acceptable range. 1635 * @reject {EmbedSettingsError} The owner of the player has chosen to 1636 * use a specific color. 1637 */ 1638 1639 /** 1640 * Set the color of this player to a hex or rgb string. Setting the 1641 * color may fail if the owner of the video has set their embed 1642 * preferences to force a specific color. 1643 * 1644 * @param {string} color The hex or rgb color string to set. 1645 * @return {SetColorPromise} 1646 */ 1647 1648 }, { 1649 key: "setColor", 1650 value: function setColor(color) { 1651 return this.set('color', color); 1652 } 1653 /** 1654 * A representation of a cue point. 1655 * 1656 * @typedef {Object} VimeoCuePoint 1657 * @property {number} time The time of the cue point. 1658 * @property {object} data The data passed when adding the cue point. 1659 * @property {string} id The unique id for use with removeCuePoint. 1660 */ 1661 1662 /** 1663 * A promise to get the cue points of a video. 1664 * 1665 * @promise GetCuePointsPromise 1666 * @fulfill {VimeoCuePoint[]} The cue points added to the video. 1667 * @reject {UnsupportedError} Cue points are not supported with the current 1668 * player or browser. 1669 */ 1670 1671 /** 1672 * Get an array of the cue points added to the video. 1673 * 1674 * @return {GetCuePointsPromise} 1675 */ 1676 1677 }, { 1678 key: "getCuePoints", 1679 value: function getCuePoints() { 1680 return this.get('cuePoints'); 1681 } 1682 /** 1683 * A promise to get the current time of the video. 1684 * 1685 * @promise GetCurrentTimePromise 1686 * @fulfill {number} The current time in seconds. 1687 */ 1688 1689 /** 1690 * Get the current playback position in seconds. 1691 * 1692 * @return {GetCurrentTimePromise} 1693 */ 1694 1695 }, { 1696 key: "getCurrentTime", 1697 value: function getCurrentTime() { 1698 return this.get('currentTime'); 1699 } 1700 /** 1701 * A promise to set the current time of the video. 1702 * 1703 * @promise SetCurrentTimePromise 1704 * @fulfill {number} The actual current time that was set. 1705 * @reject {RangeError} the time was less than 0 or greater than the 1706 * videoâs duration. 1707 */ 1708 1709 /** 1710 * Set the current playback position in seconds. If the player was 1711 * paused, it will remain paused. Likewise, if the player was playing, 1712 * it will resume playing once the video has buffered. 1713 * 1714 * You can provide an accurate time and the player will attempt to seek 1715 * to as close to that time as possible. The exact time will be the 1716 * fulfilled value of the promise. 1717 * 1718 * @param {number} currentTime 1719 * @return {SetCurrentTimePromise} 1720 */ 1721 1722 }, { 1723 key: "setCurrentTime", 1724 value: function setCurrentTime(currentTime) { 1725 return this.set('currentTime', currentTime); 1726 } 1727 /** 1728 * A promise to get the duration of the video. 1729 * 1730 * @promise GetDurationPromise 1731 * @fulfill {number} The duration in seconds. 1732 */ 1733 1734 /** 1735 * Get the duration of the video in seconds. It will be rounded to the 1736 * nearest second before playback begins, and to the nearest thousandth 1737 * of a second after playback begins. 1738 * 1739 * @return {GetDurationPromise} 1740 */ 1741 1742 }, { 1743 key: "getDuration", 1744 value: function getDuration() { 1745 return this.get('duration'); 1746 } 1747 /** 1748 * A promise to get the ended state of the video. 1749 * 1750 * @promise GetEndedPromise 1751 * @fulfill {boolean} Whether or not the video has ended. 1752 */ 1753 1754 /** 1755 * Get the ended state of the video. The video has ended if 1756 * `currentTime === duration`. 1757 * 1758 * @return {GetEndedPromise} 1759 */ 1760 1761 }, { 1762 key: "getEnded", 1763 value: function getEnded() { 1764 return this.get('ended'); 1765 } 1766 /** 1767 * A promise to get the loop state of the player. 1768 * 1769 * @promise GetLoopPromise 1770 * @fulfill {boolean} Whether or not the player is set to loop. 1771 */ 1772 1773 /** 1774 * Get the loop state of the player. 1775 * 1776 * @return {GetLoopPromise} 1777 */ 1778 1779 }, { 1780 key: "getLoop", 1781 value: function getLoop() { 1782 return this.get('loop'); 1783 } 1784 /** 1785 * A promise to set the loop state of the player. 1786 * 1787 * @promise SetLoopPromise 1788 * @fulfill {boolean} The loop state that was set. 1789 */ 1790 1791 /** 1792 * Set the loop state of the player. When set to `true`, the player 1793 * will start over immediately once playback ends. 1794 * 1795 * @param {boolean} loop 1796 * @return {SetLoopPromise} 1797 */ 1798 1799 }, { 1800 key: "setLoop", 1801 value: function setLoop(loop) { 1802 return this.set('loop', loop); 1803 } 1804 /** 1805 * A promise to
1805set the muted state of the player. 1806 * 1807 * @promise SetMutedPromise 1808 * @fulfill {boolean} The muted state that was set. 1809 */ 1810 1811 /** 1812 * Set the muted state of the player. When set to `true`, the player 1813 * volume will be muted. 1814 * 1815 * @param {boolean} muted 1816 * @return {SetMutedPromise} 1817 */ 1818 1819 }, { 1820 key: "setMuted", 1821 value: function setMuted(muted) { 1822 return this.set('muted', muted); 1823 } 1824 /** 1825 * A promise to get the muted state of the player. 1826 * 1827 * @promise GetMutedPromise 1828 * @fulfill {boolean} Whether or not the player is muted. 1829 */ 1830 1831 /** 1832 * Get the muted state of the player. 1833 * 1834 * @return {GetMutedPromise} 1835 */ 1836 1837 }, { 1838 key: "getMuted", 1839 value: function getMuted() { 1840 return this.get('muted'); 1841 } 1842 /** 1843 * A promise to get the paused state of the player. 1844 * 1845 * @promise GetLoopPromise 1846 * @fulfill {boolean} Whether or not the video is paused. 1847 */ 1848 1849 /** 1850 * Get the paused state of the player. 1851 * 1852 * @return {GetLoopPromise} 1853 */ 1854 1855 }, { 1856 key: "getPaused", 1857 value: function getPaused() { 1858 return this.get('paused'); 1859 } 1860 /** 1861 * A promise to get the playback rate of the player. 1862 * 1863 * @promise GetPlaybackRatePromise 1864 * @fulfill {number} The playback rate of the player on a scale from 0.5 to 2. 1865 */ 1866 1867 /** 1868 * Get the playback rate of the player on a scale from `0.5` to `2`. 1869 * 1870 * @return {GetPlaybackRatePromise} 1871 */ 1872 1873 }, { 1874 key: "getPlaybackRate", 1875 value: function getPlaybackRate() { 1876 return this.get('playbackRate'); 1877 } 1878 /** 1879 * A promise to set the playbackrate of the player. 1880 * 1881 * @promise SetPlaybackRatePromise 1882 * @fulfill {number} The playback rate was set. 1883 * @reject {RangeError} The playback rate was less than 0.5 or greater than 2. 1884 */ 1885 1886 /** 1887 * Set the playback rate of the player on a scale from `0.5` to `2`. When set 1888 * via the API, the playback rate will not be synchronized to other 1889 * players or stored as the viewer's preference. 1890 * 1891 * @param {number} playbackRate 1892 * @return {SetPlaybackRatePromise} 1893 */ 1894 1895 }, { 1896 key: "setPlaybackRate", 1897 value: function setPlaybackRate(playbackRate) { 1898 return this.set('playbackRate', playbackRate); 1899 } 1900 /** 1901 * A promise to get the played property of the video. 1902 * 1903 * @promise GetPlayedPromise 1904 * @fulfill {Array} Played Timeranges converted to an Array. 1905 */ 1906 1907 /** 1908 * Get the played property of the video. 1909 * 1910 * @return {GetPlayedPromise} 1911 */ 1912 1913 }, { 1914 key: "getPlayed", 1915 value: function getPlayed() { 1916 return this.get('played'); 1917 } 1918 /** 1919 * A promise to get the seekable property of the video. 1920 * 1921 * @promise GetSeekablePromise 1922 * @fulfill {Array} Seekable Timeranges converted to an Array. 1923 */ 1924 1925 /** 1926 * Get the seekable property of the video. 1927 * 1928 * @return {GetSeekablePromise} 1929 */ 1930 1931 }, { 1932 key: "getSeekable", 1933 value: function getSeekable() { 1934 return this.get('seekable'); 1935 } 1936 /** 1937 * A promise to get the seeking property of the player. 1938 * 1939 * @promise GetSeekingPromise 1940 * @fulfill {boolean} Whether or not the player is currently seeking. 1941 */ 1942 1943 /** 1944 * Get if the player is currently seeking. 1945 * 1946 * @return {GetSeekingPromise} 1947 */ 1948 1949 }, { 1950 key: "getSeeking", 1951 value: function getSeeking() { 1952 return this.get('seeking'); 1953 } 1954 /** 1955 * A promise to get the text tracks of a video. 1956 * 1957 * @promise GetTextTracksPromise 1958 * @fulfill {VimeoTextTrack[]} The text tracks associated with the video. 1959 */ 1960 1961 /** 1962 * Get an array of the text tracks that exist for the video. 1963 * 1964 * @return {GetTextTracksPromise} 1965 */ 1966 1967 }, {
1968 key: "getTextTracks", 1969 value: function getTextTracks() { 1970 return this.get('textTracks'); 1971 } 1972 /** 1973 * A promise to get the embed code for the video. 1974 * 1975 * @promise GetVideoEmbedCodePromise 1976 * @fulfill {string} The `<iframe>` embed code for the video. 1977 */ 1978 1979 /** 1980 * Get the `<iframe>` embed code for the video. 1981 * 1982 * @return {GetVideoEmbedCodePromise} 1983 */ 1984 1985 }, { 1986 key: "getVideoEmbedCode", 1987 value: function getVideoEmbedCode() { 1988 return this.get('videoEmbedCode'); 1989 } 1990 /** 1991 * A promise to get the id of the video. 1992 * 1993 * @promise GetVideoIdPromise 1994 * @fulfill {number} The id of the video. 1995 */ 1996 1997 /** 1998 * Get the id of the video. 1999 * 2000 * @return {GetVideoIdPromise} 2001 */ 2002 2003 }, { 2004 key: "getVideoId", 2005 value: function getVideoId() { 2006 return this.get('videoId'); 2007 } 2008 /** 2009 * A promise to get the title of the video. 2010 * 2011 * @promise GetVideoTitlePromise 2012 * @fulfill {number} The title of the video. 2013 */ 2014 2015 /** 2016 * Get the title of the video. 2017 * 2018 * @return {GetVideoTitlePromise} 2019 */ 2020 2021 }, { 2022 key: "getVideoTitle", 2023 value: function getVideoTitle() { 2024 return this.get('videoTitle'); 2025 } 2026 /** 2027 * A promise to get the native width of the video. 2028 * 2029 * @promise GetVideoWidthPromise 2030 * @fulfill {number} The native width of the video. 2031 */ 2032 2033 /** 2034 * Get the native width of the currentlyâplaying video. The width of 2035 * the highestâresolution available will be used before playback begins. 2036 * 2037 * @return {GetVideoWidthPromise} 2038 */ 2039 2040 }, { 2041 key: "getVideoWidth", 2042 value: function getVideoWidth() { 2043 return this.get('videoWidth'); 2044 } 2045 /** 2046 * A promise to get the native height of the video. 2047 * 2048 * @promise GetVideoHeightPromise 2049 * @fulfill {number} The native height of the video. 2050 */ 2051 2052 /** 2053 * Get the native height of the currentlyâplaying video. The height of 2054 * the highestâresolution available will be used before playback begins. 2055 * 2056 * @return {GetVideoHeightPromise} 2057 */ 2058 2059 }, { 2060 key: "getVideoHeight", 2061 value: function getVideoHeight() { 2062 return this.get('videoHeight'); 2063 } 2064 /** 2065 * A promise to get the vimeo.com url for the video. 2066 * 2067 * @promise GetVideoUrlPromise 2068 * @fulfill {number} The vimeo.com url for the video. 2069 * @reject {PrivacyError} The url isnât available because of the videoâs privacy setting. 2070 */ 2071 2072 /** 2073 * Get the vimeo.com url for the video. 2074 * 2075 * @return {GetVideoUrlPromise} 2076 */ 2077 2078 }, { 2079 key: "getVideoUrl", 2080 value: function getVideoUrl() { 2081 return this.get('videoUrl'); 2082 } 2083 /** 2084 * A promise to get the volume level of the player. 2085 * 2086 * @promise GetVolumePromise 2087 * @fulfill {number} The volume level of the player on a scale from 0 to 1. 2088 */ 2089 2090 /** 2091 * Get the current volume level of the player on a scale from `0` to `1`. 2092 * 2093 * Most mobile devices do not support an independent volume from the 2094 * system volume. In those cases, this method will always return `1`. 2095 * 2096 * @return {GetVolumePromise} 2097 */ 2098 2099 }, { 2100 key: "getVolume", 2101 value: function getVolume() { 2102 return this.get('volume'); 2103 } 2104 /** 2105 * A promise to set the volume level of the player. 2106 * 2107 * @promise SetVolumePromise 2108 * @fulfill {number} The volume was set. 2109 * @reject {RangeError} The volume was less than 0 or greater than 1. 2110 */ 2111 2112 /** 2113 * Set the volume of the player on a scale from `0` to `1`. When set 2114 * via the API, the volume level will not be synchronized to other 2115 * players or stored as the viewerâs preference. 2116 * 2117 * Most mobile devices do not support setting the volume. An error will 2118 * *not* be triggered in that situation. 2119 * 2120 * @param {number} volume 2121 * @return {SetVolumePromise} 2122 */ 2123 2124 }, {
2125 key: "setVolume", 2126 value: function setVolume(volume) { 2127 return this.set('volume', volume); 2128 } 2129 }]); 2130 2131 return Player; 2132 }(); // Setup embed only if this is not a node environment 2133 2134 2135 if (!isNode) { 2136 initializeEmbeds(); 2137 resizeEmbeds(); 2138 } 2139 2140 return Player; 2141 2142})); 2143 2144//# sourceMappingURL=player.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.