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