@ix_waterford/lib 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/index.html +1 -1
  2. package/dist/index.js +121113 -5092
  3. package/dist/index.js.map +1 -1
  4. package/package.json +1 -1
  5. package/dist/async/reactPlayerDash.js +0 -350
  6. package/dist/async/reactPlayerDash.js.map +0 -1
  7. package/dist/async/reactPlayerHls.js +0 -429
  8. package/dist/async/reactPlayerHls.js.map +0 -1
  9. package/dist/async/reactPlayerMux.js +0 -16075
  10. package/dist/async/reactPlayerMux.js.map +0 -1
  11. package/dist/async/reactPlayerPreview.js +0 -111
  12. package/dist/async/reactPlayerPreview.js.map +0 -1
  13. package/dist/async/reactPlayerSpotify.js +0 -518
  14. package/dist/async/reactPlayerSpotify.js.map +0 -1
  15. package/dist/async/reactPlayerTiktok.js +0 -488
  16. package/dist/async/reactPlayerTiktok.js.map +0 -1
  17. package/dist/async/reactPlayerTwitch.js +0 -586
  18. package/dist/async/reactPlayerTwitch.js.map +0 -1
  19. package/dist/async/reactPlayerVimeo.js +0 -4264
  20. package/dist/async/reactPlayerVimeo.js.map +0 -1
  21. package/dist/async/reactPlayerWistia.js +0 -767
  22. package/dist/async/reactPlayerWistia.js.map +0 -1
  23. package/dist/async/reactPlayerYouTube.js +0 -738
  24. package/dist/async/reactPlayerYouTube.js.map +0 -1
  25. package/dist/async/vendors-node_modules_custom-media-element_dist_custom-media-element_js-node_modules_media-tra-835023.js +0 -1253
  26. package/dist/async/vendors-node_modules_custom-media-element_dist_custom-media-element_js-node_modules_media-tra-835023.js.map +0 -1
  27. package/dist/async/vendors-node_modules_dashjs_dist_modern_esm_dash_all_min_js.js +0 -21
  28. package/dist/async/vendors-node_modules_dashjs_dist_modern_esm_dash_all_min_js.js.map +0 -1
  29. package/dist/async/vendors-node_modules_hls_js_dist_hls_mjs.js +0 -36691
  30. package/dist/async/vendors-node_modules_hls_js_dist_hls_mjs.js.map +0 -1
  31. package/dist/lib-react.js +0 -1462
  32. package/dist/lib-react.js.map +0 -1
  33. package/dist/vendors-node_modules_rspack_core_dist_cssExtractHmr_js-node_modules_dayjs_plugin_utc_js-node_-5eb95d.js +0 -53062
  34. package/dist/vendors-node_modules_rspack_core_dist_cssExtractHmr_js-node_modules_dayjs_plugin_utc_js-node_-5eb95d.js.map +0 -1
@@ -1,4264 +0,0 @@
1
- (self["webpackChunk_ix_waterford_lib"] = self["webpackChunk_ix_waterford_lib"] || []).push([["reactPlayerVimeo"], {
2
- "./node_modules/@vimeo/player/dist/player.es.js": (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
3
- __webpack_require__.r(__webpack_exports__);
4
- __webpack_require__.d(__webpack_exports__, {
5
- "default": () => (__WEBPACK_DEFAULT_EXPORT__)
6
- });
7
- /*! @vimeo/player v2.29.0 | (c) 2025 Vimeo | MIT License | https://github.com/vimeo/player.js */
8
- function ownKeys(object, enumerableOnly) {
9
- var keys = Object.keys(object);
10
- if (Object.getOwnPropertySymbols) {
11
- var symbols = Object.getOwnPropertySymbols(object);
12
- enumerableOnly && (symbols = symbols.filter(function (sym) {
13
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
14
- })), keys.push.apply(keys, symbols);
15
- }
16
- return keys;
17
- }
18
- function _objectSpread2(target) {
19
- for (var i = 1; i < arguments.length; i++) {
20
- var source = null != arguments[i] ? arguments[i] : {};
21
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
22
- _defineProperty(target, key, source[key]);
23
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
24
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
25
- });
26
- }
27
- return target;
28
- }
29
- function _regeneratorRuntime() {
30
- _regeneratorRuntime = function () {
31
- return exports;
32
- };
33
- var exports = {},
34
- Op = Object.prototype,
35
- hasOwn = Op.hasOwnProperty,
36
- defineProperty = Object.defineProperty || function (obj, key, desc) {
37
- obj[key] = desc.value;
38
- },
39
- $Symbol = "function" == typeof Symbol ? Symbol : {},
40
- iteratorSymbol = $Symbol.iterator || "@@iterator",
41
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
42
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
43
- function define(obj, key, value) {
44
- return Object.defineProperty(obj, key, {
45
- value: value,
46
- enumerable: !0,
47
- configurable: !0,
48
- writable: !0
49
- }), obj[key];
50
- }
51
- try {
52
- define({}, "");
53
- } catch (err) {
54
- define = function (obj, key, value) {
55
- return obj[key] = value;
56
- };
57
- }
58
- function wrap(innerFn, outerFn, self, tryLocsList) {
59
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
60
- generator = Object.create(protoGenerator.prototype),
61
- context = new Context(tryLocsList || []);
62
- return defineProperty(generator, "_invoke", {
63
- value: makeInvokeMethod(innerFn, self, context)
64
- }), generator;
65
- }
66
- function tryCatch(fn, obj, arg) {
67
- try {
68
- return {
69
- type: "normal",
70
- arg: fn.call(obj, arg)
71
- };
72
- } catch (err) {
73
- return {
74
- type: "throw",
75
- arg: err
76
- };
77
- }
78
- }
79
- exports.wrap = wrap;
80
- var ContinueSentinel = {};
81
- function Generator() {}
82
- function GeneratorFunction() {}
83
- function GeneratorFunctionPrototype() {}
84
- var IteratorPrototype = {};
85
- define(IteratorPrototype, iteratorSymbol, function () {
86
- return this;
87
- });
88
- var getProto = Object.getPrototypeOf,
89
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
90
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
91
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
92
- function defineIteratorMethods(prototype) {
93
- ["next", "throw", "return"].forEach(function (method) {
94
- define(prototype, method, function (arg) {
95
- return this._invoke(method, arg);
96
- });
97
- });
98
- }
99
- function AsyncIterator(generator, PromiseImpl) {
100
- function invoke(method, arg, resolve, reject) {
101
- var record = tryCatch(generator[method], generator, arg);
102
- if ("throw" !== record.type) {
103
- var result = record.arg,
104
- value = result.value;
105
- return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
106
- invoke("next", value, resolve, reject);
107
- }, function (err) {
108
- invoke("throw", err, resolve, reject);
109
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
110
- result.value = unwrapped, resolve(result);
111
- }, function (error) {
112
- return invoke("throw", error, resolve, reject);
113
- });
114
- }
115
- reject(record.arg);
116
- }
117
- var previousPromise;
118
- defineProperty(this, "_invoke", {
119
- value: function (method, arg) {
120
- function callInvokeWithMethodAndArg() {
121
- return new PromiseImpl(function (resolve, reject) {
122
- invoke(method, arg, resolve, reject);
123
- });
124
- }
125
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
126
- }
127
- });
128
- }
129
- function makeInvokeMethod(innerFn, self, context) {
130
- var state = "suspendedStart";
131
- return function (method, arg) {
132
- if ("executing" === state) throw new Error("Generator is already running");
133
- if ("completed" === state) {
134
- if ("throw" === method) throw arg;
135
- return doneResult();
136
- }
137
- for (context.method = method, context.arg = arg;;) {
138
- var delegate = context.delegate;
139
- if (delegate) {
140
- var delegateResult = maybeInvokeDelegate(delegate, context);
141
- if (delegateResult) {
142
- if (delegateResult === ContinueSentinel) continue;
143
- return delegateResult;
144
- }
145
- }
146
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
147
- if ("suspendedStart" === state) throw state = "completed", context.arg;
148
- context.dispatchException(context.arg);
149
- } else "return" === context.method && context.abrupt("return", context.arg);
150
- state = "executing";
151
- var record = tryCatch(innerFn, self, context);
152
- if ("normal" === record.type) {
153
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
154
- return {
155
- value: record.arg,
156
- done: context.done
157
- };
158
- }
159
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
160
- }
161
- };
162
- }
163
- function maybeInvokeDelegate(delegate, context) {
164
- var methodName = context.method,
165
- method = delegate.iterator[methodName];
166
- if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
167
- var record = tryCatch(method, delegate.iterator, context.arg);
168
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
169
- var info = record.arg;
170
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
171
- }
172
- function pushTryEntry(locs) {
173
- var entry = {
174
- tryLoc: locs[0]
175
- };
176
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
177
- }
178
- function resetTryEntry(entry) {
179
- var record = entry.completion || {};
180
- record.type = "normal", delete record.arg, entry.completion = record;
181
- }
182
- function Context(tryLocsList) {
183
- this.tryEntries = [{
184
- tryLoc: "root"
185
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
186
- }
187
- function values(iterable) {
188
- if (iterable) {
189
- var iteratorMethod = iterable[iteratorSymbol];
190
- if (iteratorMethod) return iteratorMethod.call(iterable);
191
- if ("function" == typeof iterable.next) return iterable;
192
- if (!isNaN(iterable.length)) {
193
- var i = -1,
194
- next = function next() {
195
- for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
196
- return next.value = undefined, next.done = !0, next;
197
- };
198
- return next.next = next;
199
- }
200
- }
201
- return {
202
- next: doneResult
203
- };
204
- }
205
- function doneResult() {
206
- return {
207
- value: undefined,
208
- done: !0
209
- };
210
- }
211
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
212
- value: GeneratorFunctionPrototype,
213
- configurable: !0
214
- }), defineProperty(GeneratorFunctionPrototype, "constructor", {
215
- value: GeneratorFunction,
216
- configurable: !0
217
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
218
- var ctor = "function" == typeof genFun && genFun.constructor;
219
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
220
- }, exports.mark = function (genFun) {
221
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
222
- }, exports.awrap = function (arg) {
223
- return {
224
- __await: arg
225
- };
226
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
227
- return this;
228
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
229
- void 0 === PromiseImpl && (PromiseImpl = Promise);
230
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
231
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
232
- return result.done ? result.value : iter.next();
233
- });
234
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
235
- return this;
236
- }), define(Gp, "toString", function () {
237
- return "[object Generator]";
238
- }), exports.keys = function (val) {
239
- var object = Object(val),
240
- keys = [];
241
- for (var key in object) keys.push(key);
242
- return keys.reverse(), function next() {
243
- for (; keys.length;) {
244
- var key = keys.pop();
245
- if (key in object) return next.value = key, next.done = !1, next;
246
- }
247
- return next.done = !0, next;
248
- };
249
- }, exports.values = values, Context.prototype = {
250
- constructor: Context,
251
- reset: function (skipTempReset) {
252
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
253
- },
254
- stop: function () {
255
- this.done = !0;
256
- var rootRecord = this.tryEntries[0].completion;
257
- if ("throw" === rootRecord.type) throw rootRecord.arg;
258
- return this.rval;
259
- },
260
- dispatchException: function (exception) {
261
- if (this.done) throw exception;
262
- var context = this;
263
- function handle(loc, caught) {
264
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
265
- }
266
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
267
- var entry = this.tryEntries[i],
268
- record = entry.completion;
269
- if ("root" === entry.tryLoc) return handle("end");
270
- if (entry.tryLoc <= this.prev) {
271
- var hasCatch = hasOwn.call(entry, "catchLoc"),
272
- hasFinally = hasOwn.call(entry, "finallyLoc");
273
- if (hasCatch && hasFinally) {
274
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
275
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
276
- } else if (hasCatch) {
277
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
278
- } else {
279
- if (!hasFinally) throw new Error("try statement without catch or finally");
280
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
281
- }
282
- }
283
- }
284
- },
285
- abrupt: function (type, arg) {
286
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
287
- var entry = this.tryEntries[i];
288
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
289
- var finallyEntry = entry;
290
- break;
291
- }
292
- }
293
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
294
- var record = finallyEntry ? finallyEntry.completion : {};
295
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
296
- },
297
- complete: function (record, afterLoc) {
298
- if ("throw" === record.type) throw record.arg;
299
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
300
- },
301
- finish: function (finallyLoc) {
302
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
303
- var entry = this.tryEntries[i];
304
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
305
- }
306
- },
307
- catch: function (tryLoc) {
308
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
309
- var entry = this.tryEntries[i];
310
- if (entry.tryLoc === tryLoc) {
311
- var record = entry.completion;
312
- if ("throw" === record.type) {
313
- var thrown = record.arg;
314
- resetTryEntry(entry);
315
- }
316
- return thrown;
317
- }
318
- }
319
- throw new Error("illegal catch attempt");
320
- },
321
- delegateYield: function (iterable, resultName, nextLoc) {
322
- return this.delegate = {
323
- iterator: values(iterable),
324
- resultName: resultName,
325
- nextLoc: nextLoc
326
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
327
- }
328
- }, exports;
329
- }
330
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
331
- try {
332
- var info = gen[key](arg);
333
- var value = info.value;
334
- } catch (error) {
335
- reject(error);
336
- return;
337
- }
338
- if (info.done) {
339
- resolve(value);
340
- } else {
341
- Promise.resolve(value).then(_next, _throw);
342
- }
343
- }
344
- function _asyncToGenerator(fn) {
345
- return function () {
346
- var self = this,
347
- args = arguments;
348
- return new Promise(function (resolve, reject) {
349
- var gen = fn.apply(self, args);
350
- function _next(value) {
351
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
352
- }
353
- function _throw(err) {
354
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
355
- }
356
- _next(undefined);
357
- });
358
- };
359
- }
360
- function _classCallCheck(instance, Constructor) {
361
- if (!(instance instanceof Constructor)) {
362
- throw new TypeError("Cannot call a class as a function");
363
- }
364
- }
365
- function _defineProperties(target, props) {
366
- for (var i = 0; i < props.length; i++) {
367
- var descriptor = props[i];
368
- descriptor.enumerable = descriptor.enumerable || false;
369
- descriptor.configurable = true;
370
- if ("value" in descriptor) descriptor.writable = true;
371
- Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
372
- }
373
- }
374
- function _createClass(Constructor, protoProps, staticProps) {
375
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
376
- if (staticProps) _defineProperties(Constructor, staticProps);
377
- Object.defineProperty(Constructor, "prototype", {
378
- writable: false
379
- });
380
- return Constructor;
381
- }
382
- function _defineProperty(obj, key, value) {
383
- key = _toPropertyKey(key);
384
- if (key in obj) {
385
- Object.defineProperty(obj, key, {
386
- value: value,
387
- enumerable: true,
388
- configurable: true,
389
- writable: true
390
- });
391
- } else {
392
- obj[key] = value;
393
- }
394
- return obj;
395
- }
396
- function _inherits(subClass, superClass) {
397
- if (typeof superClass !== "function" && superClass !== null) {
398
- throw new TypeError("Super expression must either be null or a function");
399
- }
400
- subClass.prototype = Object.create(superClass && superClass.prototype, {
401
- constructor: {
402
- value: subClass,
403
- writable: true,
404
- configurable: true
405
- }
406
- });
407
- Object.defineProperty(subClass, "prototype", {
408
- writable: false
409
- });
410
- if (superClass) _setPrototypeOf(subClass, superClass);
411
- }
412
- function _getPrototypeOf(o) {
413
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
414
- return o.__proto__ || Object.getPrototypeOf(o);
415
- };
416
- return _getPrototypeOf(o);
417
- }
418
- function _setPrototypeOf(o, p) {
419
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
420
- o.__proto__ = p;
421
- return o;
422
- };
423
- return _setPrototypeOf(o, p);
424
- }
425
- function _isNativeReflectConstruct() {
426
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
427
- if (Reflect.construct.sham) return false;
428
- if (typeof Proxy === "function") return true;
429
- try {
430
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
431
- return true;
432
- } catch (e) {
433
- return false;
434
- }
435
- }
436
- function _construct(Parent, args, Class) {
437
- if (_isNativeReflectConstruct()) {
438
- _construct = Reflect.construct.bind();
439
- } else {
440
- _construct = function _construct(Parent, args, Class) {
441
- var a = [null];
442
- a.push.apply(a, args);
443
- var Constructor = Function.bind.apply(Parent, a);
444
- var instance = new Constructor();
445
- if (Class) _setPrototypeOf(instance, Class.prototype);
446
- return instance;
447
- };
448
- }
449
- return _construct.apply(null, arguments);
450
- }
451
- function _isNativeFunction(fn) {
452
- return Function.toString.call(fn).indexOf("[native code]") !== -1;
453
- }
454
- function _wrapNativeSuper(Class) {
455
- var _cache = typeof Map === "function" ? new Map() : undefined;
456
- _wrapNativeSuper = function _wrapNativeSuper(Class) {
457
- if (Class === null || !_isNativeFunction(Class)) return Class;
458
- if (typeof Class !== "function") {
459
- throw new TypeError("Super expression must either be null or a function");
460
- }
461
- if (typeof _cache !== "undefined") {
462
- if (_cache.has(Class)) return _cache.get(Class);
463
- _cache.set(Class, Wrapper);
464
- }
465
- function Wrapper() {
466
- return _construct(Class, arguments, _getPrototypeOf(this).constructor);
467
- }
468
- Wrapper.prototype = Object.create(Class.prototype, {
469
- constructor: {
470
- value: Wrapper,
471
- enumerable: false,
472
- writable: true,
473
- configurable: true
474
- }
475
- });
476
- return _setPrototypeOf(Wrapper, Class);
477
- };
478
- return _wrapNativeSuper(Class);
479
- }
480
- function _assertThisInitialized(self) {
481
- if (self === void 0) {
482
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
483
- }
484
- return self;
485
- }
486
- function _possibleConstructorReturn(self, call) {
487
- if (call && (typeof call === "object" || typeof call === "function")) {
488
- return call;
489
- } else if (call !== void 0) {
490
- throw new TypeError("Derived constructors may only return object or undefined");
491
- }
492
- return _assertThisInitialized(self);
493
- }
494
- function _createSuper(Derived) {
495
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
496
- return function _createSuperInternal() {
497
- var Super = _getPrototypeOf(Derived),
498
- result;
499
- if (hasNativeReflectConstruct) {
500
- var NewTarget = _getPrototypeOf(this).constructor;
501
- result = Reflect.construct(Super, arguments, NewTarget);
502
- } else {
503
- result = Super.apply(this, arguments);
504
- }
505
- return _possibleConstructorReturn(this, result);
506
- };
507
- }
508
- function _toPrimitive(input, hint) {
509
- if (typeof input !== "object" || input === null) return input;
510
- var prim = input[Symbol.toPrimitive];
511
- if (prim !== undefined) {
512
- var res = prim.call(input, hint || "default");
513
- if (typeof res !== "object") return res;
514
- throw new TypeError("@@toPrimitive must return a primitive value.");
515
- }
516
- return (hint === "string" ? String : Number)(input);
517
- }
518
- function _toPropertyKey(arg) {
519
- var key = _toPrimitive(arg, "string");
520
- return typeof key === "symbol" ? key : String(key);
521
- }
522
-
523
- /**
524
- * @module lib/functions
525
- */
526
-
527
- /**
528
- * Check to see this is a node environment.
529
- * @type {Boolean}
530
- */
531
- /* global global */
532
- var isNode = typeof __webpack_require__.g !== 'undefined' && {}.toString.call(__webpack_require__.g) === '[object global]';
533
-
534
- /**
535
- * Get the name of the method for a given getter or setter.
536
- *
537
- * @param {string} prop The name of the property.
538
- * @param {string} type Either “get” or “set”.
539
- * @return {string}
540
- */
541
- function getMethodName(prop, type) {
542
- if (prop.indexOf(type.toLowerCase()) === 0) {
543
- return prop;
544
- }
545
- return "".concat(type.toLowerCase()).concat(prop.substr(0, 1).toUpperCase()).concat(prop.substr(1));
546
- }
547
-
548
- /**
549
- * Check to see if the object is a DOM Element.
550
- *
551
- * @param {*} element The object to check.
552
- * @return {boolean}
553
- */
554
- function isDomElement(element) {
555
- return Boolean(element && element.nodeType === 1 && 'nodeName' in element && element.ownerDocument && element.ownerDocument.defaultView);
556
- }
557
-
558
- /**
559
- * Check to see whether the value is a number.
560
- *
561
- * @see http://dl.dropboxusercontent.com/u/35146/js/tests/isNumber.html
562
- * @param {*} value The value to check.
563
- * @param {boolean} integer Check if the value is an integer.
564
- * @return {boolean}
565
- */
566
- function isInteger(value) {
567
- // eslint-disable-next-line eqeqeq
568
- return !isNaN(parseFloat(value)) && isFinite(value) && Math.floor(value) == value;
569
- }
570
-
571
- /**
572
- * Check to see if the URL is a Vimeo url.
573
- *
574
- * @param {string} url The url string.
575
- * @return {boolean}
576
- */
577
- function isVimeoUrl(url) {
578
- return /^(https?:)?\/\/((((player|www)\.)?vimeo\.com)|((player\.)?[a-zA-Z0-9-]+\.(videoji\.(hk|cn)|vimeo\.work)))(?=$|\/)/.test(url);
579
- }
580
-
581
- /**
582
- * Check to see if the URL is for a Vimeo embed.
583
- *
584
- * @param {string} url The url string.
585
- * @return {boolean}
586
- */
587
- function isVimeoEmbed(url) {
588
- var expr = /^https:\/\/player\.((vimeo\.com)|([a-zA-Z0-9-]+\.(videoji\.(hk|cn)|vimeo\.work)))\/video\/\d+/;
589
- return expr.test(url);
590
- }
591
- function getOembedDomain(url) {
592
- var match = (url || '').match(/^(?:https?:)?(?:\/\/)?([^/?]+)/);
593
- var domain = (match && match[1] || '').replace('player.', '');
594
- var customDomains = ['.videoji.hk', '.vimeo.work', '.videoji.cn'];
595
- for (var _i = 0, _customDomains = customDomains; _i < _customDomains.length; _i++) {
596
- var customDomain = _customDomains[_i];
597
- if (domain.endsWith(customDomain)) {
598
- return domain;
599
- }
600
- }
601
- return 'vimeo.com';
602
- }
603
-
604
- /**
605
- * Get the Vimeo URL from an element.
606
- * The element must have either a data-vimeo-id or data-vimeo-url attribute.
607
- *
608
- * @param {object} oEmbedParameters The oEmbed parameters.
609
- * @return {string}
610
- */
611
- function getVimeoUrl() {
612
- var oEmbedParameters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
613
- var id = oEmbedParameters.id;
614
- var url = oEmbedParameters.url;
615
- var idOrUrl = id || url;
616
- if (!idOrUrl) {
617
- 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.');
618
- }
619
- if (isInteger(idOrUrl)) {
620
- return "https://vimeo.com/".concat(idOrUrl);
621
- }
622
- if (isVimeoUrl(idOrUrl)) {
623
- return idOrUrl.replace('http:', 'https:');
624
- }
625
- if (id) {
626
- throw new TypeError("\u201C".concat(id, "\u201D is not a valid video id."));
627
- }
628
- throw new TypeError("\u201C".concat(idOrUrl, "\u201D is not a vimeo.com url."));
629
- }
630
-
631
- /* eslint-disable max-params */
632
- /**
633
- * A utility method for attaching and detaching event handlers
634
- *
635
- * @param {EventTarget} target
636
- * @param {string | string[]} eventName
637
- * @param {function} callback
638
- * @param {'addEventListener' | 'on'} onName
639
- * @param {'removeEventListener' | 'off'} offName
640
- * @return {{cancel: (function(): void)}}
641
- */
642
- var subscribe = function subscribe(target, eventName, callback) {
643
- var onName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'addEventListener';
644
- var offName = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'removeEventListener';
645
- var eventNames = typeof eventName === 'string' ? [eventName] : eventName;
646
- eventNames.forEach(function (evName) {
647
- target[onName](evName, callback);
648
- });
649
- return {
650
- cancel: function cancel() {
651
- return eventNames.forEach(function (evName) {
652
- return target[offName](evName, callback);
653
- });
654
- }
655
- };
656
- };
657
-
658
- var arrayIndexOfSupport = typeof Array.prototype.indexOf !== 'undefined';
659
- var postMessageSupport = typeof window !== 'undefined' && typeof window.postMessage !== 'undefined';
660
- if (!isNode && (!arrayIndexOfSupport || !postMessageSupport)) {
661
- throw new Error('Sorry, the Vimeo Player API is not available in this browser.');
662
- }
663
-
664
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {};
665
-
666
- function createCommonjsModule(fn, module) {
667
- return module = { exports: {} }, fn(module, module.exports), module.exports;
668
- }
669
-
670
- /*!
671
- * weakmap-polyfill v2.0.4 - ECMAScript6 WeakMap polyfill
672
- * https://github.com/polygonplanet/weakmap-polyfill
673
- * Copyright (c) 2015-2021 polygonplanet <polygon.planet.aqua@gmail.com>
674
- * @license MIT
675
- */
676
-
677
- (function (self) {
678
-
679
- if (self.WeakMap) {
680
- return;
681
- }
682
- var hasOwnProperty = Object.prototype.hasOwnProperty;
683
- var hasDefine = Object.defineProperty && function () {
684
- try {
685
- // Avoid IE8's broken Object.defineProperty
686
- return Object.defineProperty({}, 'x', {
687
- value: 1
688
- }).x === 1;
689
- } catch (e) {}
690
- }();
691
- var defineProperty = function (object, name, value) {
692
- if (hasDefine) {
693
- Object.defineProperty(object, name, {
694
- configurable: true,
695
- writable: true,
696
- value: value
697
- });
698
- } else {
699
- object[name] = value;
700
- }
701
- };
702
- self.WeakMap = function () {
703
- // ECMA-262 23.3 WeakMap Objects
704
- function WeakMap() {
705
- if (this === void 0) {
706
- throw new TypeError("Constructor WeakMap requires 'new'");
707
- }
708
- defineProperty(this, '_id', genId('_WeakMap'));
709
-
710
- // ECMA-262 23.3.1.1 WeakMap([iterable])
711
- if (arguments.length > 0) {
712
- // Currently, WeakMap `iterable` argument is not supported
713
- throw new TypeError('WeakMap iterable is not supported');
714
- }
715
- }
716
-
717
- // ECMA-262 23.3.3.2 WeakMap.prototype.delete(key)
718
- defineProperty(WeakMap.prototype, 'delete', function (key) {
719
- checkInstance(this, 'delete');
720
- if (!isObject(key)) {
721
- return false;
722
- }
723
- var entry = key[this._id];
724
- if (entry && entry[0] === key) {
725
- delete key[this._id];
726
- return true;
727
- }
728
- return false;
729
- });
730
-
731
- // ECMA-262 23.3.3.3 WeakMap.prototype.get(key)
732
- defineProperty(WeakMap.prototype, 'get', function (key) {
733
- checkInstance(this, 'get');
734
- if (!isObject(key)) {
735
- return void 0;
736
- }
737
- var entry = key[this._id];
738
- if (entry && entry[0] === key) {
739
- return entry[1];
740
- }
741
- return void 0;
742
- });
743
-
744
- // ECMA-262 23.3.3.4 WeakMap.prototype.has(key)
745
- defineProperty(WeakMap.prototype, 'has', function (key) {
746
- checkInstance(this, 'has');
747
- if (!isObject(key)) {
748
- return false;
749
- }
750
- var entry = key[this._id];
751
- if (entry && entry[0] === key) {
752
- return true;
753
- }
754
- return false;
755
- });
756
-
757
- // ECMA-262 23.3.3.5 WeakMap.prototype.set(key, value)
758
- defineProperty(WeakMap.prototype, 'set', function (key, value) {
759
- checkInstance(this, 'set');
760
- if (!isObject(key)) {
761
- throw new TypeError('Invalid value used as weak map key');
762
- }
763
- var entry = key[this._id];
764
- if (entry && entry[0] === key) {
765
- entry[1] = value;
766
- return this;
767
- }
768
- defineProperty(key, this._id, [key, value]);
769
- return this;
770
- });
771
- function checkInstance(x, methodName) {
772
- if (!isObject(x) || !hasOwnProperty.call(x, '_id')) {
773
- throw new TypeError(methodName + ' method called on incompatible receiver ' + typeof x);
774
- }
775
- }
776
- function genId(prefix) {
777
- return prefix + '_' + rand() + '.' + rand();
778
- }
779
- function rand() {
780
- return Math.random().toString().substring(2);
781
- }
782
- defineProperty(WeakMap, '_polyfill', true);
783
- return WeakMap;
784
- }();
785
- function isObject(x) {
786
- return Object(x) === x;
787
- }
788
- })(typeof globalThis !== 'undefined' ? globalThis : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : commonjsGlobal);
789
-
790
- var npo_src = createCommonjsModule(function (module) {
791
- /*! Native Promise Only
792
- v0.8.1 (c) Kyle Simpson
793
- MIT License: http://getify.mit-license.org
794
- */
795
-
796
- (function UMD(name, context, definition) {
797
- // special form of UMD for polyfilling across evironments
798
- context[name] = context[name] || definition();
799
- if ( module.exports) {
800
- module.exports = context[name];
801
- }
802
- })("Promise", typeof commonjsGlobal != "undefined" ? commonjsGlobal : commonjsGlobal, function DEF() {
803
-
804
- var builtInProp,
805
- cycle,
806
- scheduling_queue,
807
- ToString = Object.prototype.toString,
808
- timer = typeof setImmediate != "undefined" ? function timer(fn) {
809
- return setImmediate(fn);
810
- } : setTimeout;
811
-
812
- // dammit, IE8.
813
- try {
814
- Object.defineProperty({}, "x", {});
815
- builtInProp = function builtInProp(obj, name, val, config) {
816
- return Object.defineProperty(obj, name, {
817
- value: val,
818
- writable: true,
819
- configurable: config !== false
820
- });
821
- };
822
- } catch (err) {
823
- builtInProp = function builtInProp(obj, name, val) {
824
- obj[name] = val;
825
- return obj;
826
- };
827
- }
828
-
829
- // Note: using a queue instead of array for efficiency
830
- scheduling_queue = function Queue() {
831
- var first, last, item;
832
- function Item(fn, self) {
833
- this.fn = fn;
834
- this.self = self;
835
- this.next = void 0;
836
- }
837
- return {
838
- add: function add(fn, self) {
839
- item = new Item(fn, self);
840
- if (last) {
841
- last.next = item;
842
- } else {
843
- first = item;
844
- }
845
- last = item;
846
- item = void 0;
847
- },
848
- drain: function drain() {
849
- var f = first;
850
- first = last = cycle = void 0;
851
- while (f) {
852
- f.fn.call(f.self);
853
- f = f.next;
854
- }
855
- }
856
- };
857
- }();
858
- function schedule(fn, self) {
859
- scheduling_queue.add(fn, self);
860
- if (!cycle) {
861
- cycle = timer(scheduling_queue.drain);
862
- }
863
- }
864
-
865
- // promise duck typing
866
- function isThenable(o) {
867
- var _then,
868
- o_type = typeof o;
869
- if (o != null && (o_type == "object" || o_type == "function")) {
870
- _then = o.then;
871
- }
872
- return typeof _then == "function" ? _then : false;
873
- }
874
- function notify() {
875
- for (var i = 0; i < this.chain.length; i++) {
876
- notifyIsolated(this, this.state === 1 ? this.chain[i].success : this.chain[i].failure, this.chain[i]);
877
- }
878
- this.chain.length = 0;
879
- }
880
-
881
- // NOTE: This is a separate function to isolate
882
- // the `try..catch` so that other code can be
883
- // optimized better
884
- function notifyIsolated(self, cb, chain) {
885
- var ret, _then;
886
- try {
887
- if (cb === false) {
888
- chain.reject(self.msg);
889
- } else {
890
- if (cb === true) {
891
- ret = self.msg;
892
- } else {
893
- ret = cb.call(void 0, self.msg);
894
- }
895
- if (ret === chain.promise) {
896
- chain.reject(TypeError("Promise-chain cycle"));
897
- } else if (_then = isThenable(ret)) {
898
- _then.call(ret, chain.resolve, chain.reject);
899
- } else {
900
- chain.resolve(ret);
901
- }
902
- }
903
- } catch (err) {
904
- chain.reject(err);
905
- }
906
- }
907
- function resolve(msg) {
908
- var _then,
909
- self = this;
910
-
911
- // already triggered?
912
- if (self.triggered) {
913
- return;
914
- }
915
- self.triggered = true;
916
-
917
- // unwrap
918
- if (self.def) {
919
- self = self.def;
920
- }
921
- try {
922
- if (_then = isThenable(msg)) {
923
- schedule(function () {
924
- var def_wrapper = new MakeDefWrapper(self);
925
- try {
926
- _then.call(msg, function $resolve$() {
927
- resolve.apply(def_wrapper, arguments);
928
- }, function $reject$() {
929
- reject.apply(def_wrapper, arguments);
930
- });
931
- } catch (err) {
932
- reject.call(def_wrapper, err);
933
- }
934
- });
935
- } else {
936
- self.msg = msg;
937
- self.state = 1;
938
- if (self.chain.length > 0) {
939
- schedule(notify, self);
940
- }
941
- }
942
- } catch (err) {
943
- reject.call(new MakeDefWrapper(self), err);
944
- }
945
- }
946
- function reject(msg) {
947
- var self = this;
948
-
949
- // already triggered?
950
- if (self.triggered) {
951
- return;
952
- }
953
- self.triggered = true;
954
-
955
- // unwrap
956
- if (self.def) {
957
- self = self.def;
958
- }
959
- self.msg = msg;
960
- self.state = 2;
961
- if (self.chain.length > 0) {
962
- schedule(notify, self);
963
- }
964
- }
965
- function iteratePromises(Constructor, arr, resolver, rejecter) {
966
- for (var idx = 0; idx < arr.length; idx++) {
967
- (function IIFE(idx) {
968
- Constructor.resolve(arr[idx]).then(function $resolver$(msg) {
969
- resolver(idx, msg);
970
- }, rejecter);
971
- })(idx);
972
- }
973
- }
974
- function MakeDefWrapper(self) {
975
- this.def = self;
976
- this.triggered = false;
977
- }
978
- function MakeDef(self) {
979
- this.promise = self;
980
- this.state = 0;
981
- this.triggered = false;
982
- this.chain = [];
983
- this.msg = void 0;
984
- }
985
- function Promise(executor) {
986
- if (typeof executor != "function") {
987
- throw TypeError("Not a function");
988
- }
989
- if (this.__NPO__ !== 0) {
990
- throw TypeError("Not a promise");
991
- }
992
-
993
- // instance shadowing the inherited "brand"
994
- // to signal an already "initialized" promise
995
- this.__NPO__ = 1;
996
- var def = new MakeDef(this);
997
- this["then"] = function then(success, failure) {
998
- var o = {
999
- success: typeof success == "function" ? success : true,
1000
- failure: typeof failure == "function" ? failure : false
1001
- };
1002
- // Note: `then(..)` itself can be borrowed to be used against
1003
- // a different promise constructor for making the chained promise,
1004
- // by substituting a different `this` binding.
1005
- o.promise = new this.constructor(function extractChain(resolve, reject) {
1006
- if (typeof resolve != "function" || typeof reject != "function") {
1007
- throw TypeError("Not a function");
1008
- }
1009
- o.resolve = resolve;
1010
- o.reject = reject;
1011
- });
1012
- def.chain.push(o);
1013
- if (def.state !== 0) {
1014
- schedule(notify, def);
1015
- }
1016
- return o.promise;
1017
- };
1018
- this["catch"] = function $catch$(failure) {
1019
- return this.then(void 0, failure);
1020
- };
1021
- try {
1022
- executor.call(void 0, function publicResolve(msg) {
1023
- resolve.call(def, msg);
1024
- }, function publicReject(msg) {
1025
- reject.call(def, msg);
1026
- });
1027
- } catch (err) {
1028
- reject.call(def, err);
1029
- }
1030
- }
1031
- var PromisePrototype = builtInProp({}, "constructor", Promise, /*configurable=*/false);
1032
-
1033
- // Note: Android 4 cannot use `Object.defineProperty(..)` here
1034
- Promise.prototype = PromisePrototype;
1035
-
1036
- // built-in "brand" to signal an "uninitialized" promise
1037
- builtInProp(PromisePrototype, "__NPO__", 0, /*configurable=*/false);
1038
- builtInProp(Promise, "resolve", function Promise$resolve(msg) {
1039
- var Constructor = this;
1040
-
1041
- // spec mandated checks
1042
- // note: best "isPromise" check that's practical for now
1043
- if (msg && typeof msg == "object" && msg.__NPO__ === 1) {
1044
- return msg;
1045
- }
1046
- return new Constructor(function executor(resolve, reject) {
1047
- if (typeof resolve != "function" || typeof reject != "function") {
1048
- throw TypeError("Not a function");
1049
- }
1050
- resolve(msg);
1051
- });
1052
- });
1053
- builtInProp(Promise, "reject", function Promise$reject(msg) {
1054
- return new this(function executor(resolve, reject) {
1055
- if (typeof resolve != "function" || typeof reject != "function") {
1056
- throw TypeError("Not a function");
1057
- }
1058
- reject(msg);
1059
- });
1060
- });
1061
- builtInProp(Promise, "all", function Promise$all(arr) {
1062
- var Constructor = this;
1063
-
1064
- // spec mandated checks
1065
- if (ToString.call(arr) != "[object Array]") {
1066
- return Constructor.reject(TypeError("Not an array"));
1067
- }
1068
- if (arr.length === 0) {
1069
- return Constructor.resolve([]);
1070
- }
1071
- return new Constructor(function executor(resolve, reject) {
1072
- if (typeof resolve != "function" || typeof reject != "function") {
1073
- throw TypeError("Not a function");
1074
- }
1075
- var len = arr.length,
1076
- msgs = Array(len),
1077
- count = 0;
1078
- iteratePromises(Constructor, arr, function resolver(idx, msg) {
1079
- msgs[idx] = msg;
1080
- if (++count === len) {
1081
- resolve(msgs);
1082
- }
1083
- }, reject);
1084
- });
1085
- });
1086
- builtInProp(Promise, "race", function Promise$race(arr) {
1087
- var Constructor = this;
1088
-
1089
- // spec mandated checks
1090
- if (ToString.call(arr) != "[object Array]") {
1091
- return Constructor.reject(TypeError("Not an array"));
1092
- }
1093
- return new Constructor(function executor(resolve, reject) {
1094
- if (typeof resolve != "function" || typeof reject != "function") {
1095
- throw TypeError("Not a function");
1096
- }
1097
- iteratePromises(Constructor, arr, function resolver(idx, msg) {
1098
- resolve(msg);
1099
- }, reject);
1100
- });
1101
- });
1102
- return Promise;
1103
- });
1104
- });
1105
-
1106
- /**
1107
- * @module lib/callbacks
1108
- */
1109
-
1110
- var callbackMap = new WeakMap();
1111
-
1112
- /**
1113
- * Store a callback for a method or event for a player.
1114
- *
1115
- * @param {Player} player The player object.
1116
- * @param {string} name The method or event name.
1117
- * @param {(function(this:Player, *): void|{resolve: function, reject: function})} callback
1118
- * The callback to call or an object with resolve and reject functions for a promise.
1119
- * @return {void}
1120
- */
1121
- function storeCallback(player, name, callback) {
1122
- var playerCallbacks = callbackMap.get(player.element) || {};
1123
- if (!(name in playerCallbacks)) {
1124
- playerCallbacks[name] = [];
1125
- }
1126
- playerCallbacks[name].push(callback);
1127
- callbackMap.set(player.element, playerCallbacks);
1128
- }
1129
-
1130
- /**
1131
- * Get the callbacks for a player and event or method.
1132
- *
1133
- * @param {Player} player The player object.
1134
- * @param {string} name The method or event name
1135
- * @return {function[]}
1136
- */
1137
- function getCallbacks(player, name) {
1138
- var playerCallbacks = callbackMap.get(player.element) || {};
1139
- return playerCallbacks[name] || [];
1140
- }
1141
-
1142
- /**
1143
- * Remove a stored callback for a method or event for a player.
1144
- *
1145
- * @param {Player} player The player object.
1146
- * @param {string} name The method or event name
1147
- * @param {function} [callback] The specific callback to remove.
1148
- * @return {boolean} Was this the last callback?
1149
- */
1150
- function removeCallback(player, name, callback) {
1151
- var playerCallbacks = callbackMap.get(player.element) || {};
1152
- if (!playerCallbacks[name]) {
1153
- return true;
1154
- }
1155
-
1156
- // If no callback is passed, remove all callbacks for the event
1157
- if (!callback) {
1158
- playerCallbacks[name] = [];
1159
- callbackMap.set(player.element, playerCallbacks);
1160
- return true;
1161
- }
1162
- var index = playerCallbacks[name].indexOf(callback);
1163
- if (index !== -1) {
1164
- playerCallbacks[name].splice(index, 1);
1165
- }
1166
- callbackMap.set(player.element, playerCallbacks);
1167
- return playerCallbacks[name] && playerCallbacks[name].length === 0;
1168
- }
1169
-
1170
- /**
1171
- * Return the first stored callback for a player and event or method.
1172
- *
1173
- * @param {Player} player The player object.
1174
- * @param {string} name The method or event name.
1175
- * @return {function} The callback, or false if there were none
1176
- */
1177
- function shiftCallbacks(player, name) {
1178
- var playerCallbacks = getCallbacks(player, name);
1179
- if (playerCallbacks.length < 1) {
1180
- return false;
1181
- }
1182
- var callback = playerCallbacks.shift();
1183
- removeCallback(player, name, callback);
1184
- return callback;
1185
- }
1186
-
1187
- /**
1188
- * Move callbacks associated with an element to another element.
1189
- *
1190
- * @param {HTMLElement} oldElement The old element.
1191
- * @param {HTMLElement} newElement The new element.
1192
- * @return {void}
1193
- */
1194
- function swapCallbacks(oldElement, newElement) {
1195
- var playerCallbacks = callbackMap.get(oldElement);
1196
- callbackMap.set(newElement, playerCallbacks);
1197
- callbackMap.delete(oldElement);
1198
- }
1199
-
1200
- /**
1201
- * @module lib/postmessage
1202
- */
1203
-
1204
- /**
1205
- * Parse a message received from postMessage.
1206
- *
1207
- * @param {*} data The data received from postMessage.
1208
- * @return {object}
1209
- */
1210
- function parseMessageData(data) {
1211
- if (typeof data === 'string') {
1212
- try {
1213
- data = JSON.parse(data);
1214
- } catch (error) {
1215
- // If the message cannot be parsed, throw the error as a warning
1216
- console.warn(error);
1217
- return {};
1218
- }
1219
- }
1220
- return data;
1221
- }
1222
-
1223
- /**
1224
- * Post a message to the specified target.
1225
- *
1226
- * @param {Player} player The player object to use.
1227
- * @param {string} method The API method to call.
1228
- * @param {string|number|object|Array|undefined} params The parameters to send to the player.
1229
- * @return {void}
1230
- */
1231
- function postMessage(player, method, params) {
1232
- if (!player.element.contentWindow || !player.element.contentWindow.postMessage) {
1233
- return;
1234
- }
1235
- var message = {
1236
- method: method
1237
- };
1238
- if (params !== undefined) {
1239
- message.value = params;
1240
- }
1241
-
1242
- // IE 8 and 9 do not support passing messages, so stringify them
1243
- var ieVersion = parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/, '$1'));
1244
- if (ieVersion >= 8 && ieVersion < 10) {
1245
- message = JSON.stringify(message);
1246
- }
1247
- player.element.contentWindow.postMessage(message, player.origin);
1248
- }
1249
-
1250
- /**
1251
- * Parse the data received from a message event.
1252
- *
1253
- * @param {Player} player The player that received the message.
1254
- * @param {(Object|string)} data The message data. Strings will be parsed into JSON.
1255
- * @return {void}
1256
- */
1257
- function processData(player, data) {
1258
- data = parseMessageData(data);
1259
- var callbacks = [];
1260
- var param;
1261
- if (data.event) {
1262
- if (data.event === 'error') {
1263
- var promises = getCallbacks(player, data.data.method);
1264
- promises.forEach(function (promise) {
1265
- var error = new Error(data.data.message);
1266
- error.name = data.data.name;
1267
- promise.reject(error);
1268
- removeCallback(player, data.data.method, promise);
1269
- });
1270
- }
1271
- callbacks = getCallbacks(player, "event:".concat(data.event));
1272
- param = data.data;
1273
- } else if (data.method) {
1274
- var callback = shiftCallbacks(player, data.method);
1275
- if (callback) {
1276
- callbacks.push(callback);
1277
- param = data.value;
1278
- }
1279
- }
1280
- callbacks.forEach(function (callback) {
1281
- try {
1282
- if (typeof callback === 'function') {
1283
- callback.call(player, param);
1284
- return;
1285
- }
1286
- callback.resolve(param);
1287
- } catch (e) {
1288
- // empty
1289
- }
1290
- });
1291
- }
1292
-
1293
- /**
1294
- * @module lib/embed
1295
- */
1296
- var oEmbedParameters = ['airplay', 'audio_tracks', 'audiotrack', 'autopause', 'autoplay', 'background', 'byline', 'cc', 'chapter_id', 'chapters', 'chromecast', 'color', 'colors', 'controls', 'dnt', 'end_time', 'fullscreen', 'height', 'id', 'initial_quality', 'interactive_params', 'keyboard', 'loop', 'maxheight', 'max_quality', 'maxwidth', 'min_quality', 'muted', 'play_button_position', 'playsinline', 'portrait', 'preload', 'progress_bar', 'quality', 'quality_selector', 'responsive', 'skipping_forward', 'speed', 'start_time', 'texttrack', 'thumbnail_id', 'title', 'transcript', 'transparent', 'unmute_button', 'url', 'vimeo_logo', 'volume', 'watch_full_video', 'width'];
1297
-
1298
- /**
1299
- * Get the 'data-vimeo'-prefixed attributes from an element as an object.
1300
- *
1301
- * @param {HTMLElement} element The element.
1302
- * @param {Object} [defaults={}] The default values to use.
1303
- * @return {Object<string, string>}
1304
- */
1305
- function getOEmbedParameters(element) {
1306
- var defaults = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1307
- return oEmbedParameters.reduce(function (params, param) {
1308
- var value = element.getAttribute("data-vimeo-".concat(param));
1309
- if (value || value === '') {
1310
- params[param] = value === '' ? 1 : value;
1311
- }
1312
- return params;
1313
- }, defaults);
1314
- }
1315
-
1316
- /**
1317
- * Create an embed from oEmbed data inside an element.
1318
- *
1319
- * @param {object} data The oEmbed data.
1320
- * @param {HTMLElement} element The element to put the iframe in.
1321
- * @return {HTMLIFrameElement} The iframe embed.
1322
- */
1323
- function createEmbed(_ref, element) {
1324
- var html = _ref.html;
1325
- if (!element) {
1326
- throw new TypeError('An element must be provided');
1327
- }
1328
- if (element.getAttribute('data-vimeo-initialized') !== null) {
1329
- return element.querySelector('iframe');
1330
- }
1331
- var div = document.createElement('div');
1332
- div.innerHTML = html;
1333
- element.appendChild(div.firstChild);
1334
- element.setAttribute('data-vimeo-initialized', 'true');
1335
- return element.querySelector('iframe');
1336
- }
1337
-
1338
- /**
1339
- * Make an oEmbed call for the specified URL.
1340
- *
1341
- * @param {string} videoUrl The vimeo.com url for the video.
1342
- * @param {Object} [params] Parameters to pass to oEmbed.
1343
- * @param {HTMLElement} element The element.
1344
- * @return {Promise}
1345
- */
1346
- function getOEmbedData(videoUrl) {
1347
- var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1348
- var element = arguments.length > 2 ? arguments[2] : undefined;
1349
- return new Promise(function (resolve, reject) {
1350
- if (!isVimeoUrl(videoUrl)) {
1351
- throw new TypeError("\u201C".concat(videoUrl, "\u201D is not a vimeo.com url."));
1352
- }
1353
- var domain = getOembedDomain(videoUrl);
1354
- var url = "https://".concat(domain, "/api/oembed.json?url=").concat(encodeURIComponent(videoUrl));
1355
- for (var param in params) {
1356
- if (params.hasOwnProperty(param)) {
1357
- url += "&".concat(param, "=").concat(encodeURIComponent(params[param]));
1358
- }
1359
- }
1360
- var xhr = 'XDomainRequest' in window ? new XDomainRequest() : new XMLHttpRequest();
1361
- xhr.open('GET', url, true);
1362
- xhr.onload = function () {
1363
- if (xhr.status === 404) {
1364
- reject(new Error("\u201C".concat(videoUrl, "\u201D was not found.")));
1365
- return;
1366
- }
1367
- if (xhr.status === 403) {
1368
- reject(new Error("\u201C".concat(videoUrl, "\u201D is not embeddable.")));
1369
- return;
1370
- }
1371
- try {
1372
- var json = JSON.parse(xhr.responseText);
1373
- // Check api response for 403 on oembed
1374
- if (json.domain_status_code === 403) {
1375
- // We still want to create the embed to give users visual feedback
1376
- createEmbed(json, element);
1377
- reject(new Error("\u201C".concat(videoUrl, "\u201D is not embeddable.")));
1378
- return;
1379
- }
1380
- resolve(json);
1381
- } catch (error) {
1382
- reject(error);
1383
- }
1384
- };
1385
- xhr.onerror = function () {
1386
- var status = xhr.status ? " (".concat(xhr.status, ")") : '';
1387
- reject(new Error("There was an error fetching the embed code from Vimeo".concat(status, ".")));
1388
- };
1389
- xhr.send();
1390
- });
1391
- }
1392
-
1393
- /**
1394
- * Initialize all embeds within a specific element
1395
- *
1396
- * @param {HTMLElement} [parent=document] The parent element.
1397
- * @return {void}
1398
- */
1399
- function initializeEmbeds() {
1400
- var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
1401
- var elements = [].slice.call(parent.querySelectorAll('[data-vimeo-id], [data-vimeo-url]'));
1402
- var handleError = function handleError(error) {
1403
- if ('console' in window && console.error) {
1404
- console.error("There was an error creating an embed: ".concat(error));
1405
- }
1406
- };
1407
- elements.forEach(function (element) {
1408
- try {
1409
- // Skip any that have data-vimeo-defer
1410
- if (element.getAttribute('data-vimeo-defer') !== null) {
1411
- return;
1412
- }
1413
- var params = getOEmbedParameters(element);
1414
- var url = getVimeoUrl(params);
1415
- getOEmbedData(url, params, element).then(function (data) {
1416
- return createEmbed(data, element);
1417
- }).catch(handleError);
1418
- } catch (error) {
1419
- handleError(error);
1420
- }
1421
- });
1422
- }
1423
-
1424
- /**
1425
- * Resize embeds when messaged by the player.
1426
- *
1427
- * @param {HTMLElement} [parent=document] The parent element.
1428
- * @return {void}
1429
- */
1430
- function resizeEmbeds() {
1431
- var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
1432
- // Prevent execution if users include the player.js script multiple times.
1433
- if (window.VimeoPlayerResizeEmbeds_) {
1434
- return;
1435
- }
1436
- window.VimeoPlayerResizeEmbeds_ = true;
1437
- var onMessage = function onMessage(event) {
1438
- if (!isVimeoUrl(event.origin)) {
1439
- return;
1440
- }
1441
-
1442
- // 'spacechange' is fired only on embeds with cards
1443
- if (!event.data || event.data.event !== 'spacechange') {
1444
- return;
1445
- }
1446
- var iframes = parent.querySelectorAll('iframe');
1447
- for (var i = 0; i < iframes.length; i++) {
1448
- if (iframes[i].contentWindow !== event.source) {
1449
- continue;
1450
- }
1451
-
1452
- // Change padding-bottom of the enclosing div to accommodate
1453
- // card carousel without distorting aspect ratio
1454
- var space = iframes[i].parentElement;
1455
- space.style.paddingBottom = "".concat(event.data.data[0].bottom, "px");
1456
- break;
1457
- }
1458
- };
1459
- window.addEventListener('message', onMessage);
1460
- }
1461
-
1462
- /**
1463
- * Add chapters to existing metadata for Google SEO
1464
- *
1465
- * @param {HTMLElement} [parent=document] The parent element.
1466
- * @return {void}
1467
- */
1468
- function initAppendVideoMetadata() {
1469
- var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
1470
- // Prevent execution if users include the player.js script multiple times.
1471
- if (window.VimeoSeoMetadataAppended) {
1472
- return;
1473
- }
1474
- window.VimeoSeoMetadataAppended = true;
1475
- var onMessage = function onMessage(event) {
1476
- if (!isVimeoUrl(event.origin)) {
1477
- return;
1478
- }
1479
- var data = parseMessageData(event.data);
1480
- if (!data || data.event !== 'ready') {
1481
- return;
1482
- }
1483
- var iframes = parent.querySelectorAll('iframe');
1484
- for (var i = 0; i < iframes.length; i++) {
1485
- var iframe = iframes[i];
1486
-
1487
- // Initiate appendVideoMetadata if iframe is a Vimeo embed
1488
- var isValidMessageSource = iframe.contentWindow === event.source;
1489
- if (isVimeoEmbed(iframe.src) && isValidMessageSource) {
1490
- var player = new Player(iframe);
1491
- player.callMethod('appendVideoMetadata', window.location.href);
1492
- }
1493
- }
1494
- };
1495
- window.addEventListener('message', onMessage);
1496
- }
1497
-
1498
- /**
1499
- * Seek to time indicated by vimeo_t query parameter if present in URL
1500
- *
1501
- * @param {HTMLElement} [parent=document] The parent element.
1502
- * @return {void}
1503
- */
1504
- function checkUrlTimeParam() {
1505
- var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
1506
- // Prevent execution if users include the player.js script multiple times.
1507
- if (window.VimeoCheckedUrlTimeParam) {
1508
- return;
1509
- }
1510
- window.VimeoCheckedUrlTimeParam = true;
1511
- var handleError = function handleError(error) {
1512
- if ('console' in window && console.error) {
1513
- console.error("There was an error getting video Id: ".concat(error));
1514
- }
1515
- };
1516
- var onMessage = function onMessage(event) {
1517
- if (!isVimeoUrl(event.origin)) {
1518
- return;
1519
- }
1520
- var data = parseMessageData(event.data);
1521
- if (!data || data.event !== 'ready') {
1522
- return;
1523
- }
1524
- var iframes = parent.querySelectorAll('iframe');
1525
- var _loop = function _loop() {
1526
- var iframe = iframes[i];
1527
- var isValidMessageSource = iframe.contentWindow === event.source;
1528
- if (isVimeoEmbed(iframe.src) && isValidMessageSource) {
1529
- var player = new Player(iframe);
1530
- player.getVideoId().then(function (videoId) {
1531
- var matches = new RegExp("[?&]vimeo_t_".concat(videoId, "=([^&#]*)")).exec(window.location.href);
1532
- if (matches && matches[1]) {
1533
- var sec = decodeURI(matches[1]);
1534
- player.setCurrentTime(sec);
1535
- }
1536
- return;
1537
- }).catch(handleError);
1538
- }
1539
- };
1540
- for (var i = 0; i < iframes.length; i++) {
1541
- _loop();
1542
- }
1543
- };
1544
- window.addEventListener('message', onMessage);
1545
- }
1546
-
1547
- /* MIT License
1548
-
1549
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
1550
-
1551
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1552
-
1553
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1554
-
1555
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1556
- Terms */
1557
-
1558
- function initializeScreenfull() {
1559
- var fn = function () {
1560
- var val;
1561
- var fnMap = [['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror'],
1562
- // New WebKit
1563
- ['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror'],
1564
- // Old WebKit
1565
- ['webkitRequestFullScreen', 'webkitCancelFullScreen', 'webkitCurrentFullScreenElement', 'webkitCancelFullScreen', 'webkitfullscreenchange', 'webkitfullscreenerror'], ['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror'], ['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError']];
1566
- var i = 0;
1567
- var l = fnMap.length;
1568
- var ret = {};
1569
- for (; i < l; i++) {
1570
- val = fnMap[i];
1571
- if (val && val[1] in document) {
1572
- for (i = 0; i < val.length; i++) {
1573
- ret[fnMap[0][i]] = val[i];
1574
- }
1575
- return ret;
1576
- }
1577
- }
1578
- return false;
1579
- }();
1580
- var eventNameMap = {
1581
- fullscreenchange: fn.fullscreenchange,
1582
- fullscreenerror: fn.fullscreenerror
1583
- };
1584
- var screenfull = {
1585
- request: function request(element) {
1586
- return new Promise(function (resolve, reject) {
1587
- var onFullScreenEntered = function onFullScreenEntered() {
1588
- screenfull.off('fullscreenchange', onFullScreenEntered);
1589
- resolve();
1590
- };
1591
- screenfull.on('fullscreenchange', onFullScreenEntered);
1592
- element = element || document.documentElement;
1593
- var returnPromise = element[fn.requestFullscreen]();
1594
- if (returnPromise instanceof Promise) {
1595
- returnPromise.then(onFullScreenEntered).catch(reject);
1596
- }
1597
- });
1598
- },
1599
- exit: function exit() {
1600
- return new Promise(function (resolve, reject) {
1601
- if (!screenfull.isFullscreen) {
1602
- resolve();
1603
- return;
1604
- }
1605
- var onFullScreenExit = function onFullScreenExit() {
1606
- screenfull.off('fullscreenchange', onFullScreenExit);
1607
- resolve();
1608
- };
1609
- screenfull.on('fullscreenchange', onFullScreenExit);
1610
- var returnPromise = document[fn.exitFullscreen]();
1611
- if (returnPromise instanceof Promise) {
1612
- returnPromise.then(onFullScreenExit).catch(reject);
1613
- }
1614
- });
1615
- },
1616
- on: function on(event, callback) {
1617
- var eventName = eventNameMap[event];
1618
- if (eventName) {
1619
- document.addEventListener(eventName, callback);
1620
- }
1621
- },
1622
- off: function off(event, callback) {
1623
- var eventName = eventNameMap[event];
1624
- if (eventName) {
1625
- document.removeEventListener(eventName, callback);
1626
- }
1627
- }
1628
- };
1629
- Object.defineProperties(screenfull, {
1630
- isFullscreen: {
1631
- get: function get() {
1632
- return Boolean(document[fn.fullscreenElement]);
1633
- }
1634
- },
1635
- element: {
1636
- enumerable: true,
1637
- get: function get() {
1638
- return document[fn.fullscreenElement];
1639
- }
1640
- },
1641
- isEnabled: {
1642
- enumerable: true,
1643
- get: function get() {
1644
- // Coerce to boolean in case of old WebKit
1645
- return Boolean(document[fn.fullscreenEnabled]);
1646
- }
1647
- }
1648
- });
1649
- return screenfull;
1650
- }
1651
-
1652
- /** @typedef {import('./timing-src-connector.types').PlayerControls} PlayerControls */
1653
- /** @typedef {import('./timing-object.types').TimingObject} TimingObject */
1654
- /** @typedef {import('./timing-src-connector.types').TimingSrcConnectorOptions} TimingSrcConnectorOptions */
1655
- /** @typedef {(msg: string) => any} Logger */
1656
- /** @typedef {import('timing-object.types').TConnectionState} TConnectionState */
1657
-
1658
- /**
1659
- * @type {TimingSrcConnectorOptions}
1660
- *
1661
- * For details on these properties and their effects, see the typescript definition referenced above.
1662
- */
1663
- var defaultOptions = {
1664
- role: 'viewer',
1665
- autoPlayMuted: true,
1666
- allowedDrift: 0.3,
1667
- maxAllowedDrift: 1,
1668
- minCheckInterval: 0.1,
1669
- maxRateAdjustment: 0.2,
1670
- maxTimeToCatchUp: 1
1671
- };
1672
-
1673
- /**
1674
- * There's a proposed W3C spec for the Timing Object which would introduce a new set of APIs that would simplify time-synchronization tasks for browser applications.
1675
- *
1676
- * Proposed spec: https://webtiming.github.io/timingobject/
1677
- * V3 Spec: https://timingsrc.readthedocs.io/en/latest/
1678
- * Demuxed talk: https://www.youtube.com/watch?v=cZSjDaGDmX8
1679
- *
1680
- * This class makes it easy to connect Vimeo.Player to a provided TimingObject via Vimeo.Player.setTimingSrc(myTimingObject, options) and the synchronization will be handled automatically.
1681
- *
1682
- * There are 5 general responsibilities in TimingSrcConnector:
1683
- *
1684
- * 1. `updatePlayer()` which sets the player's currentTime, playbackRate and pause/play state based on current state of the TimingObject.
1685
- * 2. `updateTimingObject()` which sets the TimingObject's position and velocity from the player's state.
1686
- * 3. `playerUpdater` which listens for change events on the TimingObject and will respond by calling updatePlayer.
1687
- * 4. `timingObjectUpdater` which listens to the player events of seeked, play and pause and will respond by calling `updateTimingObject()`.
1688
- * 5. `maintainPlaybackPosition` this is code that constantly monitors the player to make sure it's always in sync with the TimingObject. This is needed because videos will generally not play with precise time accuracy and there will be some drift which becomes more noticeable over longer periods (as noted in the timing-object spec). More details on this method below.
1689
- */
1690
- var TimingSrcConnector = /*#__PURE__*/function (_EventTarget) {
1691
- _inherits(TimingSrcConnector, _EventTarget);
1692
- var _super = _createSuper(TimingSrcConnector);
1693
- /**
1694
- * @param {PlayerControls} player
1695
- * @param {TimingObject} timingObject
1696
- * @param {TimingSrcConnectorOptions} options
1697
- * @param {Logger} logger
1698
- */
1699
- function TimingSrcConnector(_player, timingObject) {
1700
- var _this;
1701
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1702
- var logger = arguments.length > 3 ? arguments[3] : undefined;
1703
- _classCallCheck(this, TimingSrcConnector);
1704
- _this = _super.call(this);
1705
- _defineProperty(_assertThisInitialized(_this), "logger", void 0);
1706
- _defineProperty(_assertThisInitialized(_this), "speedAdjustment", 0);
1707
- /**
1708
- * @param {PlayerControls} player
1709
- * @param {number} newAdjustment
1710
- * @return {Promise<void>}
1711
- */
1712
- _defineProperty(_assertThisInitialized(_this), "adjustSpeed", /*#__PURE__*/function () {
1713
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(player, newAdjustment) {
1714
- var newPlaybackRate;
1715
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1716
- while (1) switch (_context.prev = _context.next) {
1717
- case 0:
1718
- if (!(_this.speedAdjustment === newAdjustment)) {
1719
- _context.next = 2;
1720
- break;
1721
- }
1722
- return _context.abrupt("return");
1723
- case 2:
1724
- _context.next = 4;
1725
- return player.getPlaybackRate();
1726
- case 4:
1727
- _context.t0 = _context.sent;
1728
- _context.t1 = _this.speedAdjustment;
1729
- _context.t2 = _context.t0 - _context.t1;
1730
- _context.t3 = newAdjustment;
1731
- newPlaybackRate = _context.t2 + _context.t3;
1732
- _this.log("New playbackRate: ".concat(newPlaybackRate));
1733
- _context.next = 12;
1734
- return player.setPlaybackRate(newPlaybackRate);
1735
- case 12:
1736
- _this.speedAdjustment = newAdjustment;
1737
- case 13:
1738
- case "end":
1739
- return _context.stop();
1740
- }
1741
- }, _callee);
1742
- }));
1743
- return function (_x, _x2) {
1744
- return _ref.apply(this, arguments);
1745
- };
1746
- }());
1747
- _this.logger = logger;
1748
- _this.init(timingObject, _player, _objectSpread2(_objectSpread2({}, defaultOptions), options));
1749
- return _this;
1750
- }
1751
- _createClass(TimingSrcConnector, [{
1752
- key: "disconnect",
1753
- value: function disconnect() {
1754
- this.dispatchEvent(new Event('disconnect'));
1755
- }
1756
-
1757
- /**
1758
- * @param {TimingObject} timingObject
1759
- * @param {PlayerControls} player
1760
- * @param {TimingSrcConnectorOptions} options
1761
- * @return {Promise<void>}
1762
- */
1763
- }, {
1764
- key: "init",
1765
- value: function () {
1766
- var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(timingObject, player, options) {
1767
- var _this2 = this;
1768
- var playerUpdater, positionSync, timingObjectUpdater;
1769
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1770
- while (1) switch (_context2.prev = _context2.next) {
1771
- case 0:
1772
- _context2.next = 2;
1773
- return this.waitForTOReadyState(timingObject, 'open');
1774
- case 2:
1775
- if (!(options.role === 'viewer')) {
1776
- _context2.next = 10;
1777
- break;
1778
- }
1779
- _context2.next = 5;
1780
- return this.updatePlayer(timingObject, player, options);
1781
- case 5:
1782
- playerUpdater = subscribe(timingObject, 'change', function () {
1783
- return _this2.updatePlayer(timingObject, player, options);
1784
- });
1785
- positionSync = this.maintainPlaybackPosition(timingObject, player, options);
1786
- this.addEventListener('disconnect', function () {
1787
- positionSync.cancel();
1788
- playerUpdater.cancel();
1789
- });
1790
- _context2.next = 14;
1791
- break;
1792
- case 10:
1793
- _context2.next = 12;
1794
- return this.updateTimingObject(timingObject, player);
1795
- case 12:
1796
- timingObjectUpdater = subscribe(player, ['seeked', 'play', 'pause', 'ratechange'], function () {
1797
- return _this2.updateTimingObject(timingObject, player);
1798
- }, 'on', 'off');
1799
- this.addEventListener('disconnect', function () {
1800
- return timingObjectUpdater.cancel();
1801
- });
1802
- case 14:
1803
- case "end":
1804
- return _context2.stop();
1805
- }
1806
- }, _callee2, this);
1807
- }));
1808
- function init(_x3, _x4, _x5) {
1809
- return _init.apply(this, arguments);
1810
- }
1811
- return init;
1812
- }()
1813
- /**
1814
- * Sets the TimingObject's state to reflect that of the player
1815
- *
1816
- * @param {TimingObject} timingObject
1817
- * @param {PlayerControls} player
1818
- * @return {Promise<void>}
1819
- */
1820
- }, {
1821
- key: "updateTimingObject",
1822
- value: function () {
1823
- var _updateTimingObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(timingObject, player) {
1824
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1825
- while (1) switch (_context3.prev = _context3.next) {
1826
- case 0:
1827
- _context3.t0 = timingObject;
1828
- _context3.next = 3;
1829
- return player.getCurrentTime();
1830
- case 3:
1831
- _context3.t1 = _context3.sent;
1832
- _context3.next = 6;
1833
- return player.getPaused();
1834
- case 6:
1835
- if (!_context3.sent) {
1836
- _context3.next = 10;
1837
- break;
1838
- }
1839
- _context3.t2 = 0;
1840
- _context3.next = 13;
1841
- break;
1842
- case 10:
1843
- _context3.next = 12;
1844
- return player.getPlaybackRate();
1845
- case 12:
1846
- _context3.t2 = _context3.sent;
1847
- case 13:
1848
- _context3.t3 = _context3.t2;
1849
- _context3.t4 = {
1850
- position: _context3.t1,
1851
- velocity: _context3.t3
1852
- };
1853
- _context3.t0.update.call(_context3.t0, _context3.t4);
1854
- case 16:
1855
- case "end":
1856
- return _context3.stop();
1857
- }
1858
- }, _callee3);
1859
- }));
1860
- function updateTimingObject(_x6, _x7) {
1861
- return _updateTimingObject.apply(this, arguments);
1862
- }
1863
- return updateTimingObject;
1864
- }()
1865
- /**
1866
- * Sets the player's timing state to reflect that of the TimingObject
1867
- *
1868
- * @param {TimingObject} timingObject
1869
- * @param {PlayerControls} player
1870
- * @param {TimingSrcConnectorOptions} options
1871
- * @return {Promise<void>}
1872
- */
1873
- }, {
1874
- key: "updatePlayer",
1875
- value: function () {
1876
- var _updatePlayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(timingObject, player, options) {
1877
- var _timingObject$query, position, velocity;
1878
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1879
- while (1) switch (_context5.prev = _context5.next) {
1880
- case 0:
1881
- _timingObject$query = timingObject.query(), position = _timingObject$query.position, velocity = _timingObject$query.velocity;
1882
- if (typeof position === 'number') {
1883
- player.setCurrentTime(position);
1884
- }
1885
- if (!(typeof velocity === 'number')) {
1886
- _context5.next = 25;
1887
- break;
1888
- }
1889
- if (!(velocity === 0)) {
1890
- _context5.next = 11;
1891
- break;
1892
- }
1893
- _context5.next = 6;
1894
- return player.getPaused();
1895
- case 6:
1896
- _context5.t0 = _context5.sent;
1897
- if (!(_context5.t0 === false)) {
1898
- _context5.next = 9;
1899
- break;
1900
- }
1901
- player.pause();
1902
- case 9:
1903
- _context5.next = 25;
1904
- break;
1905
- case 11:
1906
- if (!(velocity > 0)) {
1907
- _context5.next = 25;
1908
- break;
1909
- }
1910
- _context5.next = 14;
1911
- return player.getPaused();
1912
- case 14:
1913
- _context5.t1 = _context5.sent;
1914
- if (!(_context5.t1 === true)) {
1915
- _context5.next = 19;
1916
- break;
1917
- }
1918
- _context5.next = 18;
1919
- return player.play().catch( /*#__PURE__*/function () {
1920
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(err) {
1921
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1922
- while (1) switch (_context4.prev = _context4.next) {
1923
- case 0:
1924
- if (!(err.name === 'NotAllowedError' && options.autoPlayMuted)) {
1925
- _context4.next = 5;
1926
- break;
1927
- }
1928
- _context4.next = 3;
1929
- return player.setMuted(true);
1930
- case 3:
1931
- _context4.next = 5;
1932
- return player.play().catch(function (err2) {
1933
- return console.error('Couldn\'t play the video from TimingSrcConnector. Error:', err2);
1934
- });
1935
- case 5:
1936
- case "end":
1937
- return _context4.stop();
1938
- }
1939
- }, _callee4);
1940
- }));
1941
- return function (_x11) {
1942
- return _ref2.apply(this, arguments);
1943
- };
1944
- }());
1945
- case 18:
1946
- this.updatePlayer(timingObject, player, options);
1947
- case 19:
1948
- _context5.next = 21;
1949
- return player.getPlaybackRate();
1950
- case 21:
1951
- _context5.t2 = _context5.sent;
1952
- _context5.t3 = velocity;
1953
- if (!(_context5.t2 !== _context5.t3)) {
1954
- _context5.next = 25;
1955
- break;
1956
- }
1957
- player.setPlaybackRate(velocity);
1958
- case 25:
1959
- case "end":
1960
- return _context5.stop();
1961
- }
1962
- }, _callee5, this);
1963
- }));
1964
- function updatePlayer(_x8, _x9, _x10) {
1965
- return _updatePlayer.apply(this, arguments);
1966
- }
1967
- return updatePlayer;
1968
- }()
1969
- /**
1970
- * Since video players do not play with 100% time precision, we need to closely monitor
1971
- * our player to be sure it remains in sync with the TimingObject.
1972
- *
1973
- * If out of sync, we use the current conditions and the options provided to determine
1974
- * whether to re-sync via setting currentTime or adjusting the playbackRate
1975
- *
1976
- * @param {TimingObject} timingObject
1977
- * @param {PlayerControls} player
1978
- * @param {TimingSrcConnectorOptions} options
1979
- * @return {{cancel: (function(): void)}}
1980
- */
1981
- }, {
1982
- key: "maintainPlaybackPosition",
1983
- value: function maintainPlaybackPosition(timingObject, player, options) {
1984
- var _this3 = this;
1985
- var allowedDrift = options.allowedDrift,
1986
- maxAllowedDrift = options.maxAllowedDrift,
1987
- minCheckInterval = options.minCheckInterval,
1988
- maxRateAdjustment = options.maxRateAdjustment,
1989
- maxTimeToCatchUp = options.maxTimeToCatchUp;
1990
- var syncInterval = Math.min(maxTimeToCatchUp, Math.max(minCheckInterval, maxAllowedDrift)) * 1000;
1991
- var check = /*#__PURE__*/function () {
1992
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
1993
- var diff, diffAbs, min, max, adjustment;
1994
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1995
- while (1) switch (_context6.prev = _context6.next) {
1996
- case 0:
1997
- _context6.t0 = timingObject.query().velocity === 0;
1998
- if (_context6.t0) {
1999
- _context6.next = 6;
2000
- break;
2001
- }
2002
- _context6.next = 4;
2003
- return player.getPaused();
2004
- case 4:
2005
- _context6.t1 = _context6.sent;
2006
- _context6.t0 = _context6.t1 === true;
2007
- case 6:
2008
- if (!_context6.t0) {
2009
- _context6.next = 8;
2010
- break;
2011
- }
2012
- return _context6.abrupt("return");
2013
- case 8:
2014
- _context6.t2 = timingObject.query().position;
2015
- _context6.next = 11;
2016
- return player.getCurrentTime();
2017
- case 11:
2018
- _context6.t3 = _context6.sent;
2019
- diff = _context6.t2 - _context6.t3;
2020
- diffAbs = Math.abs(diff);
2021
- _this3.log("Drift: ".concat(diff));
2022
- if (!(diffAbs > maxAllowedDrift)) {
2023
- _context6.next = 22;
2024
- break;
2025
- }
2026
- _context6.next = 18;
2027
- return _this3.adjustSpeed(player, 0);
2028
- case 18:
2029
- player.setCurrentTime(timingObject.query().position);
2030
- _this3.log('Resync by currentTime');
2031
- _context6.next = 29;
2032
- break;
2033
- case 22:
2034
- if (!(diffAbs > allowedDrift)) {
2035
- _context6.next = 29;
2036
- break;
2037
- }
2038
- min = diffAbs / maxTimeToCatchUp;
2039
- max = maxRateAdjustment;
2040
- adjustment = min < max ? (max - min) / 2 : max;
2041
- _context6.next = 28;
2042
- return _this3.adjustSpeed(player, adjustment * Math.sign(diff));
2043
- case 28:
2044
- _this3.log('Resync by playbackRate');
2045
- case 29:
2046
- case "end":
2047
- return _context6.stop();
2048
- }
2049
- }, _callee6);
2050
- }));
2051
- return function check() {
2052
- return _ref3.apply(this, arguments);
2053
- };
2054
- }();
2055
- var interval = setInterval(function () {
2056
- return check();
2057
- }, syncInterval);
2058
- return {
2059
- cancel: function cancel() {
2060
- return clearInterval(interval);
2061
- }
2062
- };
2063
- }
2064
-
2065
- /**
2066
- * @param {string} msg
2067
- */
2068
- }, {
2069
- key: "log",
2070
- value: function log(msg) {
2071
- var _this$logger;
2072
- (_this$logger = this.logger) === null || _this$logger === void 0 ? void 0 : _this$logger.call(this, "TimingSrcConnector: ".concat(msg));
2073
- }
2074
- }, {
2075
- key: "waitForTOReadyState",
2076
- value:
2077
- /**
2078
- * @param {TimingObject} timingObject
2079
- * @param {TConnectionState} state
2080
- * @return {Promise<void>}
2081
- */
2082
- function waitForTOReadyState(timingObject, state) {
2083
- return new Promise(function (resolve) {
2084
- var check = function check() {
2085
- if (timingObject.readyState === state) {
2086
- resolve();
2087
- } else {
2088
- timingObject.addEventListener('readystatechange', check, {
2089
- once: true
2090
- });
2091
- }
2092
- };
2093
- check();
2094
- });
2095
- }
2096
- }]);
2097
- return TimingSrcConnector;
2098
- }( /*#__PURE__*/_wrapNativeSuper(EventTarget));
2099
-
2100
- var playerMap = new WeakMap();
2101
- var readyMap = new WeakMap();
2102
- var screenfull = {};
2103
- var Player = /*#__PURE__*/function () {
2104
- /**
2105
- * Create a Player.
2106
- *
2107
- * @param {(HTMLIFrameElement|HTMLElement|string|jQuery)} element A reference to the Vimeo
2108
- * player iframe, and id, or a jQuery object.
2109
- * @param {object} [options] oEmbed parameters to use when creating an embed in the element.
2110
- * @return {Player}
2111
- */
2112
- function Player(element) {
2113
- var _this = this;
2114
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2115
- _classCallCheck(this, Player);
2116
- /* global jQuery */
2117
- if (window.jQuery && element instanceof jQuery) {
2118
- if (element.length > 1 && window.console && console.warn) {
2119
- console.warn('A jQuery object with multiple elements was passed, using the first element.');
2120
- }
2121
- element = element[0];
2122
- }
2123
-
2124
- // Find an element by ID
2125
- if (typeof document !== 'undefined' && typeof element === 'string') {
2126
- element = document.getElementById(element);
2127
- }
2128
-
2129
- // Not an element!
2130
- if (!isDomElement(element)) {
2131
- throw new TypeError('You must pass either a valid element or a valid id.');
2132
- }
2133
-
2134
- // Already initialized an embed in this div, so grab the iframe
2135
- if (element.nodeName !== 'IFRAME') {
2136
- var iframe = element.querySelector('iframe');
2137
- if (iframe) {
2138
- element = iframe;
2139
- }
2140
- }
2141
-
2142
- // iframe url is not a Vimeo url
2143
- if (element.nodeName === 'IFRAME' && !isVimeoUrl(element.getAttribute('src') || '')) {
2144
- throw new Error('The player element passed isn’t a Vimeo embed.');
2145
- }
2146
-
2147
- // If there is already a player object in the map, return that
2148
- if (playerMap.has(element)) {
2149
- return playerMap.get(element);
2150
- }
2151
- this._window = element.ownerDocument.defaultView;
2152
- this.element = element;
2153
- this.origin = '*';
2154
- var readyPromise = new npo_src(function (resolve, reject) {
2155
- _this._onMessage = function (event) {
2156
- if (!isVimeoUrl(event.origin) || _this.element.contentWindow !== event.source) {
2157
- return;
2158
- }
2159
- if (_this.origin === '*') {
2160
- _this.origin = event.origin;
2161
- }
2162
- var data = parseMessageData(event.data);
2163
- var isError = data && data.event === 'error';
2164
- var isReadyError = isError && data.data && data.data.method === 'ready';
2165
- if (isReadyError) {
2166
- var error = new Error(data.data.message);
2167
- error.name = data.data.name;
2168
- reject(error);
2169
- return;
2170
- }
2171
- var isReadyEvent = data && data.event === 'ready';
2172
- var isPingResponse = data && data.method === 'ping';
2173
- if (isReadyEvent || isPingResponse) {
2174
- _this.element.setAttribute('data-ready', 'true');
2175
- resolve();
2176
- return;
2177
- }
2178
- processData(_this, data);
2179
- };
2180
- _this._window.addEventListener('message', _this._onMessage);
2181
- if (_this.element.nodeName !== 'IFRAME') {
2182
- var params = getOEmbedParameters(element, options);
2183
- var url = getVimeoUrl(params);
2184
- getOEmbedData(url, params, element).then(function (data) {
2185
- var iframe = createEmbed(data, element);
2186
- // Overwrite element with the new iframe,
2187
- // but store reference to the original element
2188
- _this.element = iframe;
2189
- _this._originalElement = element;
2190
- swapCallbacks(element, iframe);
2191
- playerMap.set(_this.element, _this);
2192
- return data;
2193
- }).catch(reject);
2194
- }
2195
- });
2196
-
2197
- // Store a copy of this Player in the map
2198
- readyMap.set(this, readyPromise);
2199
- playerMap.set(this.element, this);
2200
-
2201
- // Send a ping to the iframe so the ready promise will be resolved if
2202
- // the player is already ready.
2203
- if (this.element.nodeName === 'IFRAME') {
2204
- postMessage(this, 'ping');
2205
- }
2206
- if (screenfull.isEnabled) {
2207
- var exitFullscreen = function exitFullscreen() {
2208
- return screenfull.exit();
2209
- };
2210
- this.fullscreenchangeHandler = function () {
2211
- if (screenfull.isFullscreen) {
2212
- storeCallback(_this, 'event:exitFullscreen', exitFullscreen);
2213
- } else {
2214
- removeCallback(_this, 'event:exitFullscreen', exitFullscreen);
2215
- }
2216
- // eslint-disable-next-line
2217
- _this.ready().then(function () {
2218
- postMessage(_this, 'fullscreenchange', screenfull.isFullscreen);
2219
- });
2220
- };
2221
- screenfull.on('fullscreenchange', this.fullscreenchangeHandler);
2222
- }
2223
- return this;
2224
- }
2225
-
2226
- /**
2227
- * Get a promise for a method.
2228
- *
2229
- * @param {string} name The API method to call.
2230
- * @param {...(string|number|object|Array)} args Arguments to send via postMessage.
2231
- * @return {Promise}
2232
- */
2233
- _createClass(Player, [{
2234
- key: "callMethod",
2235
- value: function callMethod(name) {
2236
- var _this2 = this;
2237
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2238
- args[_key - 1] = arguments[_key];
2239
- }
2240
- if (name === undefined || name === null) {
2241
- throw new TypeError('You must pass a method name.');
2242
- }
2243
- return new npo_src(function (resolve, reject) {
2244
- // We are storing the resolve/reject handlers to call later, so we
2245
- // can’t return here.
2246
- // eslint-disable-next-line promise/always-return
2247
- return _this2.ready().then(function () {
2248
- storeCallback(_this2, name, {
2249
- resolve: resolve,
2250
- reject: reject
2251
- });
2252
- postMessage(_this2, name, args);
2253
- }).catch(reject);
2254
- });
2255
- }
2256
- /**
2257
- * Get a promise for the value of a player property.
2258
- *
2259
- * @param {string} name The property name
2260
- * @return {Promise}
2261
- */
2262
- }, {
2263
- key: "get",
2264
- value: function get(name) {
2265
- var _this3 = this;
2266
- return new npo_src(function (resolve, reject) {
2267
- name = getMethodName(name, 'get');
2268
-
2269
- // We are storing the resolve/reject handlers to call later, so we
2270
- // can’t return here.
2271
- // eslint-disable-next-line promise/always-return
2272
- return _this3.ready().then(function () {
2273
- storeCallback(_this3, name, {
2274
- resolve: resolve,
2275
- reject: reject
2276
- });
2277
- postMessage(_this3, name);
2278
- }).catch(reject);
2279
- });
2280
- }
2281
-
2282
- /**
2283
- * Get a promise for setting the value of a player property.
2284
- *
2285
- * @param {string} name The API method to call.
2286
- * @param {mixed} value The value to set.
2287
- * @return {Promise}
2288
- */
2289
- }, {
2290
- key: "set",
2291
- value: function set(name, value) {
2292
- var _this4 = this;
2293
- return new npo_src(function (resolve, reject) {
2294
- name = getMethodName(name, 'set');
2295
- if (value === undefined || value === null) {
2296
- throw new TypeError('There must be a value to set.');
2297
- }
2298
-
2299
- // We are storing the resolve/reject handlers to call later, so we
2300
- // can’t return here.
2301
- // eslint-disable-next-line promise/always-return
2302
- return _this4.ready().then(function () {
2303
- storeCallback(_this4, name, {
2304
- resolve: resolve,
2305
- reject: reject
2306
- });
2307
- postMessage(_this4, name, value);
2308
- }).catch(reject);
2309
- });
2310
- }
2311
-
2312
- /**
2313
- * Add an event listener for the specified event. Will call the
2314
- * callback with a single parameter, `data`, that contains the data for
2315
- * that event.
2316
- *
2317
- * @param {string} eventName The name of the event.
2318
- * @param {function(*)} callback The function to call when the event fires.
2319
- * @return {void}
2320
- */
2321
- }, {
2322
- key: "on",
2323
- value: function on(eventName, callback) {
2324
- if (!eventName) {
2325
- throw new TypeError('You must pass an event name.');
2326
- }
2327
- if (!callback) {
2328
- throw new TypeError('You must pass a callback function.');
2329
- }
2330
- if (typeof callback !== 'function') {
2331
- throw new TypeError('The callback must be a function.');
2332
- }
2333
- var callbacks = getCallbacks(this, "event:".concat(eventName));
2334
- if (callbacks.length === 0) {
2335
- this.callMethod('addEventListener', eventName).catch(function () {
2336
- // Ignore the error. There will be an error event fired that
2337
- // will trigger the error callback if they are listening.
2338
- });
2339
- }
2340
- storeCallback(this, "event:".concat(eventName), callback);
2341
- }
2342
-
2343
- /**
2344
- * Remove an event listener for the specified event. Will remove all
2345
- * listeners for that event if a `callback` isn’t passed, or only that
2346
- * specific callback if it is passed.
2347
- *
2348
- * @param {string} eventName The name of the event.
2349
- * @param {function} [callback] The specific callback to remove.
2350
- * @return {void}
2351
- */
2352
- }, {
2353
- key: "off",
2354
- value: function off(eventName, callback) {
2355
- if (!eventName) {
2356
- throw new TypeError('You must pass an event name.');
2357
- }
2358
- if (callback && typeof callback !== 'function') {
2359
- throw new TypeError('The callback must be a function.');
2360
- }
2361
- var lastCallback = removeCallback(this, "event:".concat(eventName), callback);
2362
-
2363
- // If there are no callbacks left, remove the listener
2364
- if (lastCallback) {
2365
- this.callMethod('removeEventListener', eventName).catch(function (e) {
2366
- // Ignore the error. There will be an error event fired that
2367
- // will trigger the error callback if they are listening.
2368
- });
2369
- }
2370
- }
2371
-
2372
- /**
2373
- * A promise to load a new video.
2374
- *
2375
- * @promise LoadVideoPromise
2376
- * @fulfill {number} The video with this id or url successfully loaded.
2377
- * @reject {TypeError} The id was not a number.
2378
- */
2379
- /**
2380
- * Load a new video into this embed. The promise will be resolved if
2381
- * the video is successfully loaded, or it will be rejected if it could
2382
- * not be loaded.
2383
- *
2384
- * @param {number|string|object} options The id of the video, the url of the video, or an object with embed options.
2385
- * @return {LoadVideoPromise}
2386
- */
2387
- }, {
2388
- key: "loadVideo",
2389
- value: function loadVideo(options) {
2390
- return this.callMethod('loadVideo', options);
2391
- }
2392
-
2393
- /**
2394
- * A promise to perform an action when the Player is ready.
2395
- *
2396
- * @todo document errors
2397
- * @promise LoadVideoPromise
2398
- * @fulfill {void}
2399
- */
2400
- /**
2401
- * Trigger a function when the player iframe has initialized. You do not
2402
- * need to wait for `ready` to trigger to begin adding event listeners
2403
- * or calling other methods.
2404
- *
2405
- * @return {ReadyPromise}
2406
- */
2407
- }, {
2408
- key: "ready",
2409
- value: function ready() {
2410
- var readyPromise = readyMap.get(this) || new npo_src(function (resolve, reject) {
2411
- reject(new Error('Unknown player. Probably unloaded.'));
2412
- });
2413
- return npo_src.resolve(readyPromise);
2414
- }
2415
-
2416
- /**
2417
- * A promise to add a cue point to the player.
2418
- *
2419
- * @promise AddCuePointPromise
2420
- * @fulfill {string} The id of the cue point to use for removeCuePoint.
2421
- * @reject {RangeError} the time was less than 0 or greater than the
2422
- * video’s duration.
2423
- * @reject {UnsupportedError} Cue points are not supported with the current
2424
- * player or browser.
2425
- */
2426
- /**
2427
- * Add a cue point to the player.
2428
- *
2429
- * @param {number} time The time for the cue point.
2430
- * @param {object} [data] Arbitrary data to be returned with the cue point.
2431
- * @return {AddCuePointPromise}
2432
- */
2433
- }, {
2434
- key: "addCuePoint",
2435
- value: function addCuePoint(time) {
2436
- var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2437
- return this.callMethod('addCuePoint', {
2438
- time: time,
2439
- data: data
2440
- });
2441
- }
2442
-
2443
- /**
2444
- * A promise to remove a cue point from the player.
2445
- *
2446
- * @promise AddCuePointPromise
2447
- * @fulfill {string} The id of the cue point that was removed.
2448
- * @reject {InvalidCuePoint} The cue point with the specified id was not
2449
- * found.
2450
- * @reject {UnsupportedError} Cue points are not supported with the current
2451
- * player or browser.
2452
- */
2453
- /**
2454
- * Remove a cue point from the video.
2455
- *
2456
- * @param {string} id The id of the cue point to remove.
2457
- * @return {RemoveCuePointPromise}
2458
- */
2459
- }, {
2460
- key: "removeCuePoint",
2461
- value: function removeCuePoint(id) {
2462
- return this.callMethod('removeCuePoint', id);
2463
- }
2464
-
2465
- /**
2466
- * A representation of a text track on a video.
2467
- *
2468
- * @typedef {Object} VimeoTextTrack
2469
- * @property {string} language The ISO language code.
2470
- * @property {string} kind The kind of track it is (captions or subtitles).
2471
- * @property {string} label The human‐readable label for the track.
2472
- */
2473
- /**
2474
- * A promise to enable a text track.
2475
- *
2476
- * @promise EnableTextTrackPromise
2477
- * @fulfill {VimeoTextTrack} The text track that was enabled.
2478
- * @reject {InvalidTrackLanguageError} No track was available with the
2479
- * specified language.
2480
- * @reject {InvalidTrackError} No track was available with the specified
2481
- * language and kind.
2482
- */
2483
- /**
2484
- * Enable the text track with the specified language, and optionally the
2485
- * specified kind (captions or subtitles).
2486
- *
2487
- * When set via the API, the track language will not change the viewer’s
2488
- * stored preference.
2489
- *
2490
- * @param {string} language The two‐letter language code.
2491
- * @param {string} [kind] The kind of track to enable (captions or subtitles).
2492
- * @return {EnableTextTrackPromise}
2493
- */
2494
- }, {
2495
- key: "enableTextTrack",
2496
- value: function enableTextTrack(language, kind) {
2497
- if (!language) {
2498
- throw new TypeError('You must pass a language.');
2499
- }
2500
- return this.callMethod('enableTextTrack', {
2501
- language: language,
2502
- kind: kind
2503
- });
2504
- }
2505
-
2506
- /**
2507
- * A promise to disable the active text track.
2508
- *
2509
- * @promise DisableTextTrackPromise
2510
- * @fulfill {void} The track was disabled.
2511
- */
2512
- /**
2513
- * Disable the currently-active text track.
2514
- *
2515
- * @return {DisableTextTrackPromise}
2516
- */
2517
- }, {
2518
- key: "disableTextTrack",
2519
- value: function disableTextTrack() {
2520
- return this.callMethod('disableTextTrack');
2521
- }
2522
-
2523
- /**
2524
- * A promise to pause the video.
2525
- *
2526
- * @promise PausePromise
2527
- * @fulfill {void} The video was paused.
2528
- */
2529
- /**
2530
- * Pause the video if it’s playing.
2531
- *
2532
- * @return {PausePromise}
2533
- */
2534
- }, {
2535
- key: "pause",
2536
- value: function pause() {
2537
- return this.callMethod('pause');
2538
- }
2539
-
2540
- /**
2541
- * A promise to play the video.
2542
- *
2543
- * @promise PlayPromise
2544
- * @fulfill {void} The video was played.
2545
- */
2546
- /**
2547
- * Play the video if it’s paused. **Note:** on iOS and some other
2548
- * mobile devices, you cannot programmatically trigger play. Once the
2549
- * viewer has tapped on the play button in the player, however, you
2550
- * will be able to use this function.
2551
- *
2552
- * @return {PlayPromise}
2553
- */
2554
- }, {
2555
- key: "play",
2556
- value: function play() {
2557
- return this.callMethod('play');
2558
- }
2559
-
2560
- /**
2561
- * Request that the player enters fullscreen.
2562
- * @return {Promise}
2563
- */
2564
- }, {
2565
- key: "requestFullscreen",
2566
- value: function requestFullscreen() {
2567
- if (screenfull.isEnabled) {
2568
- return screenfull.request(this.element);
2569
- }
2570
- return this.callMethod('requestFullscreen');
2571
- }
2572
-
2573
- /**
2574
- * Request that the player exits fullscreen.
2575
- * @return {Promise}
2576
- */
2577
- }, {
2578
- key: "exitFullscreen",
2579
- value: function exitFullscreen() {
2580
- if (screenfull.isEnabled) {
2581
- return screenfull.exit();
2582
- }
2583
- return this.callMethod('exitFullscreen');
2584
- }
2585
-
2586
- /**
2587
- * Returns true if the player is currently fullscreen.
2588
- * @return {Promise}
2589
- */
2590
- }, {
2591
- key: "getFullscreen",
2592
- value: function getFullscreen() {
2593
- if (screenfull.isEnabled) {
2594
- return npo_src.resolve(screenfull.isFullscreen);
2595
- }
2596
- return this.get('fullscreen');
2597
- }
2598
-
2599
- /**
2600
- * Request that the player enters picture-in-picture.
2601
- * @return {Promise}
2602
- */
2603
- }, {
2604
- key: "requestPictureInPicture",
2605
- value: function requestPictureInPicture() {
2606
- return this.callMethod('requestPictureInPicture');
2607
- }
2608
-
2609
- /**
2610
- * Request that the player exits picture-in-picture.
2611
- * @return {Promise}
2612
- */
2613
- }, {
2614
- key: "exitPictureInPicture",
2615
- value: function exitPictureInPicture() {
2616
- return this.callMethod('exitPictureInPicture');
2617
- }
2618
-
2619
- /**
2620
- * Returns true if the player is currently picture-in-picture.
2621
- * @return {Promise}
2622
- */
2623
- }, {
2624
- key: "getPictureInPicture",
2625
- value: function getPictureInPicture() {
2626
- return this.get('pictureInPicture');
2627
- }
2628
-
2629
- /**
2630
- * A promise to prompt the viewer to initiate remote playback.
2631
- *
2632
- * @promise RemotePlaybackPromptPromise
2633
- * @fulfill {void}
2634
- * @reject {NotFoundError} No remote playback device is available.
2635
- */
2636
- /**
2637
- * Request to prompt the user to initiate remote playback.
2638
- *
2639
- * @return {RemotePlaybackPromptPromise}
2640
- */
2641
- }, {
2642
- key: "remotePlaybackPrompt",
2643
- value: function remotePlaybackPrompt() {
2644
- return this.callMethod('remotePlaybackPrompt');
2645
- }
2646
-
2647
- /**
2648
- * A promise to unload the video.
2649
- *
2650
- * @promise UnloadPromise
2651
- * @fulfill {void} The video was unloaded.
2652
- */
2653
- /**
2654
- * Return the player to its initial state.
2655
- *
2656
- * @return {UnloadPromise}
2657
- */
2658
- }, {
2659
- key: "unload",
2660
- value: function unload() {
2661
- return this.callMethod('unload');
2662
- }
2663
-
2664
- /**
2665
- * Cleanup the player and remove it from the DOM
2666
- *
2667
- * It won't be usable and a new one should be constructed
2668
- * in order to do any operations.
2669
- *
2670
- * @return {Promise}
2671
- */
2672
- }, {
2673
- key: "destroy",
2674
- value: function destroy() {
2675
- var _this5 = this;
2676
- return new npo_src(function (resolve) {
2677
- readyMap.delete(_this5);
2678
- playerMap.delete(_this5.element);
2679
- if (_this5._originalElement) {
2680
- playerMap.delete(_this5._originalElement);
2681
- _this5._originalElement.removeAttribute('data-vimeo-initialized');
2682
- }
2683
- if (_this5.element && _this5.element.nodeName === 'IFRAME' && _this5.element.parentNode) {
2684
- // If we've added an additional wrapper div, remove that from the DOM.
2685
- // If not, just remove the iframe element.
2686
- if (_this5.element.parentNode.parentNode && _this5._originalElement && _this5._originalElement !== _this5.element.parentNode) {
2687
- _this5.element.parentNode.parentNode.removeChild(_this5.element.parentNode);
2688
- } else {
2689
- _this5.element.parentNode.removeChild(_this5.element);
2690
- }
2691
- }
2692
-
2693
- // If the clip is private there is a case where the element stays the
2694
- // div element. Destroy should reset the div and remove the iframe child.
2695
- if (_this5.element && _this5.element.nodeName === 'DIV' && _this5.element.parentNode) {
2696
- _this5.element.removeAttribute('data-vimeo-initialized');
2697
- var iframe = _this5.element.querySelector('iframe');
2698
- if (iframe && iframe.parentNode) {
2699
- // If we've added an additional wrapper div, remove that from the DOM.
2700
- // If not, just remove the iframe element.
2701
- if (iframe.parentNode.parentNode && _this5._originalElement && _this5._originalElement !== iframe.parentNode) {
2702
- iframe.parentNode.parentNode.removeChild(iframe.parentNode);
2703
- } else {
2704
- iframe.parentNode.removeChild(iframe);
2705
- }
2706
- }
2707
- }
2708
- _this5._window.removeEventListener('message', _this5._onMessage);
2709
- if (screenfull.isEnabled) {
2710
- screenfull.off('fullscreenchange', _this5.fullscreenchangeHandler);
2711
- }
2712
- resolve();
2713
- });
2714
- }
2715
-
2716
- /**
2717
- * A promise to get the autopause behavior of the video.
2718
- *
2719
- * @promise GetAutopausePromise
2720
- * @fulfill {boolean} Whether autopause is turned on or off.
2721
- * @reject {UnsupportedError} Autopause is not supported with the current
2722
- * player or browser.
2723
- */
2724
- /**
2725
- * Get the autopause behavior for this player.
2726
- *
2727
- * @return {GetAutopausePromise}
2728
- */
2729
- }, {
2730
- key: "getAutopause",
2731
- value: function getAutopause() {
2732
- return this.get('autopause');
2733
- }
2734
-
2735
- /**
2736
- * A promise to set the autopause behavior of the video.
2737
- *
2738
- * @promise SetAutopausePromise
2739
- * @fulfill {boolean} Whether autopause is turned on or off.
2740
- * @reject {UnsupportedError} Autopause is not supported with the current
2741
- * player or browser.
2742
- */
2743
- /**
2744
- * Enable or disable the autopause behavior of this player.
2745
- *
2746
- * By default, when another video is played in the same browser, this
2747
- * player will automatically pause. Unless you have a specific reason
2748
- * for doing so, we recommend that you leave autopause set to the
2749
- * default (`true`).
2750
- *
2751
- * @param {boolean} autopause
2752
- * @return {SetAutopausePromise}
2753
- */
2754
- }, {
2755
- key: "setAutopause",
2756
- value: function setAutopause(autopause) {
2757
- return this.set('autopause', autopause);
2758
- }
2759
-
2760
- /**
2761
- * A promise to get the buffered property of the video.
2762
- *
2763
- * @promise GetBufferedPromise
2764
- * @fulfill {Array} Buffered Timeranges converted to an Array.
2765
- */
2766
- /**
2767
- * Get the buffered property of the video.
2768
- *
2769
- * @return {GetBufferedPromise}
2770
- */
2771
- }, {
2772
- key: "getBuffered",
2773
- value: function getBuffered() {
2774
- return this.get('buffered');
2775
- }
2776
-
2777
- /**
2778
- * @typedef {Object} CameraProperties
2779
- * @prop {number} props.yaw - Number between 0 and 360.
2780
- * @prop {number} props.pitch - Number between -90 and 90.
2781
- * @prop {number} props.roll - Number between -180 and 180.
2782
- * @prop {number} props.fov - The field of view in degrees.
2783
- */
2784
- /**
2785
- * A promise to get the camera properties of the player.
2786
- *
2787
- * @promise GetCameraPromise
2788
- * @fulfill {CameraProperties} The camera properties.
2789
- */
2790
- /**
2791
- * For 360° videos get the camera properties for this player.
2792
- *
2793
- * @return {GetCameraPromise}
2794
- */
2795
- }, {
2796
- key: "getCameraProps",
2797
- value: function getCameraProps() {
2798
- return this.get('cameraProps');
2799
- }
2800
-
2801
- /**
2802
- * A promise to set the camera properties of the player.
2803
- *
2804
- * @promise SetCameraPromise
2805
- * @fulfill {Object} The camera was successfully set.
2806
- * @reject {RangeError} The range was out of bounds.
2807
- */
2808
- /**
2809
- * For 360° videos set the camera properties for this player.
2810
- *
2811
- * @param {CameraProperties} camera The camera properties
2812
- * @return {SetCameraPromise}
2813
- */
2814
- }, {
2815
- key: "setCameraProps",
2816
- value: function setCameraProps(camera) {
2817
- return this.set('cameraProps', camera);
2818
- }
2819
-
2820
- /**
2821
- * A representation of a chapter.
2822
- *
2823
- * @typedef {Object} VimeoChapter
2824
- * @property {number} startTime The start time of the chapter.
2825
- * @property {object} title The title of the chapter.
2826
- * @property {number} index The place in the order of Chapters. Starts at 1.
2827
- */
2828
- /**
2829
- * A promise to get chapters for the video.
2830
- *
2831
- * @promise GetChaptersPromise
2832
- * @fulfill {VimeoChapter[]} The chapters for the video.
2833
- */
2834
- /**
2835
- * Get an array of all the chapters for the video.
2836
- *
2837
- * @return {GetChaptersPromise}
2838
- */
2839
- }, {
2840
- key: "getChapters",
2841
- value: function getChapters() {
2842
- return this.get('chapters');
2843
- }
2844
-
2845
- /**
2846
- * A promise to get the currently active chapter.
2847
- *
2848
- * @promise GetCurrentChaptersPromise
2849
- * @fulfill {VimeoChapter|undefined} The current chapter for the video.
2850
- */
2851
- /**
2852
- * Get the currently active chapter for the video.
2853
- *
2854
- * @return {GetCurrentChaptersPromise}
2855
- */
2856
- }, {
2857
- key: "getCurrentChapter",
2858
- value: function getCurrentChapter() {
2859
- return this.get('currentChapter');
2860
- }
2861
-
2862
- /**
2863
- * A promise to get the accent color of the player.
2864
- *
2865
- * @promise GetColorPromise
2866
- * @fulfill {string} The hex color of the player.
2867
- */
2868
- /**
2869
- * Get the accent color for this player. Note this is deprecated in place of `getColorTwo`.
2870
- *
2871
- * @return {GetColorPromise}
2872
- */
2873
- }, {
2874
- key: "getColor",
2875
- value: function getColor() {
2876
- return this.get('color');
2877
- }
2878
-
2879
- /**
2880
- * A promise to get all colors for the player in an array.
2881
- *
2882
- * @promise GetColorsPromise
2883
- * @fulfill {string[]} The hex colors of the player.
2884
- */
2885
- /**
2886
- * Get all the colors for this player in an array: [colorOne, colorTwo, colorThree, colorFour]
2887
- *
2888
- * @return {GetColorPromise}
2889
- */
2890
- }, {
2891
- key: "getColors",
2892
- value: function getColors() {
2893
- return npo_src.all([this.get('colorOne'), this.get('colorTwo'), this.get('colorThree'), this.get('colorFour')]);
2894
- }
2895
-
2896
- /**
2897
- * A promise to set the accent color of the player.
2898
- *
2899
- * @promise SetColorPromise
2900
- * @fulfill {string} The color was successfully set.
2901
- * @reject {TypeError} The string was not a valid hex or rgb color.
2902
- * @reject {ContrastError} The color was set, but the contrast is
2903
- * outside of the acceptable range.
2904
- * @reject {EmbedSettingsError} The owner of the player has chosen to
2905
- * use a specific color.
2906
- */
2907
- /**
2908
- * Set the accent color of this player to a hex or rgb string. Setting the
2909
- * color may fail if the owner of the video has set their embed
2910
- * preferences to force a specific color.
2911
- * Note this is deprecated in place of `setColorTwo`.
2912
- *
2913
- * @param {string} color The hex or rgb color string to set.
2914
- * @return {SetColorPromise}
2915
- */
2916
- }, {
2917
- key: "setColor",
2918
- value: function setColor(color) {
2919
- return this.set('color', color);
2920
- }
2921
-
2922
- /**
2923
- * A promise to set all colors for the player.
2924
- *
2925
- * @promise SetColorsPromise
2926
- * @fulfill {string[]} The colors were successfully set.
2927
- * @reject {TypeError} The string was not a valid hex or rgb color.
2928
- * @reject {ContrastError} The color was set, but the contrast is
2929
- * outside of the acceptable range.
2930
- * @reject {EmbedSettingsError} The owner of the player has chosen to
2931
- * use a specific color.
2932
- */
2933
- /**
2934
- * Set the colors of this player to a hex or rgb string. Setting the
2935
- * color may fail if the owner of the video has set their embed
2936
- * preferences to force a specific color.
2937
- * The colors should be passed in as an array: [colorOne, colorTwo, colorThree, colorFour].
2938
- * If a color should not be set, the index in the array can be left as null.
2939
- *
2940
- * @param {string[]} colors Array of the hex or rgb color strings to set.
2941
- * @return {SetColorsPromise}
2942
- */
2943
- }, {
2944
- key: "setColors",
2945
- value: function setColors(colors) {
2946
- if (!Array.isArray(colors)) {
2947
- return new npo_src(function (resolve, reject) {
2948
- return reject(new TypeError('Argument must be an array.'));
2949
- });
2950
- }
2951
- var nullPromise = new npo_src(function (resolve) {
2952
- return resolve(null);
2953
- });
2954
- var colorPromises = [colors[0] ? this.set('colorOne', colors[0]) : nullPromise, colors[1] ? this.set('colorTwo', colors[1]) : nullPromise, colors[2] ? this.set('colorThree', colors[2]) : nullPromise, colors[3] ? this.set('colorFour', colors[3]) : nullPromise];
2955
- return npo_src.all(colorPromises);
2956
- }
2957
-
2958
- /**
2959
- * A representation of a cue point.
2960
- *
2961
- * @typedef {Object} VimeoCuePoint
2962
- * @property {number} time The time of the cue point.
2963
- * @property {object} data The data passed when adding the cue point.
2964
- * @property {string} id The unique id for use with removeCuePoint.
2965
- */
2966
- /**
2967
- * A promise to get the cue points of a video.
2968
- *
2969
- * @promise GetCuePointsPromise
2970
- * @fulfill {VimeoCuePoint[]} The cue points added to the video.
2971
- * @reject {UnsupportedError} Cue points are not supported with the current
2972
- * player or browser.
2973
- */
2974
- /**
2975
- * Get an array of the cue points added to the video.
2976
- *
2977
- * @return {GetCuePointsPromise}
2978
- */
2979
- }, {
2980
- key: "getCuePoints",
2981
- value: function getCuePoints() {
2982
- return this.get('cuePoints');
2983
- }
2984
-
2985
- /**
2986
- * A promise to get the current time of the video.
2987
- *
2988
- * @promise GetCurrentTimePromise
2989
- * @fulfill {number} The current time in seconds.
2990
- */
2991
- /**
2992
- * Get the current playback position in seconds.
2993
- *
2994
- * @return {GetCurrentTimePromise}
2995
- */
2996
- }, {
2997
- key: "getCurrentTime",
2998
- value: function getCurrentTime() {
2999
- return this.get('currentTime');
3000
- }
3001
-
3002
- /**
3003
- * A promise to set the current time of the video.
3004
- *
3005
- * @promise SetCurrentTimePromise
3006
- * @fulfill {number} The actual current time that was set.
3007
- * @reject {RangeError} the time was less than 0 or greater than the
3008
- * video’s duration.
3009
- */
3010
- /**
3011
- * Set the current playback position in seconds. If the player was
3012
- * paused, it will remain paused. Likewise, if the player was playing,
3013
- * it will resume playing once the video has buffered.
3014
- *
3015
- * You can provide an accurate time and the player will attempt to seek
3016
- * to as close to that time as possible. The exact time will be the
3017
- * fulfilled value of the promise.
3018
- *
3019
- * @param {number} currentTime
3020
- * @return {SetCurrentTimePromise}
3021
- */
3022
- }, {
3023
- key: "setCurrentTime",
3024
- value: function setCurrentTime(currentTime) {
3025
- return this.set('currentTime', currentTime);
3026
- }
3027
-
3028
- /**
3029
- * A promise to get the duration of the video.
3030
- *
3031
- * @promise GetDurationPromise
3032
- * @fulfill {number} The duration in seconds.
3033
- */
3034
- /**
3035
- * Get the duration of the video in seconds. It will be rounded to the
3036
- * nearest second before playback begins, and to the nearest thousandth
3037
- * of a second after playback begins.
3038
- *
3039
- * @return {GetDurationPromise}
3040
- */
3041
- }, {
3042
- key: "getDuration",
3043
- value: function getDuration() {
3044
- return this.get('duration');
3045
- }
3046
-
3047
- /**
3048
- * A promise to get the ended state of the video.
3049
- *
3050
- * @promise GetEndedPromise
3051
- * @fulfill {boolean} Whether or not the video has ended.
3052
- */
3053
- /**
3054
- * Get the ended state of the video. The video has ended if
3055
- * `currentTime === duration`.
3056
- *
3057
- * @return {GetEndedPromise}
3058
- */
3059
- }, {
3060
- key: "getEnded",
3061
- value: function getEnded() {
3062
- return this.get('ended');
3063
- }
3064
-
3065
- /**
3066
- * A promise to get the loop state of the player.
3067
- *
3068
- * @promise GetLoopPromise
3069
- * @fulfill {boolean} Whether or not the player is set to loop.
3070
- */
3071
- /**
3072
- * Get the loop state of the player.
3073
- *
3074
- * @return {GetLoopPromise}
3075
- */
3076
- }, {
3077
- key: "getLoop",
3078
- value: function getLoop() {
3079
- return this.get('loop');
3080
- }
3081
-
3082
- /**
3083
- * A promise to set the loop state of the player.
3084
- *
3085
- * @promise SetLoopPromise
3086
- * @fulfill {boolean} The loop state that was set.
3087
- */
3088
- /**
3089
- * Set the loop state of the player. When set to `true`, the player
3090
- * will start over immediately once playback ends.
3091
- *
3092
- * @param {boolean} loop
3093
- * @return {SetLoopPromise}
3094
- */
3095
- }, {
3096
- key: "setLoop",
3097
- value: function setLoop(loop) {
3098
- return this.set('loop', loop);
3099
- }
3100
-
3101
- /**
3102
- * A promise to set the muted state of the player.
3103
- *
3104
- * @promise SetMutedPromise
3105
- * @fulfill {boolean} The muted state that was set.
3106
- */
3107
- /**
3108
- * Set the muted state of the player. When set to `true`, the player
3109
- * volume will be muted.
3110
- *
3111
- * @param {boolean} muted
3112
- * @return {SetMutedPromise}
3113
- */
3114
- }, {
3115
- key: "setMuted",
3116
- value: function setMuted(muted) {
3117
- return this.set('muted', muted);
3118
- }
3119
-
3120
- /**
3121
- * A promise to get the muted state of the player.
3122
- *
3123
- * @promise GetMutedPromise
3124
- * @fulfill {boolean} Whether or not the player is muted.
3125
- */
3126
- /**
3127
- * Get the muted state of the player.
3128
- *
3129
- * @return {GetMutedPromise}
3130
- */
3131
- }, {
3132
- key: "getMuted",
3133
- value: function getMuted() {
3134
- return this.get('muted');
3135
- }
3136
-
3137
- /**
3138
- * A promise to get the paused state of the player.
3139
- *
3140
- * @promise GetLoopPromise
3141
- * @fulfill {boolean} Whether or not the video is paused.
3142
- */
3143
- /**
3144
- * Get the paused state of the player.
3145
- *
3146
- * @return {GetLoopPromise}
3147
- */
3148
- }, {
3149
- key: "getPaused",
3150
- value: function getPaused() {
3151
- return this.get('paused');
3152
- }
3153
-
3154
- /**
3155
- * A promise to get the playback rate of the player.
3156
- *
3157
- * @promise GetPlaybackRatePromise
3158
- * @fulfill {number} The playback rate of the player on a scale from 0 to 2.
3159
- */
3160
- /**
3161
- * Get the playback rate of the player on a scale from `0` to `2`.
3162
- *
3163
- * @return {GetPlaybackRatePromise}
3164
- */
3165
- }, {
3166
- key: "getPlaybackRate",
3167
- value: function getPlaybackRate() {
3168
- return this.get('playbackRate');
3169
- }
3170
-
3171
- /**
3172
- * A promise to set the playbackrate of the player.
3173
- *
3174
- * @promise SetPlaybackRatePromise
3175
- * @fulfill {number} The playback rate was set.
3176
- * @reject {RangeError} The playback rate was less than 0 or greater than 2.
3177
- */
3178
- /**
3179
- * Set the playback rate of the player on a scale from `0` to `2`. When set
3180
- * via the API, the playback rate will not be synchronized to other
3181
- * players or stored as the viewer's preference.
3182
- *
3183
- * @param {number} playbackRate
3184
- * @return {SetPlaybackRatePromise}
3185
- */
3186
- }, {
3187
- key: "setPlaybackRate",
3188
- value: function setPlaybackRate(playbackRate) {
3189
- return this.set('playbackRate', playbackRate);
3190
- }
3191
-
3192
- /**
3193
- * A promise to get the played property of the video.
3194
- *
3195
- * @promise GetPlayedPromise
3196
- * @fulfill {Array} Played Timeranges converted to an Array.
3197
- */
3198
- /**
3199
- * Get the played property of the video.
3200
- *
3201
- * @return {GetPlayedPromise}
3202
- */
3203
- }, {
3204
- key: "getPlayed",
3205
- value: function getPlayed() {
3206
- return this.get('played');
3207
- }
3208
-
3209
- /**
3210
- * A promise to get the qualities available of the current video.
3211
- *
3212
- * @promise GetQualitiesPromise
3213
- * @fulfill {Array} The qualities of the video.
3214
- */
3215
- /**
3216
- * Get the qualities of the current video.
3217
- *
3218
- * @return {GetQualitiesPromise}
3219
- */
3220
- }, {
3221
- key: "getQualities",
3222
- value: function getQualities() {
3223
- return this.get('qualities');
3224
- }
3225
-
3226
- /**
3227
- * A promise to get the current set quality of the video.
3228
- *
3229
- * @promise GetQualityPromise
3230
- * @fulfill {string} The current set quality.
3231
- */
3232
- /**
3233
- * Get the current set quality of the video.
3234
- *
3235
- * @return {GetQualityPromise}
3236
- */
3237
- }, {
3238
- key: "getQuality",
3239
- value: function getQuality() {
3240
- return this.get('quality');
3241
- }
3242
-
3243
- /**
3244
- * A promise to set the video quality.
3245
- *
3246
- * @promise SetQualityPromise
3247
- * @fulfill {number} The quality was set.
3248
- * @reject {RangeError} The quality is not available.
3249
- */
3250
- /**
3251
- * Set a video quality.
3252
- *
3253
- * @param {string} quality
3254
- * @return {SetQualityPromise}
3255
- */
3256
- }, {
3257
- key: "setQuality",
3258
- value: function setQuality(quality) {
3259
- return this.set('quality', quality);
3260
- }
3261
-
3262
- /**
3263
- * A promise to get the remote playback availability.
3264
- *
3265
- * @promise RemotePlaybackAvailabilityPromise
3266
- * @fulfill {boolean} Whether remote playback is available.
3267
- */
3268
- /**
3269
- * Get the availability of remote playback.
3270
- *
3271
- * @return {RemotePlaybackAvailabilityPromise}
3272
- */
3273
- }, {
3274
- key: "getRemotePlaybackAvailability",
3275
- value: function getRemotePlaybackAvailability() {
3276
- return this.get('remotePlaybackAvailability');
3277
- }
3278
-
3279
- /**
3280
- * A promise to get the current remote playback state.
3281
- *
3282
- * @promise RemotePlaybackStatePromise
3283
- * @fulfill {string} The state of the remote playback: connecting, connected, or disconnected.
3284
- */
3285
- /**
3286
- * Get the current remote playback state.
3287
- *
3288
- * @return {RemotePlaybackStatePromise}
3289
- */
3290
- }, {
3291
- key: "getRemotePlaybackState",
3292
- value: function getRemotePlaybackState() {
3293
- return this.get('remotePlaybackState');
3294
- }
3295
-
3296
- /**
3297
- * A promise to get the seekable property of the video.
3298
- *
3299
- * @promise GetSeekablePromise
3300
- * @fulfill {Array} Seekable Timeranges converted to an Array.
3301
- */
3302
- /**
3303
- * Get the seekable property of the video.
3304
- *
3305
- * @return {GetSeekablePromise}
3306
- */
3307
- }, {
3308
- key: "getSeekable",
3309
- value: function getSeekable() {
3310
- return this.get('seekable');
3311
- }
3312
-
3313
- /**
3314
- * A promise to get the seeking property of the player.
3315
- *
3316
- * @promise GetSeekingPromise
3317
- * @fulfill {boolean} Whether or not the player is currently seeking.
3318
- */
3319
- /**
3320
- * Get if the player is currently seeking.
3321
- *
3322
- * @return {GetSeekingPromise}
3323
- */
3324
- }, {
3325
- key: "getSeeking",
3326
- value: function getSeeking() {
3327
- return this.get('seeking');
3328
- }
3329
-
3330
- /**
3331
- * A promise to get the text tracks of a video.
3332
- *
3333
- * @promise GetTextTracksPromise
3334
- * @fulfill {VimeoTextTrack[]} The text tracks associated with the video.
3335
- */
3336
- /**
3337
- * Get an array of the text tracks that exist for the video.
3338
- *
3339
- * @return {GetTextTracksPromise}
3340
- */
3341
- }, {
3342
- key: "getTextTracks",
3343
- value: function getTextTracks() {
3344
- return this.get('textTracks');
3345
- }
3346
-
3347
- /**
3348
- * A promise to get the embed code for the video.
3349
- *
3350
- * @promise GetVideoEmbedCodePromise
3351
- * @fulfill {string} The `<iframe>` embed code for the video.
3352
- */
3353
- /**
3354
- * Get the `<iframe>` embed code for the video.
3355
- *
3356
- * @return {GetVideoEmbedCodePromise}
3357
- */
3358
- }, {
3359
- key: "getVideoEmbedCode",
3360
- value: function getVideoEmbedCode() {
3361
- return this.get('videoEmbedCode');
3362
- }
3363
-
3364
- /**
3365
- * A promise to get the id of the video.
3366
- *
3367
- * @promise GetVideoIdPromise
3368
- * @fulfill {number} The id of the video.
3369
- */
3370
- /**
3371
- * Get the id of the video.
3372
- *
3373
- * @return {GetVideoIdPromise}
3374
- */
3375
- }, {
3376
- key: "getVideoId",
3377
- value: function getVideoId() {
3378
- return this.get('videoId');
3379
- }
3380
-
3381
- /**
3382
- * A promise to get the title of the video.
3383
- *
3384
- * @promise GetVideoTitlePromise
3385
- * @fulfill {number} The title of the video.
3386
- */
3387
- /**
3388
- * Get the title of the video.
3389
- *
3390
- * @return {GetVideoTitlePromise}
3391
- */
3392
- }, {
3393
- key: "getVideoTitle",
3394
- value: function getVideoTitle() {
3395
- return this.get('videoTitle');
3396
- }
3397
-
3398
- /**
3399
- * A promise to get the native width of the video.
3400
- *
3401
- * @promise GetVideoWidthPromise
3402
- * @fulfill {number} The native width of the video.
3403
- */
3404
- /**
3405
- * Get the native width of the currently‐playing video. The width of
3406
- * the highest‐resolution available will be used before playback begins.
3407
- *
3408
- * @return {GetVideoWidthPromise}
3409
- */
3410
- }, {
3411
- key: "getVideoWidth",
3412
- value: function getVideoWidth() {
3413
- return this.get('videoWidth');
3414
- }
3415
-
3416
- /**
3417
- * A promise to get the native height of the video.
3418
- *
3419
- * @promise GetVideoHeightPromise
3420
- * @fulfill {number} The native height of the video.
3421
- */
3422
- /**
3423
- * Get the native height of the currently‐playing video. The height of
3424
- * the highest‐resolution available will be used before playback begins.
3425
- *
3426
- * @return {GetVideoHeightPromise}
3427
- */
3428
- }, {
3429
- key: "getVideoHeight",
3430
- value: function getVideoHeight() {
3431
- return this.get('videoHeight');
3432
- }
3433
-
3434
- /**
3435
- * A promise to get the vimeo.com url for the video.
3436
- *
3437
- * @promise GetVideoUrlPromise
3438
- * @fulfill {number} The vimeo.com url for the video.
3439
- * @reject {PrivacyError} The url isn’t available because of the video’s privacy setting.
3440
- */
3441
- /**
3442
- * Get the vimeo.com url for the video.
3443
- *
3444
- * @return {GetVideoUrlPromise}
3445
- */
3446
- }, {
3447
- key: "getVideoUrl",
3448
- value: function getVideoUrl() {
3449
- return this.get('videoUrl');
3450
- }
3451
-
3452
- /**
3453
- * A promise to get the volume level of the player.
3454
- *
3455
- * @promise GetVolumePromise
3456
- * @fulfill {number} The volume level of the player on a scale from 0 to 1.
3457
- */
3458
- /**
3459
- * Get the current volume level of the player on a scale from `0` to `1`.
3460
- *
3461
- * Most mobile devices do not support an independent volume from the
3462
- * system volume. In those cases, this method will always return `1`.
3463
- *
3464
- * @return {GetVolumePromise}
3465
- */
3466
- }, {
3467
- key: "getVolume",
3468
- value: function getVolume() {
3469
- return this.get('volume');
3470
- }
3471
-
3472
- /**
3473
- * A promise to set the volume level of the player.
3474
- *
3475
- * @promise SetVolumePromise
3476
- * @fulfill {number} The volume was set.
3477
- * @reject {RangeError} The volume was less than 0 or greater than 1.
3478
- */
3479
- /**
3480
- * Set the volume of the player on a scale from `0` to `1`. When set
3481
- * via the API, the volume level will not be synchronized to other
3482
- * players or stored as the viewer’s preference.
3483
- *
3484
- * Most mobile devices do not support setting the volume. An error will
3485
- * *not* be triggered in that situation.
3486
- *
3487
- * @param {number} volume
3488
- * @return {SetVolumePromise}
3489
- */
3490
- }, {
3491
- key: "setVolume",
3492
- value: function setVolume(volume) {
3493
- return this.set('volume', volume);
3494
- }
3495
-
3496
- /** @typedef {import('./lib/timing-object.types').TimingObject} TimingObject */
3497
- /** @typedef {import('./lib/timing-src-connector.types').TimingSrcConnectorOptions} TimingSrcConnectorOptions */
3498
- /** @typedef {import('./lib/timing-src-connector').TimingSrcConnector} TimingSrcConnector */
3499
-
3500
- /**
3501
- * Connects a TimingObject to the video player (https://webtiming.github.io/timingobject/)
3502
- *
3503
- * @param {TimingObject} timingObject
3504
- * @param {TimingSrcConnectorOptions} options
3505
- *
3506
- * @return {Promise<TimingSrcConnector>}
3507
- */
3508
- }, {
3509
- key: "setTimingSrc",
3510
- value: function () {
3511
- var _setTimingSrc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(timingObject, options) {
3512
- var _this6 = this;
3513
- var connector;
3514
- return _regeneratorRuntime().wrap(function _callee$(_context) {
3515
- while (1) switch (_context.prev = _context.next) {
3516
- case 0:
3517
- if (timingObject) {
3518
- _context.next = 2;
3519
- break;
3520
- }
3521
- throw new TypeError('A Timing Object must be provided.');
3522
- case 2:
3523
- _context.next = 4;
3524
- return this.ready();
3525
- case 4:
3526
- connector = new TimingSrcConnector(this, timingObject, options);
3527
- postMessage(this, 'notifyTimingObjectConnect');
3528
- connector.addEventListener('disconnect', function () {
3529
- return postMessage(_this6, 'notifyTimingObjectDisconnect');
3530
- });
3531
- return _context.abrupt("return", connector);
3532
- case 8:
3533
- case "end":
3534
- return _context.stop();
3535
- }
3536
- }, _callee, this);
3537
- }));
3538
- function setTimingSrc(_x, _x2) {
3539
- return _setTimingSrc.apply(this, arguments);
3540
- }
3541
- return setTimingSrc;
3542
- }()
3543
- }]);
3544
- return Player;
3545
- }(); // Setup embed only if this is not a node environment
3546
- if (!isNode) {
3547
- screenfull = initializeScreenfull();
3548
- initializeEmbeds();
3549
- resizeEmbeds();
3550
- initAppendVideoMetadata();
3551
- checkUrlTimeParam();
3552
- }
3553
-
3554
- /* export default */ const __WEBPACK_DEFAULT_EXPORT__ = (Player);
3555
-
3556
-
3557
- }),
3558
- "./node_modules/vimeo-video-element/dist/react.js": (function (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
3559
- __webpack_require__.r(__webpack_exports__);
3560
- __webpack_require__.d(__webpack_exports__, {
3561
- "default": () => (react_default)
3562
- });
3563
- /* import */var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("react");
3564
- /* import */var _vimeo_video_element_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./node_modules/vimeo-video-element/dist/vimeo-video-element.js");
3565
- "use client";
3566
-
3567
- // dist/react.ts
3568
-
3569
-
3570
-
3571
- // ../../node_modules/ce-la-react/dist/ce-la-react.js
3572
- var reservedReactProps = /* @__PURE__ */ new Set([
3573
- "style",
3574
- "children",
3575
- "ref",
3576
- "key",
3577
- "suppressContentEditableWarning",
3578
- "suppressHydrationWarning",
3579
- "dangerouslySetInnerHTML"
3580
- ]);
3581
- var reactPropToAttrNameMap = {
3582
- className: "class",
3583
- htmlFor: "for"
3584
- };
3585
- function defaultToAttributeName(propName) {
3586
- return propName.toLowerCase();
3587
- }
3588
- function defaultToAttributeValue(propValue) {
3589
- if (typeof propValue === "boolean") return propValue ? "" : void 0;
3590
- if (typeof propValue === "function") return void 0;
3591
- if (typeof propValue === "object" && propValue !== null) return void 0;
3592
- return propValue;
3593
- }
3594
- function createComponent({
3595
- react: React2,
3596
- tagName,
3597
- elementClass,
3598
- events,
3599
- displayName,
3600
- defaultProps,
3601
- toAttributeName = defaultToAttributeName,
3602
- toAttributeValue = defaultToAttributeValue
3603
- }) {
3604
- const IS_REACT_19_OR_NEWER = Number.parseInt(React2.version) >= 19;
3605
- const ReactComponent = React2.forwardRef((props, ref) => {
3606
- var _a, _b;
3607
- const elementRef = React2.useRef(null);
3608
- const prevElemPropsRef = React2.useRef(/* @__PURE__ */ new Map());
3609
- const eventProps = {};
3610
- const attrs = {};
3611
- const reactProps = {};
3612
- const elementProps = {};
3613
- for (const [k, v] of Object.entries(props)) {
3614
- if (reservedReactProps.has(k)) {
3615
- reactProps[k] = v;
3616
- continue;
3617
- }
3618
- const attrName = toAttributeName(reactPropToAttrNameMap[k] ?? k);
3619
- if (elementClass.prototype && k in elementClass.prototype && !(k in (((_a = globalThis.HTMLElement) == null ? void 0 : _a.prototype) ?? {})) && !((_b = elementClass.observedAttributes) == null ? void 0 : _b.some((attr) => attr === attrName))) {
3620
- elementProps[k] = v;
3621
- continue;
3622
- }
3623
- if (k.startsWith("on")) {
3624
- eventProps[k] = v;
3625
- continue;
3626
- }
3627
- const attrValue = toAttributeValue(v);
3628
- if (attrName && attrValue != null) {
3629
- attrs[attrName] = String(attrValue);
3630
- if (!IS_REACT_19_OR_NEWER) {
3631
- reactProps[attrName] = attrValue;
3632
- }
3633
- }
3634
- if (attrName && IS_REACT_19_OR_NEWER) {
3635
- const attrValueFromDefault = defaultToAttributeValue(v);
3636
- if (attrValue !== attrValueFromDefault) {
3637
- reactProps[attrName] = attrValue;
3638
- } else {
3639
- reactProps[attrName] = v;
3640
- }
3641
- }
3642
- }
3643
- if (typeof window !== "undefined") {
3644
- for (const propName in eventProps) {
3645
- const callback = eventProps[propName];
3646
- const useCapture = propName.endsWith("Capture");
3647
- const eventName = ((events == null ? void 0 : events[propName]) ?? propName.slice(2).toLowerCase()).slice(
3648
- 0,
3649
- useCapture ? -7 : void 0
3650
- );
3651
- React2.useLayoutEffect(() => {
3652
- const eventTarget = elementRef == null ? void 0 : elementRef.current;
3653
- if (!eventTarget || typeof callback !== "function") return;
3654
- eventTarget.addEventListener(eventName, callback, useCapture);
3655
- return () => {
3656
- eventTarget.removeEventListener(eventName, callback, useCapture);
3657
- };
3658
- }, [elementRef == null ? void 0 : elementRef.current, callback]);
3659
- }
3660
- React2.useLayoutEffect(() => {
3661
- if (elementRef.current === null) return;
3662
- const newElemProps = /* @__PURE__ */ new Map();
3663
- for (const key in elementProps) {
3664
- setProperty(elementRef.current, key, elementProps[key]);
3665
- prevElemPropsRef.current.delete(key);
3666
- newElemProps.set(key, elementProps[key]);
3667
- }
3668
- for (const [key, _value] of prevElemPropsRef.current) {
3669
- setProperty(elementRef.current, key, void 0);
3670
- }
3671
- prevElemPropsRef.current = newElemProps;
3672
- });
3673
- }
3674
- if (typeof window === "undefined" && (elementClass == null ? void 0 : elementClass.getTemplateHTML) && (elementClass == null ? void 0 : elementClass.shadowRootOptions)) {
3675
- const { mode, delegatesFocus } = elementClass.shadowRootOptions;
3676
- const templateShadowRoot = React2.createElement("template", {
3677
- shadowrootmode: mode,
3678
- shadowrootdelegatesfocus: delegatesFocus,
3679
- dangerouslySetInnerHTML: {
3680
- __html: elementClass.getTemplateHTML(attrs, props)
3681
- }
3682
- });
3683
- reactProps.children = [templateShadowRoot, reactProps.children];
3684
- }
3685
- return React2.createElement(tagName, {
3686
- ...defaultProps,
3687
- ...reactProps,
3688
- ref: React2.useCallback(
3689
- (node) => {
3690
- elementRef.current = node;
3691
- if (typeof ref === "function") {
3692
- ref(node);
3693
- } else if (ref !== null) {
3694
- ref.current = node;
3695
- }
3696
- },
3697
- [ref]
3698
- )
3699
- });
3700
- });
3701
- ReactComponent.displayName = displayName ?? elementClass.name;
3702
- return ReactComponent;
3703
- }
3704
- function setProperty(node, name, value) {
3705
- var _a;
3706
- node[name] = value;
3707
- if (value == null && name in (((_a = globalThis.HTMLElement) == null ? void 0 : _a.prototype) ?? {})) {
3708
- node.removeAttribute(name);
3709
- }
3710
- }
3711
-
3712
- // dist/react.ts
3713
- var react_default = createComponent({
3714
- react: react__WEBPACK_IMPORTED_MODULE_0__["default"],
3715
- tagName: "vimeo-video",
3716
- elementClass: _vimeo_video_element_js__WEBPACK_IMPORTED_MODULE_1__["default"],
3717
- toAttributeName(propName) {
3718
- if (propName === "muted") return "";
3719
- if (propName === "defaultMuted") return "muted";
3720
- return defaultToAttributeName(propName);
3721
- }
3722
- });
3723
-
3724
- /*! Bundled license information:
3725
-
3726
- ce-la-react/dist/ce-la-react.js:
3727
- (**
3728
- * @license
3729
- * Copyright 2018 Google LLC
3730
- * SPDX-License-Identifier: BSD-3-Clause
3731
- *
3732
- * Modified version of `@lit/react` for vanilla custom elements with support for SSR.
3733
- *)
3734
- */
3735
-
3736
-
3737
- }),
3738
- "./node_modules/vimeo-video-element/dist/vimeo-video-element.js": (function (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
3739
- __webpack_require__.r(__webpack_exports__);
3740
- __webpack_require__.d(__webpack_exports__, {
3741
- "default": () => (vimeo_video_element_default)
3742
- });
3743
- /* import */var _vimeo_player_dist_player_es_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/@vimeo/player/dist/player.es.js");
3744
-
3745
- const EMBED_VIDEO_BASE = "https://player.vimeo.com/video";
3746
- const EMBED_EVENT_BASE = "https://vimeo.com/event";
3747
- const MATCH_SRC = /vimeo\.com\/(video\/|event\/)?(\d+)(?:\/([\w-]+))?/;
3748
- function getTemplateHTML(attrs, props = {}) {
3749
- const iframeAttrs = {
3750
- src: serializeIframeUrl(attrs, props),
3751
- frameborder: 0,
3752
- width: "100%",
3753
- height: "100%",
3754
- allow: "accelerometer; fullscreen; autoplay; encrypted-media; gyroscope; picture-in-picture"
3755
- };
3756
- if (props.config) {
3757
- iframeAttrs["data-config"] = JSON.stringify(props.config);
3758
- }
3759
- return (
3760
- /*html*/
3761
- `
3762
- <style>
3763
- :host {
3764
- display: inline-block;
3765
- min-width: 300px;
3766
- min-height: 150px;
3767
- position: relative;
3768
- }
3769
- iframe {
3770
- position: absolute;
3771
- top: 0;
3772
- left: 0;
3773
- }
3774
- :host(:not([controls])) {
3775
- pointer-events: none;
3776
- }
3777
- </style>
3778
- <iframe${serializeAttributes(iframeAttrs)}></iframe>
3779
- `
3780
- );
3781
- }
3782
- function serializeIframeUrl(attrs, props) {
3783
- if (!attrs.src) return;
3784
- const matches = attrs.src.match(MATCH_SRC);
3785
- const urlType = matches && matches[1];
3786
- const srcId = matches && matches[2];
3787
- const hParam = matches && matches[3];
3788
- const params = {
3789
- // ?controls=true is enabled by default in the iframe
3790
- controls: attrs.controls === "" ? null : 0,
3791
- autoplay: attrs.autoplay,
3792
- loop: attrs.loop,
3793
- muted: attrs.muted,
3794
- playsinline: attrs.playsinline,
3795
- preload: attrs.preload ?? "metadata",
3796
- transparent: false,
3797
- autopause: attrs.autopause,
3798
- h: hParam,
3799
- // This param is required when the video is Unlisted.
3800
- ...props.config
3801
- };
3802
- if (urlType === "event/") {
3803
- return `${EMBED_EVENT_BASE}/${srcId}/embed?${serialize(params)}`;
3804
- }
3805
- return `${EMBED_VIDEO_BASE}/${srcId}?${serialize(params)}`;
3806
- }
3807
- class VimeoVideoElement extends (globalThis.HTMLElement ?? class {
3808
- }) {
3809
- static getTemplateHTML = getTemplateHTML;
3810
- static shadowRootOptions = { mode: "open" };
3811
- static observedAttributes = [
3812
- "autoplay",
3813
- "controls",
3814
- "crossorigin",
3815
- "loop",
3816
- "muted",
3817
- "playsinline",
3818
- "poster",
3819
- "preload",
3820
- "src"
3821
- ];
3822
- loadComplete = new PublicPromise();
3823
- #loadRequested;
3824
- #hasLoaded;
3825
- #isInit;
3826
- #currentTime = 0;
3827
- #duration = NaN;
3828
- #muted = false;
3829
- #paused = !this.autoplay;
3830
- #playbackRate = 1;
3831
- #progress = 0;
3832
- #readyState = 0;
3833
- #seeking = false;
3834
- #volume = 1;
3835
- #videoWidth = NaN;
3836
- #videoHeight = NaN;
3837
- #config = null;
3838
- constructor() {
3839
- super();
3840
- this.#upgradeProperty("config");
3841
- }
3842
- requestFullscreen() {
3843
- var _a, _b;
3844
- return (_b = (_a = this.api) == null ? void 0 : _a.requestFullscreen) == null ? void 0 : _b.call(_a);
3845
- }
3846
- exitFullscreen() {
3847
- var _a, _b;
3848
- return (_b = (_a = this.api) == null ? void 0 : _a.exitFullscreen) == null ? void 0 : _b.call(_a);
3849
- }
3850
- requestPictureInPicture() {
3851
- var _a, _b;
3852
- return (_b = (_a = this.api) == null ? void 0 : _a.requestPictureInPicture) == null ? void 0 : _b.call(_a);
3853
- }
3854
- exitPictureInPicture() {
3855
- var _a, _b;
3856
- return (_b = (_a = this.api) == null ? void 0 : _a.exitPictureInPicture) == null ? void 0 : _b.call(_a);
3857
- }
3858
- get config() {
3859
- return this.#config;
3860
- }
3861
- set config(value) {
3862
- this.#config = value;
3863
- }
3864
- async load() {
3865
- var _a;
3866
- if (this.#loadRequested) return;
3867
- const isFirstLoad = !this.#hasLoaded;
3868
- if (this.#hasLoaded) this.loadComplete = new PublicPromise();
3869
- this.#hasLoaded = true;
3870
- await (this.#loadRequested = Promise.resolve());
3871
- this.#loadRequested = null;
3872
- this.#currentTime = 0;
3873
- this.#duration = NaN;
3874
- this.#muted = false;
3875
- this.#paused = !this.autoplay;
3876
- this.#playbackRate = 1;
3877
- this.#progress = 0;
3878
- this.#readyState = 0;
3879
- this.#seeking = false;
3880
- this.#volume = 1;
3881
- this.#readyState = 0;
3882
- this.#videoWidth = NaN;
3883
- this.#videoHeight = NaN;
3884
- this.dispatchEvent(new Event("emptied"));
3885
- let oldApi = this.api;
3886
- this.api = null;
3887
- if (!this.src) {
3888
- return;
3889
- }
3890
- this.dispatchEvent(new Event("loadstart"));
3891
- const options = {
3892
- autoplay: this.autoplay,
3893
- controls: this.controls,
3894
- loop: this.loop,
3895
- muted: this.defaultMuted,
3896
- playsinline: this.playsInline,
3897
- preload: this.preload ?? "metadata",
3898
- transparent: false,
3899
- autopause: this.hasAttribute("autopause"),
3900
- ...this.#config
3901
- };
3902
- const onLoaded = async () => {
3903
- this.#readyState = 1;
3904
- this.dispatchEvent(new Event("loadedmetadata"));
3905
- if (this.api) {
3906
- this.#muted = await this.api.getMuted();
3907
- this.#volume = await this.api.getVolume();
3908
- this.dispatchEvent(new Event("volumechange"));
3909
- this.#duration = await this.api.getDuration();
3910
- this.dispatchEvent(new Event("durationchange"));
3911
- }
3912
- this.dispatchEvent(new Event("loadcomplete"));
3913
- this.loadComplete.resolve();
3914
- };
3915
- if (this.#isInit) {
3916
- this.api = oldApi;
3917
- await this.api.loadVideo({
3918
- ...options,
3919
- url: this.src
3920
- });
3921
- await onLoaded();
3922
- await this.loadComplete;
3923
- return;
3924
- }
3925
- this.#isInit = true;
3926
- let iframe = (_a = this.shadowRoot) == null ? void 0 : _a.querySelector("iframe");
3927
- if (isFirstLoad && iframe) {
3928
- this.#config = JSON.parse(iframe.getAttribute("data-config") || "{}");
3929
- }
3930
- if (!this.shadowRoot) {
3931
- this.attachShadow({ mode: "open" });
3932
- this.shadowRoot.innerHTML = getTemplateHTML(namedNodeMapToObject(this.attributes), this);
3933
- iframe = this.shadowRoot.querySelector("iframe");
3934
- }
3935
- this.api = new _vimeo_player_dist_player_es_js__WEBPACK_IMPORTED_MODULE_0__["default"](iframe);
3936
- const textTracksVideo = document.createElement("video");
3937
- this.textTracks = textTracksVideo.textTracks;
3938
- this.api.getTextTracks().then((vimeoTracks) => {
3939
- vimeoTracks.forEach((t) => {
3940
- textTracksVideo.addTextTrack(t.kind, t.label, t.language);
3941
- });
3942
- });
3943
- this.textTracks.addEventListener("change", () => {
3944
- const active = Array.from(this.textTracks).find((t) => t.mode === "showing");
3945
- if (active) {
3946
- this.api.enableTextTrack(active.language, active.kind);
3947
- } else {
3948
- this.api.disableTextTrack();
3949
- }
3950
- });
3951
- const onceLoaded = () => {
3952
- this.api.off("loaded", onceLoaded);
3953
- onLoaded();
3954
- };
3955
- this.api.on("loaded", onceLoaded);
3956
- this.api.on("bufferstart", () => {
3957
- if (this.#paused) {
3958
- this.#paused = false;
3959
- this.dispatchEvent(new Event("play"));
3960
- }
3961
- this.dispatchEvent(new Event("waiting"));
3962
- });
3963
- this.api.on("play", () => {
3964
- if (!this.#paused) return;
3965
- this.#paused = false;
3966
- this.dispatchEvent(new Event("play"));
3967
- });
3968
- this.api.on("playing", () => {
3969
- this.#readyState = 3;
3970
- this.#paused = false;
3971
- this.dispatchEvent(new Event("playing"));
3972
- });
3973
- this.api.on("seeking", () => {
3974
- this.#seeking = true;
3975
- this.dispatchEvent(new Event("seeking"));
3976
- });
3977
- this.api.on("seeked", () => {
3978
- this.#seeking = false;
3979
- this.dispatchEvent(new Event("seeked"));
3980
- });
3981
- this.api.on("pause", () => {
3982
- this.#paused = true;
3983
- this.dispatchEvent(new Event("pause"));
3984
- });
3985
- this.api.on("ended", () => {
3986
- this.#paused = true;
3987
- this.dispatchEvent(new Event("ended"));
3988
- });
3989
- this.api.on("ratechange", ({ playbackRate }) => {
3990
- this.#playbackRate = playbackRate;
3991
- this.dispatchEvent(new Event("ratechange"));
3992
- });
3993
- this.api.on("volumechange", async ({ volume }) => {
3994
- this.#volume = volume;
3995
- if (this.api) {
3996
- this.#muted = await this.api.getMuted();
3997
- }
3998
- this.dispatchEvent(new Event("volumechange"));
3999
- });
4000
- this.api.on("durationchange", ({ duration }) => {
4001
- this.#duration = duration;
4002
- this.dispatchEvent(new Event("durationchange"));
4003
- });
4004
- this.api.on("timeupdate", ({ seconds }) => {
4005
- this.#currentTime = seconds;
4006
- this.dispatchEvent(new Event("timeupdate"));
4007
- });
4008
- this.api.on("progress", ({ seconds }) => {
4009
- this.#progress = seconds;
4010
- this.dispatchEvent(new Event("progress"));
4011
- });
4012
- this.api.on("resize", ({ videoWidth, videoHeight }) => {
4013
- this.#videoWidth = videoWidth;
4014
- this.#videoHeight = videoHeight;
4015
- this.dispatchEvent(new Event("resize"));
4016
- });
4017
- await this.loadComplete;
4018
- }
4019
- async attributeChangedCallback(attrName, oldValue, newValue) {
4020
- if (oldValue === newValue) return;
4021
- switch (attrName) {
4022
- case "autoplay":
4023
- case "controls":
4024
- case "src": {
4025
- this.load();
4026
- return;
4027
- }
4028
- }
4029
- await this.loadComplete;
4030
- switch (attrName) {
4031
- case "loop": {
4032
- this.api.setLoop(this.loop);
4033
- break;
4034
- }
4035
- }
4036
- }
4037
- async play() {
4038
- var _a;
4039
- this.#paused = false;
4040
- this.dispatchEvent(new Event("play"));
4041
- await this.loadComplete;
4042
- try {
4043
- await ((_a = this.api) == null ? void 0 : _a.play());
4044
- } catch (error) {
4045
- this.#paused = true;
4046
- this.dispatchEvent(new Event("pause"));
4047
- throw error;
4048
- }
4049
- }
4050
- async pause() {
4051
- var _a;
4052
- await this.loadComplete;
4053
- return (_a = this.api) == null ? void 0 : _a.pause();
4054
- }
4055
- get ended() {
4056
- return this.#currentTime >= this.#duration;
4057
- }
4058
- get seeking() {
4059
- return this.#seeking;
4060
- }
4061
- get readyState() {
4062
- return this.#readyState;
4063
- }
4064
- get videoWidth() {
4065
- return this.#videoWidth;
4066
- }
4067
- get videoHeight() {
4068
- return this.#videoHeight;
4069
- }
4070
- get src() {
4071
- return this.getAttribute("src");
4072
- }
4073
- set src(val) {
4074
- if (this.src == val) return;
4075
- this.setAttribute("src", val);
4076
- }
4077
- get paused() {
4078
- return this.#paused;
4079
- }
4080
- get duration() {
4081
- return this.#duration;
4082
- }
4083
- get autoplay() {
4084
- return this.hasAttribute("autoplay");
4085
- }
4086
- set autoplay(val) {
4087
- if (this.autoplay == val) return;
4088
- this.toggleAttribute("autoplay", Boolean(val));
4089
- }
4090
- get buffered() {
4091
- if (this.#progress > 0) {
4092
- return createTimeRanges(0, this.#progress);
4093
- }
4094
- return createTimeRanges();
4095
- }
4096
- get controls() {
4097
- return this.hasAttribute("controls");
4098
- }
4099
- set controls(val) {
4100
- if (this.controls == val) return;
4101
- this.toggleAttribute("controls", Boolean(val));
4102
- }
4103
- get currentTime() {
4104
- return this.#currentTime;
4105
- }
4106
- set currentTime(val) {
4107
- if (this.currentTime == val) return;
4108
- this.#currentTime = val;
4109
- this.loadComplete.then(() => {
4110
- var _a;
4111
- (_a = this.api) == null ? void 0 : _a.setCurrentTime(val).catch(() => {
4112
- });
4113
- });
4114
- }
4115
- get defaultMuted() {
4116
- return this.hasAttribute("muted");
4117
- }
4118
- set defaultMuted(val) {
4119
- if (this.defaultMuted == val) return;
4120
- this.toggleAttribute("muted", Boolean(val));
4121
- }
4122
- get loop() {
4123
- return this.hasAttribute("loop");
4124
- }
4125
- set loop(val) {
4126
- if (this.loop == val) return;
4127
- this.toggleAttribute("loop", Boolean(val));
4128
- }
4129
- get muted() {
4130
- return this.#muted;
4131
- }
4132
- set muted(val) {
4133
- if (this.muted == val) return;
4134
- this.#muted = val;
4135
- this.loadComplete.then(() => {
4136
- var _a;
4137
- (_a = this.api) == null ? void 0 : _a.setMuted(val).catch(() => {
4138
- });
4139
- });
4140
- }
4141
- get playbackRate() {
4142
- return this.#playbackRate;
4143
- }
4144
- set playbackRate(val) {
4145
- if (this.playbackRate == val) return;
4146
- this.#playbackRate = val;
4147
- this.loadComplete.then(() => {
4148
- var _a;
4149
- (_a = this.api) == null ? void 0 : _a.setPlaybackRate(val).catch(() => {
4150
- });
4151
- });
4152
- }
4153
- get playsInline() {
4154
- return this.hasAttribute("playsinline");
4155
- }
4156
- set playsInline(val) {
4157
- if (this.playsInline == val) return;
4158
- this.toggleAttribute("playsinline", Boolean(val));
4159
- }
4160
- get poster() {
4161
- return this.getAttribute("poster");
4162
- }
4163
- set poster(val) {
4164
- if (this.poster == val) return;
4165
- this.setAttribute("poster", `${val}`);
4166
- }
4167
- get volume() {
4168
- return this.#volume;
4169
- }
4170
- set volume(val) {
4171
- if (this.volume == val) return;
4172
- this.#volume = val;
4173
- this.loadComplete.then(() => {
4174
- var _a;
4175
- (_a = this.api) == null ? void 0 : _a.setVolume(val).catch(() => {
4176
- });
4177
- });
4178
- }
4179
- // This is a pattern to update property values that are set before
4180
- // the custom element is upgraded.
4181
- // https://web.dev/custom-elements-best-practices/#make-properties-lazy
4182
- #upgradeProperty(prop) {
4183
- if (Object.prototype.hasOwnProperty.call(this, prop)) {
4184
- const value = this[prop];
4185
- delete this[prop];
4186
- this[prop] = value;
4187
- }
4188
- }
4189
- }
4190
- function serializeAttributes(attrs) {
4191
- let html = "";
4192
- for (const key in attrs) {
4193
- const value = attrs[key];
4194
- if (value === "") html += ` ${escapeHtml(key)}`;
4195
- else html += ` ${escapeHtml(key)}="${escapeHtml(`${value}`)}"`;
4196
- }
4197
- return html;
4198
- }
4199
- function escapeHtml(str) {
4200
- return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;").replace(/`/g, "&#x60;");
4201
- }
4202
- function serialize(props) {
4203
- return String(new URLSearchParams(boolToBinary(props)));
4204
- }
4205
- function boolToBinary(props) {
4206
- let p = {};
4207
- for (let key in props) {
4208
- let val = props[key];
4209
- if (val === true || val === "") p[key] = 1;
4210
- else if (val === false) p[key] = 0;
4211
- else if (val != null) p[key] = val;
4212
- }
4213
- return p;
4214
- }
4215
- function namedNodeMapToObject(namedNodeMap) {
4216
- let obj = {};
4217
- for (let attr of namedNodeMap) {
4218
- obj[attr.name] = attr.value;
4219
- }
4220
- return obj;
4221
- }
4222
- class PublicPromise extends Promise {
4223
- constructor(executor = () => {
4224
- }) {
4225
- let res, rej;
4226
- super((resolve, reject) => {
4227
- executor(resolve, reject);
4228
- res = resolve;
4229
- rej = reject;
4230
- });
4231
- this.resolve = res;
4232
- this.reject = rej;
4233
- }
4234
- }
4235
- function createTimeRanges(start, end) {
4236
- if (Array.isArray(start)) {
4237
- return createTimeRangesObj(start);
4238
- } else if (start == null || end == null || start === 0 && end === 0) {
4239
- return createTimeRangesObj([[0, 0]]);
4240
- }
4241
- return createTimeRangesObj([[start, end]]);
4242
- }
4243
- function createTimeRangesObj(ranges) {
4244
- Object.defineProperties(ranges, {
4245
- start: {
4246
- value: (i) => ranges[i][0]
4247
- },
4248
- end: {
4249
- value: (i) => ranges[i][1]
4250
- }
4251
- });
4252
- return ranges;
4253
- }
4254
- if (globalThis.customElements && !globalThis.customElements.get("vimeo-video")) {
4255
- globalThis.customElements.define("vimeo-video", VimeoVideoElement);
4256
- }
4257
- var vimeo_video_element_default = VimeoVideoElement;
4258
-
4259
-
4260
-
4261
- }),
4262
-
4263
- }])
4264
- //# sourceMappingURL=reactPlayerVimeo.js.map