PageSourceSearch

https://robclouth.com/libs/player.js

js robclouth.com collected 2026-10-08 18:55:08 UTC 60,369 bytes, 2,080 lines download raw bytes

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