j1-template 2024.3.24 → 2024.3.25

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 (168) hide show
  1. checksums.yaml +4 -4
  2. data/assets/data/apps/amplitudehtml +1147 -0
  3. data/assets/data/apps/gallery.html +342 -0
  4. data/assets/data/{masonry.html → apps/masonry.html} +22 -9
  5. data/assets/data/apps/swiper.html +901 -0
  6. data/assets/data/masonry_app.html +521 -0
  7. data/assets/theme/j1/modules/lightGallery/css/theme/uno/uno.css +21 -13
  8. data/assets/theme/j1/modules/lightGallery/css/theme/uno/uno.min.css +1 -2
  9. data/assets/theme/j1/modules/lightGallery/js/lightgallery.js +14 -13
  10. data/assets/theme/j1/modules/lightGallery/js/lightgallery.min.js +1 -1
  11. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.js +265 -226
  12. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.min.js +1 -1
  13. data/assets/theme/j1/modules/videojs/css/themes/uno.css +12 -2
  14. data/assets/theme/j1/modules/videojs/css/videojs.css +2 -3
  15. data/assets/theme/j1/modules/videojs/css/videojs.min.css +1 -1
  16. data/assets/theme/j1/modules/videojs/plugins/controls/zoom/css/zoom.css +55 -55
  17. data/assets/theme/j1/modules/videojs/plugins/controls/zoom/css/zoom.min.css +2 -1
  18. data/assets/theme/j1/modules/videojs/plugins/controls/zoom/js/zoom.js +590 -382
  19. data/assets/theme/j1/modules/videojs/plugins/controls/zoom/js/zoom.min.js +1 -1
  20. data/assets/theme/j1/modules/videojs/plugins/j1_core/template.min.js +31 -0
  21. data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/{simple.html → index.html} +11 -10
  22. data/assets/theme/j1/modules/videojs/plugins/players/dm/js/dailymotion.0.js +647 -0
  23. data/assets/theme/j1/modules/videojs/plugins/players/dm/js/dailymotion.1.js +653 -0
  24. data/assets/theme/j1/modules/videojs/plugins/players/vm/!examples/{player → iframe_api}/index.html +3 -3
  25. data/assets/theme/j1/modules/videojs/plugins/players/vm/!examples/{index.html → videojs_api/index.html} +7 -3
  26. data/assets/theme/j1/modules/videojs/plugins/players/vm/api/js/v2.21.0/vimeo.js +3562 -0
  27. data/assets/theme/j1/modules/videojs/plugins/players/vm/api/js/v2.21.0/vimeo.min.js +36 -0
  28. data/assets/theme/j1/modules/videojs/plugins/players/vm/api/js/vimeo.js +451 -1849
  29. data/assets/theme/j1/modules/videojs/plugins/players/vm/api/js/vimeo.min.js +2 -14
  30. data/assets/theme/j1/modules/videojs/plugins/players/vm/js/LICENSE +21 -0
  31. data/assets/theme/j1/modules/videojs/plugins/players/vm/js/README.md +54 -0
  32. data/assets/theme/j1/modules/videojs/plugins/players/vm/js/old/vimeo.js +666 -0
  33. data/assets/theme/j1/modules/videojs/plugins/players/vm/js/old/vimeo.min.js +28 -0
  34. data/assets/theme/j1/modules/videojs/plugins/players/vm/js/vimeo.js +2318 -548
  35. data/assets/theme/j1/modules/videojs/plugins/players/vm/js/vimeo.min.js +12 -18
  36. data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/{simple.html → index.html} +15 -6
  37. data/assets/theme/j1/modules/videojs/plugins/players/yt/js/youtube.js +12 -5
  38. data/assets/theme/j1/modules/videojs/plugins/players/yt/js/youtube.min.js +1 -1
  39. data/lib/j1/version.rb +1 -1
  40. data/lib/starter_web/Gemfile +1 -1
  41. data/lib/starter_web/README.md +5 -5
  42. data/lib/starter_web/_config.yml +2 -2
  43. data/lib/starter_web/_data/blocks/banner.yml +1 -1
  44. data/lib/starter_web/_data/j1_config.yml +1 -1
  45. data/lib/starter_web/_data/layouts/home.yml +1 -1
  46. data/lib/starter_web/_data/modules/authentication.yml +1 -2
  47. data/lib/starter_web/_data/modules/defaults/masonry.yml +1 -1
  48. data/lib/starter_web/_data/modules/gallery.yml +35 -24
  49. data/lib/starter_web/_data/modules/log4javascript.yml +1 -1
  50. data/lib/starter_web/_data/modules/masonry.yml +30 -14
  51. data/lib/starter_web/_data/modules/navigator.yml +1 -1
  52. data/lib/starter_web/_data/modules/navigator_menu.yml +12 -8
  53. data/lib/starter_web/_data/templates/feed.xml +1 -1
  54. data/lib/starter_web/_plugins/asciidoctor/dailymotion-block.rb +206 -24
  55. data/lib/starter_web/_plugins/index/lunr.rb +1 -1
  56. data/lib/starter_web/assets/image/module/attic/1920x1280/admin-dashboard-bootstrap.jpg +0 -0
  57. data/lib/starter_web/assets/image/module/attic/1920x1280/alexander-redl.jpg +0 -0
  58. data/lib/starter_web/assets/image/module/attic/1920x1280/alexander-shatov.jpg +0 -0
  59. data/lib/starter_web/assets/image/module/attic/1920x1280/alexey-ruban.jpg +0 -0
  60. data/lib/starter_web/assets/image/module/attic/1920x1280/andrea-badino.jpg +0 -0
  61. data/lib/starter_web/assets/image/module/attic/1920x1280/bootstrap-modal.jpg +0 -0
  62. data/lib/starter_web/assets/image/module/attic/1920x1280/bp-miller.jpg +0 -0
  63. data/lib/starter_web/assets/image/module/attic/1920x1280/brad-neathery.jpg +0 -0
  64. data/lib/starter_web/assets/image/module/attic/1920x1280/brigitta-schneiter.jpg +0 -0
  65. data/lib/starter_web/assets/image/module/attic/1920x1280/build-with-gemini.jpg +0 -0
  66. data/lib/starter_web/assets/image/module/attic/1920x1280/clem-onojeghuo.jpg +0 -0
  67. data/lib/starter_web/assets/image/module/attic/1920x1280/eleni-afiontzi.jpg +0 -0
  68. data/lib/starter_web/assets/image/module/attic/1920x1280/fly-d.jpg +0 -0
  69. data/lib/starter_web/assets/image/module/attic/1920x1280/guillaume-bolduc.jpg +0 -0
  70. data/lib/starter_web/assets/image/module/attic/1920x1280/ideas-start-here-1920x1280.jpg +0 -0
  71. data/lib/starter_web/assets/image/module/attic/1920x1280/isaac-davis.jpg +0 -0
  72. data/lib/starter_web/assets/image/module/attic/1920x1280/j1-launch.jpg +0 -0
  73. data/lib/starter_web/assets/image/module/attic/1920x1280/j1-mockup.jpg +0 -0
  74. data/lib/starter_web/assets/image/module/attic/1920x1280/john-schnobrich-2.jpg +0 -0
  75. data/lib/starter_web/assets/image/module/attic/1920x1280/josep-martins.jpg +0 -0
  76. data/lib/starter_web/assets/image/module/attic/1920x1280/josh-liu.jpg +0 -0
  77. data/lib/starter_web/assets/image/module/attic/1920x1280/kelly-sikkemal.jpg +0 -0
  78. data/lib/starter_web/assets/image/module/attic/1920x1280/kira-auf-der-heide.jpg +0 -0
  79. data/lib/starter_web/assets/image/module/attic/1920x1280/kristopher-roller.jpg +0 -0
  80. data/lib/starter_web/assets/image/module/attic/1920x1280/markus-spiske.jpg +0 -0
  81. data/lib/starter_web/assets/image/module/attic/1920x1280/martin-sanchez.jpg +0 -0
  82. data/lib/starter_web/assets/image/module/attic/1920x1280/material_symbols.jpg +0 -0
  83. data/lib/starter_web/assets/image/module/attic/1920x1280/matthaeus.jpg +0 -0
  84. data/lib/starter_web/assets/image/module/attic/1920x1280/melanie-deziel.jpg +0 -0
  85. data/lib/starter_web/assets/image/module/attic/1920x1280/nasa.jpg +0 -0
  86. data/lib/starter_web/assets/image/module/attic/1920x1280/quino-al-2.jpg +0 -0
  87. data/lib/starter_web/assets/image/module/attic/1920x1280/stories-ink-tattoo-care.jpg +0 -0
  88. data/lib/starter_web/assets/image/module/attic/1920x1280/towfiqu-barbhuiya.jpg +0 -0
  89. data/lib/starter_web/collections/posts/public/featured/_posts/0000-00-00-welcome-to-j1.adoc.erb +1 -1
  90. data/lib/starter_web/collections/posts/public/featured/_posts/2022-02-01-about-j1.adoc +2 -2
  91. data/lib/starter_web/collections/posts/public/featured/_posts/2023-10-18-url-types.adoc +2 -2
  92. data/lib/starter_web/config.ru +1 -1
  93. data/lib/starter_web/dot.gitattributes +1 -1
  94. data/lib/starter_web/index.html +8 -8
  95. data/lib/starter_web/package.json +1 -1
  96. data/lib/starter_web/pages/public/about/features.adoc +5 -5
  97. data/lib/starter_web/pages/public/about/reporting_issues.adoc +5 -5
  98. data/lib/starter_web/pages/public/about/site.adoc +14 -10
  99. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/000_intro.adoc +1 -1
  100. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/100_converter.adoc +1 -1
  101. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/200_themes.adoc +1 -1
  102. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/documentation.adoc +1 -1
  103. data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/multi.adoc +1 -1
  104. data/lib/starter_web/pages/public/asciidoc_skeletons/simple-document/simple.adoc +1 -1
  105. data/lib/starter_web/pages/public/blog/navigator/archive/allview.html +1 -1
  106. data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +1 -1
  107. data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +1 -1
  108. data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +1 -1
  109. data/lib/starter_web/pages/public/blog/navigator/index.html +1 -1
  110. data/lib/starter_web/pages/public/learn/bookshelf/article_previewer/viewer_biography.adoc +1 -1
  111. data/lib/starter_web/pages/public/learn/bookshelf/article_previewer/viewer_fantasy.adoc +1 -1
  112. data/lib/starter_web/pages/public/learn/bookshelf/article_previewer/viewer_romance.adoc +1 -1
  113. data/lib/starter_web/pages/public/learn/bookshelf/jekyll_collections.adoc +1 -1
  114. data/lib/starter_web/pages/public/learn/bookshelf/viewer_all_books.adoc +1 -1
  115. data/lib/starter_web/pages/public/learn/where_to_go.adoc +1 -1
  116. data/lib/starter_web/pages/public/legal/en/100_copyright.adoc +3 -3
  117. data/lib/starter_web/pages/public/legal/en/200_impress.adoc +3 -3
  118. data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +3 -3
  119. data/lib/starter_web/pages/public/legal/en/400_comment_policy.adoc +3 -3
  120. data/lib/starter_web/pages/public/panels/intro_panel/panel.adoc +1 -4
  121. data/lib/starter_web/pages/public/plans/plans.adoc +1 -1
  122. data/lib/starter_web/pages/public/tools/previewer/preview_bootstrap_theme.adoc +1 -1
  123. data/lib/starter_web/pages/public/tools/tester/videojs_macro_tester.adoc +116 -43
  124. data/lib/starter_web/pages/public/tour/_includes/documents/419_advanced_modals_demo.asciidoc +1 -1
  125. data/lib/starter_web/pages/public/tour/video_data.adoc +28 -22
  126. metadata +25 -49
  127. data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/dailymotion-controls.html +0 -18
  128. data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/dailymotion-javascript.html +0 -28
  129. data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/dailymotion-playlist.html +0 -19
  130. data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/global-parameters.html +0 -30
  131. data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/switch.html +0 -39
  132. data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/global-parameters.html +0 -34
  133. data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/switch.html +0 -39
  134. data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/youtube-controls.html +0 -20
  135. data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/youtube-javascript.html +0 -29
  136. data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/youtube-list.html +0 -21
  137. data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/youtube-playlist.html +0 -21
  138. data/lib/starter_web/assets/image/module/attic/1920x1280/j1-content-mockup-2.jpg +0 -0
  139. data/lib/starter_web/assets/image/module/attic/1920x1280/j1-content-mockup-3.jpg +0 -0
  140. data/lib/starter_web/assets/image/module/attic/1920x1280/j1-starter-mockup-1.jpg +0 -0
  141. data/lib/starter_web/assets/image/module/attic/admin-dashboard-bootstrap-1280x600.jpg +0 -0
  142. data/lib/starter_web/assets/image/module/attic/alice-donovan-rouse-2.jpg +0 -0
  143. data/lib/starter_web/assets/image/module/attic/building-blocks-1920x1280.jpg +0 -0
  144. data/lib/starter_web/assets/image/module/attic/christina-1920x1280.jpg +0 -0
  145. data/lib/starter_web/assets/image/module/attic/franck-1920x1280.jpg +0 -0
  146. data/lib/starter_web/assets/image/module/attic/giammarco-boscaro-1920x1280.jpg +0 -0
  147. data/lib/starter_web/assets/image/module/attic/jessica-ruscello-1920x1280.jpg +0 -0
  148. data/lib/starter_web/assets/image/module/attic/joanna-kosinska-1920x1280.jpg +0 -0
  149. data/lib/starter_web/assets/image/module/attic/leon-1920x1280.jpg +0 -0
  150. data/lib/starter_web/assets/image/module/attic/lianhao-1920x1280.jpg +0 -0
  151. data/lib/starter_web/assets/image/module/attic/library-1920x1280.jpg +0 -0
  152. data/lib/starter_web/assets/image/module/attic/markus-krisetya-1920x1280.jpg +0 -0
  153. data/lib/starter_web/assets/image/module/attic/markus-spiske-1920x1280.jpg +0 -0
  154. data/lib/starter_web/assets/image/module/attic/markus-spiske4-1920x1280.jpg +0 -0
  155. data/lib/starter_web/assets/image/module/attic/matthaeus-1920x1280.jpg +0 -0
  156. data/lib/starter_web/assets/image/module/attic/matthew-dockery-1920x1280.jpg +0 -0
  157. data/lib/starter_web/assets/image/module/attic/no-time-1920x1280.jpg +0 -0
  158. data/lib/starter_web/assets/image/module/attic/rirri-1920x1280.jpg +0 -0
  159. data/lib/starter_web/assets/image/module/attic/shubham-dhage-1920x1280.jpg +0 -0
  160. data/lib/starter_web/assets/image/module/attic/shutterstock_sponsor-1920x1280.jpg +0 -0
  161. data/lib/starter_web/assets/image/module/attic/sigmund-1920x1280.jpg +0 -0
  162. data/lib/starter_web/assets/image/module/attic/szabo-viktor-1920x1280.jpg +0 -0
  163. data/lib/starter_web/assets/image/module/attic/themes-1920x1280-bw.jpg +0 -0
  164. data/lib/starter_web/assets/image/module/attic/tldr-1920x800.jpg +0 -0
  165. data/lib/starter_web/assets/image/module/attic/vladislav-klapin-1920x1280.jpg +0 -0
  166. data/lib/starter_web/assets/image/module/attic/yellow-cactus-1920x1280.jpg +0 -0
  167. /data/assets/theme/j1/modules/videojs/plugins/players/vm/{LICENSE → js/old/LICENSE} +0 -0
  168. /data/assets/theme/j1/modules/videojs/plugins/players/vm/{README.md → js/old/README.md} +0 -0
@@ -19,528 +19,35 @@
19
19
  # -----------------------------------------------------------------------------
20
20
  */
21
21
 
22
- /*! @vimeo/player v2.21.0 | (c) 2024 Vimeo | MIT License | https://github.com/vimeo/player.js */
22
+ /*! @vimeo/player v2.10.0 | (c) 2019 Vimeo | MIT License | https://github.com/vimeo/player.js */
23
23
 
24
24
  (function (global, factory) {
25
25
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
26
26
  typeof define === 'function' && define.amd ? define(factory) :
27
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.VM = global.VM || {}, global.VM.Player = factory()));
28
- }(this, (function () { 'use strict';
29
-
30
- function ownKeys(object, enumerableOnly) {
31
- var keys = Object.keys(object);
32
- if (Object.getOwnPropertySymbols) {
33
- var symbols = Object.getOwnPropertySymbols(object);
34
- enumerableOnly && (symbols = symbols.filter(function (sym) {
35
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
36
- })), keys.push.apply(keys, symbols);
37
- }
38
- return keys;
39
- }
40
- function _objectSpread2(target) {
41
- for (var i = 1; i < arguments.length; i++) {
42
- var source = null != arguments[i] ? arguments[i] : {};
43
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
44
- _defineProperty(target, key, source[key]);
45
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
46
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
47
- });
48
- }
49
- return target;
50
- }
51
- function _regeneratorRuntime() {
52
- _regeneratorRuntime = function () {
53
- return exports;
54
- };
55
- var exports = {},
56
- Op = Object.prototype,
57
- hasOwn = Op.hasOwnProperty,
58
- defineProperty = Object.defineProperty || function (obj, key, desc) {
59
- obj[key] = desc.value;
60
- },
61
- $Symbol = "function" == typeof Symbol ? Symbol : {},
62
- iteratorSymbol = $Symbol.iterator || "@@iterator",
63
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
64
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
65
- function define(obj, key, value) {
66
- return Object.defineProperty(obj, key, {
67
- value: value,
68
- enumerable: !0,
69
- configurable: !0,
70
- writable: !0
71
- }), obj[key];
72
- }
73
- try {
74
- define({}, "");
75
- } catch (err) {
76
- define = function (obj, key, value) {
77
- return obj[key] = value;
78
- };
79
- }
80
- function wrap(innerFn, outerFn, self, tryLocsList) {
81
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
82
- generator = Object.create(protoGenerator.prototype),
83
- context = new Context(tryLocsList || []);
84
- return defineProperty(generator, "_invoke", {
85
- value: makeInvokeMethod(innerFn, self, context)
86
- }), generator;
87
- }
88
- function tryCatch(fn, obj, arg) {
89
- try {
90
- return {
91
- type: "normal",
92
- arg: fn.call(obj, arg)
93
- };
94
- } catch (err) {
95
- return {
96
- type: "throw",
97
- arg: err
98
- };
99
- }
100
- }
101
- exports.wrap = wrap;
102
- var ContinueSentinel = {};
103
- function Generator() {}
104
- function GeneratorFunction() {}
105
- function GeneratorFunctionPrototype() {}
106
- var IteratorPrototype = {};
107
- define(IteratorPrototype, iteratorSymbol, function () {
108
- return this;
109
- });
110
- var getProto = Object.getPrototypeOf,
111
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
112
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
113
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
114
- function defineIteratorMethods(prototype) {
115
- ["next", "throw", "return"].forEach(function (method) {
116
- define(prototype, method, function (arg) {
117
- return this._invoke(method, arg);
118
- });
119
- });
120
- }
121
- function AsyncIterator(generator, PromiseImpl) {
122
- function invoke(method, arg, resolve, reject) {
123
- var record = tryCatch(generator[method], generator, arg);
124
- if ("throw" !== record.type) {
125
- var result = record.arg,
126
- value = result.value;
127
- return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
128
- invoke("next", value, resolve, reject);
129
- }, function (err) {
130
- invoke("throw", err, resolve, reject);
131
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
132
- result.value = unwrapped, resolve(result);
133
- }, function (error) {
134
- return invoke("throw", error, resolve, reject);
135
- });
136
- }
137
- reject(record.arg);
138
- }
139
- var previousPromise;
140
- defineProperty(this, "_invoke", {
141
- value: function (method, arg) {
142
- function callInvokeWithMethodAndArg() {
143
- return new PromiseImpl(function (resolve, reject) {
144
- invoke(method, arg, resolve, reject);
145
- });
146
- }
147
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
148
- }
149
- });
150
- }
151
- function makeInvokeMethod(innerFn, self, context) {
152
- var state = "suspendedStart";
153
- return function (method, arg) {
154
- if ("executing" === state) throw new Error("Generator is already running");
155
- if ("completed" === state) {
156
- if ("throw" === method) throw arg;
157
- return doneResult();
158
- }
159
- for (context.method = method, context.arg = arg;;) {
160
- var delegate = context.delegate;
161
- if (delegate) {
162
- var delegateResult = maybeInvokeDelegate(delegate, context);
163
- if (delegateResult) {
164
- if (delegateResult === ContinueSentinel) continue;
165
- return delegateResult;
166
- }
167
- }
168
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
169
- if ("suspendedStart" === state) throw state = "completed", context.arg;
170
- context.dispatchException(context.arg);
171
- } else "return" === context.method && context.abrupt("return", context.arg);
172
- state = "executing";
173
- var record = tryCatch(innerFn, self, context);
174
- if ("normal" === record.type) {
175
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
176
- return {
177
- value: record.arg,
178
- done: context.done
179
- };
180
- }
181
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
182
- }
183
- };
184
- }
185
- function maybeInvokeDelegate(delegate, context) {
186
- var methodName = context.method,
187
- method = delegate.iterator[methodName];
188
- 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;
189
- var record = tryCatch(method, delegate.iterator, context.arg);
190
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
191
- var info = record.arg;
192
- 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);
193
- }
194
- function pushTryEntry(locs) {
195
- var entry = {
196
- tryLoc: locs[0]
197
- };
198
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
199
- }
200
- function resetTryEntry(entry) {
201
- var record = entry.completion || {};
202
- record.type = "normal", delete record.arg, entry.completion = record;
203
- }
204
- function Context(tryLocsList) {
205
- this.tryEntries = [{
206
- tryLoc: "root"
207
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
208
- }
209
- function values(iterable) {
210
- if (iterable) {
211
- var iteratorMethod = iterable[iteratorSymbol];
212
- if (iteratorMethod) return iteratorMethod.call(iterable);
213
- if ("function" == typeof iterable.next) return iterable;
214
- if (!isNaN(iterable.length)) {
215
- var i = -1,
216
- next = function next() {
217
- for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
218
- return next.value = undefined, next.done = !0, next;
219
- };
220
- return next.next = next;
221
- }
222
- }
223
- return {
224
- next: doneResult
225
- };
226
- }
227
- function doneResult() {
228
- return {
229
- value: undefined,
230
- done: !0
231
- };
232
- }
233
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
234
- value: GeneratorFunctionPrototype,
235
- configurable: !0
236
- }), defineProperty(GeneratorFunctionPrototype, "constructor", {
237
- value: GeneratorFunction,
238
- configurable: !0
239
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
240
- var ctor = "function" == typeof genFun && genFun.constructor;
241
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
242
- }, exports.mark = function (genFun) {
243
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
244
- }, exports.awrap = function (arg) {
245
- return {
246
- __await: arg
247
- };
248
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
249
- return this;
250
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
251
- void 0 === PromiseImpl && (PromiseImpl = Promise);
252
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
253
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
254
- return result.done ? result.value : iter.next();
255
- });
256
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
257
- return this;
258
- }), define(Gp, "toString", function () {
259
- return "[object Generator]";
260
- }), exports.keys = function (val) {
261
- var object = Object(val),
262
- keys = [];
263
- for (var key in object) keys.push(key);
264
- return keys.reverse(), function next() {
265
- for (; keys.length;) {
266
- var key = keys.pop();
267
- if (key in object) return next.value = key, next.done = !1, next;
268
- }
269
- return next.done = !0, next;
270
- };
271
- }, exports.values = values, Context.prototype = {
272
- constructor: Context,
273
- reset: function (skipTempReset) {
274
- 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);
275
- },
276
- stop: function () {
277
- this.done = !0;
278
- var rootRecord = this.tryEntries[0].completion;
279
- if ("throw" === rootRecord.type) throw rootRecord.arg;
280
- return this.rval;
281
- },
282
- dispatchException: function (exception) {
283
- if (this.done) throw exception;
284
- var context = this;
285
- function handle(loc, caught) {
286
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
287
- }
288
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
289
- var entry = this.tryEntries[i],
290
- record = entry.completion;
291
- if ("root" === entry.tryLoc) return handle("end");
292
- if (entry.tryLoc <= this.prev) {
293
- var hasCatch = hasOwn.call(entry, "catchLoc"),
294
- hasFinally = hasOwn.call(entry, "finallyLoc");
295
- if (hasCatch && hasFinally) {
296
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
297
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
298
- } else if (hasCatch) {
299
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
300
- } else {
301
- if (!hasFinally) throw new Error("try statement without catch or finally");
302
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
303
- }
304
- }
305
- }
306
- },
307
- abrupt: function (type, arg) {
308
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
309
- var entry = this.tryEntries[i];
310
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
311
- var finallyEntry = entry;
312
- break;
313
- }
314
- }
315
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
316
- var record = finallyEntry ? finallyEntry.completion : {};
317
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
318
- },
319
- complete: function (record, afterLoc) {
320
- if ("throw" === record.type) throw record.arg;
321
- 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;
322
- },
323
- finish: function (finallyLoc) {
324
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
325
- var entry = this.tryEntries[i];
326
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
327
- }
328
- },
329
- catch: function (tryLoc) {
330
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
331
- var entry = this.tryEntries[i];
332
- if (entry.tryLoc === tryLoc) {
333
- var record = entry.completion;
334
- if ("throw" === record.type) {
335
- var thrown = record.arg;
336
- resetTryEntry(entry);
337
- }
338
- return thrown;
339
- }
340
- }
341
- throw new Error("illegal catch attempt");
342
- },
343
- delegateYield: function (iterable, resultName, nextLoc) {
344
- return this.delegate = {
345
- iterator: values(iterable),
346
- resultName: resultName,
347
- nextLoc: nextLoc
348
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
349
- }
350
- }, exports;
351
- }
352
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
353
- try {
354
- var info = gen[key](arg);
355
- var value = info.value;
356
- } catch (error) {
357
- reject(error);
358
- return;
359
- }
360
- if (info.done) {
361
- resolve(value);
362
- } else {
363
- Promise.resolve(value).then(_next, _throw);
364
- }
365
- }
366
- function _asyncToGenerator(fn) {
367
- return function () {
368
- var self = this,
369
- args = arguments;
370
- return new Promise(function (resolve, reject) {
371
- var gen = fn.apply(self, args);
372
- function _next(value) {
373
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
374
- }
375
- function _throw(err) {
376
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
377
- }
378
- _next(undefined);
379
- });
380
- };
381
- }
27
+ (global = global || self, (global.Vimeo = global.Vimeo || {}, global.Vimeo.Player = factory()));
28
+ }(this, function () { 'use strict';
29
+
382
30
  function _classCallCheck(instance, Constructor) {
383
31
  if (!(instance instanceof Constructor)) {
384
32
  throw new TypeError("Cannot call a class as a function");
385
33
  }
386
34
  }
35
+
387
36
  function _defineProperties(target, props) {
388
37
  for (var i = 0; i < props.length; i++) {
389
38
  var descriptor = props[i];
390
39
  descriptor.enumerable = descriptor.enumerable || false;
391
40
  descriptor.configurable = true;
392
41
  if ("value" in descriptor) descriptor.writable = true;
393
- Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
42
+ Object.defineProperty(target, descriptor.key, descriptor);
394
43
  }
395
44
  }
45
+
396
46
  function _createClass(Constructor, protoProps, staticProps) {
397
47
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
398
48
  if (staticProps) _defineProperties(Constructor, staticProps);
399
- Object.defineProperty(Constructor, "prototype", {
400
- writable: false
401
- });
402
49
  return Constructor;
403
50
  }
404
- function _defineProperty(obj, key, value) {
405
- key = _toPropertyKey(key);
406
- if (key in obj) {
407
- Object.defineProperty(obj, key, {
408
- value: value,
409
- enumerable: true,
410
- configurable: true,
411
- writable: true
412
- });
413
- } else {
414
- obj[key] = value;
415
- }
416
- return obj;
417
- }
418
- function _inherits(subClass, superClass) {
419
- if (typeof superClass !== "function" && superClass !== null) {
420
- throw new TypeError("Super expression must either be null or a function");
421
- }
422
- subClass.prototype = Object.create(superClass && superClass.prototype, {
423
- constructor: {
424
- value: subClass,
425
- writable: true,
426
- configurable: true
427
- }
428
- });
429
- Object.defineProperty(subClass, "prototype", {
430
- writable: false
431
- });
432
- if (superClass) _setPrototypeOf(subClass, superClass);
433
- }
434
- function _getPrototypeOf(o) {
435
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
436
- return o.__proto__ || Object.getPrototypeOf(o);
437
- };
438
- return _getPrototypeOf(o);
439
- }
440
- function _setPrototypeOf(o, p) {
441
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
442
- o.__proto__ = p;
443
- return o;
444
- };
445
- return _setPrototypeOf(o, p);
446
- }
447
- function _isNativeReflectConstruct() {
448
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
449
- if (Reflect.construct.sham) return false;
450
- if (typeof Proxy === "function") return true;
451
- try {
452
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
453
- return true;
454
- } catch (e) {
455
- return false;
456
- }
457
- }
458
- function _construct(Parent, args, Class) {
459
- if (_isNativeReflectConstruct()) {
460
- _construct = Reflect.construct.bind();
461
- } else {
462
- _construct = function _construct(Parent, args, Class) {
463
- var a = [null];
464
- a.push.apply(a, args);
465
- var Constructor = Function.bind.apply(Parent, a);
466
- var instance = new Constructor();
467
- if (Class) _setPrototypeOf(instance, Class.prototype);
468
- return instance;
469
- };
470
- }
471
- return _construct.apply(null, arguments);
472
- }
473
- function _isNativeFunction(fn) {
474
- return Function.toString.call(fn).indexOf("[native code]") !== -1;
475
- }
476
- function _wrapNativeSuper(Class) {
477
- var _cache = typeof Map === "function" ? new Map() : undefined;
478
- _wrapNativeSuper = function _wrapNativeSuper(Class) {
479
- if (Class === null || !_isNativeFunction(Class)) return Class;
480
- if (typeof Class !== "function") {
481
- throw new TypeError("Super expression must either be null or a function");
482
- }
483
- if (typeof _cache !== "undefined") {
484
- if (_cache.has(Class)) return _cache.get(Class);
485
- _cache.set(Class, Wrapper);
486
- }
487
- function Wrapper() {
488
- return _construct(Class, arguments, _getPrototypeOf(this).constructor);
489
- }
490
- Wrapper.prototype = Object.create(Class.prototype, {
491
- constructor: {
492
- value: Wrapper,
493
- enumerable: false,
494
- writable: true,
495
- configurable: true
496
- }
497
- });
498
- return _setPrototypeOf(Wrapper, Class);
499
- };
500
- return _wrapNativeSuper(Class);
501
- }
502
- function _assertThisInitialized(self) {
503
- if (self === void 0) {
504
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
505
- }
506
- return self;
507
- }
508
- function _possibleConstructorReturn(self, call) {
509
- if (call && (typeof call === "object" || typeof call === "function")) {
510
- return call;
511
- } else if (call !== void 0) {
512
- throw new TypeError("Derived constructors may only return object or undefined");
513
- }
514
- return _assertThisInitialized(self);
515
- }
516
- function _createSuper(Derived) {
517
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
518
- return function _createSuperInternal() {
519
- var Super = _getPrototypeOf(Derived),
520
- result;
521
- if (hasNativeReflectConstruct) {
522
- var NewTarget = _getPrototypeOf(this).constructor;
523
- result = Reflect.construct(Super, arguments, NewTarget);
524
- } else {
525
- result = Super.apply(this, arguments);
526
- }
527
- return _possibleConstructorReturn(this, result);
528
- };
529
- }
530
- function _toPrimitive(input, hint) {
531
- if (typeof input !== "object" || input === null) return input;
532
- var prim = input[Symbol.toPrimitive];
533
- if (prim !== undefined) {
534
- var res = prim.call(input, hint || "default");
535
- if (typeof res !== "object") return res;
536
- throw new TypeError("@@toPrimitive must return a primitive value.");
537
- }
538
- return (hint === "string" ? String : Number)(input);
539
- }
540
- function _toPropertyKey(arg) {
541
- var key = _toPrimitive(arg, "string");
542
- return typeof key === "symbol" ? key : String(key);
543
- }
544
51
 
545
52
  /**
546
53
  * @module lib/functions
@@ -550,9 +57,9 @@
550
57
  * Check to see this is a node environment.
551
58
  * @type {Boolean}
552
59
  */
60
+
553
61
  /* global global */
554
62
  var isNode = typeof global !== 'undefined' && {}.toString.call(global) === '[object global]';
555
-
556
63
  /**
557
64
  * Get the name of the method for a given getter or setter.
558
65
  *
@@ -560,23 +67,24 @@
560
67
  * @param {string} type Either “get” or “set”.
561
68
  * @return {string}
562
69
  */
70
+
563
71
  function getMethodName(prop, type) {
564
72
  if (prop.indexOf(type.toLowerCase()) === 0) {
565
73
  return prop;
566
74
  }
75
+
567
76
  return "".concat(type.toLowerCase()).concat(prop.substr(0, 1).toUpperCase()).concat(prop.substr(1));
568
77
  }
569
-
570
78
  /**
571
79
  * Check to see if the object is a DOM Element.
572
80
  *
573
81
  * @param {*} element The object to check.
574
82
  * @return {boolean}
575
83
  */
84
+
576
85
  function isDomElement(element) {
577
86
  return Boolean(element && element.nodeType === 1 && 'nodeName' in element && element.ownerDocument && element.ownerDocument.defaultView);
578
87
  }
579
-
580
88
  /**
581
89
  * Check to see whether the value is a number.
582
90
  *
@@ -585,32 +93,21 @@
585
93
  * @param {boolean} integer Check if the value is an integer.
586
94
  * @return {boolean}
587
95
  */
96
+
588
97
  function isInteger(value) {
589
98
  // eslint-disable-next-line eqeqeq
590
99
  return !isNaN(parseFloat(value)) && isFinite(value) && Math.floor(value) == value;
591
100
  }
592
-
593
101
  /**
594
102
  * Check to see if the URL is a Vimeo url.
595
103
  *
596
104
  * @param {string} url The url string.
597
105
  * @return {boolean}
598
106
  */
107
+
599
108
  function isVimeoUrl(url) {
600
109
  return /^(https?:)?\/\/((player|www)\.)?vimeo\.com(?=$|\/)/.test(url);
601
110
  }
602
-
603
- /**
604
- * Check to see if the URL is for a Vimeo embed.
605
- *
606
- * @param {string} url The url string.
607
- * @return {boolean}
608
- */
609
- function isVimeoEmbed(url) {
610
- var expr = /^https:\/\/player\.vimeo\.com\/video\/\d+/;
611
- return expr.test(url);
612
- }
613
-
614
111
  /**
615
112
  * Get the Vimeo URL from an element.
616
113
  * The element must have either a data-vimeo-id or data-vimeo-url attribute.
@@ -618,88 +115,61 @@
618
115
  * @param {object} oEmbedParameters The oEmbed parameters.
619
116
  * @return {string}
620
117
  */
118
+
621
119
  function getVimeoUrl() {
622
120
  var oEmbedParameters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
623
121
  var id = oEmbedParameters.id;
624
122
  var url = oEmbedParameters.url;
625
123
  var idOrUrl = id || url;
124
+
626
125
  if (!idOrUrl) {
627
126
  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.');
628
127
  }
128
+
629
129
  if (isInteger(idOrUrl)) {
630
130
  return "https://vimeo.com/".concat(idOrUrl);
631
131
  }
132
+
632
133
  if (isVimeoUrl(idOrUrl)) {
633
134
  return idOrUrl.replace('http:', 'https:');
634
135
  }
136
+
635
137
  if (id) {
636
138
  throw new TypeError("\u201C".concat(id, "\u201D is not a valid video id."));
637
139
  }
140
+
638
141
  throw new TypeError("\u201C".concat(idOrUrl, "\u201D is not a vimeo.com url."));
639
142
  }
640
143
 
641
- /* eslint-disable max-params */
642
- /**
643
- * A utility method for attaching and detaching event handlers
644
- *
645
- * @param {EventTarget} target
646
- * @param {string | string[]} eventName
647
- * @param {function} callback
648
- * @param {'addEventListener' | 'on'} onName
649
- * @param {'removeEventListener' | 'off'} offName
650
- * @return {{cancel: (function(): void)}}
651
- */
652
- var subscribe = function subscribe(target, eventName, callback) {
653
- var onName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'addEventListener';
654
- var offName = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'removeEventListener';
655
- var eventNames = typeof eventName === 'string' ? [eventName] : eventName;
656
- eventNames.forEach(function (evName) {
657
- target[onName](evName, callback);
658
- });
659
- return {
660
- cancel: function cancel() {
661
- return eventNames.forEach(function (evName) {
662
- return target[offName](evName, callback);
663
- });
664
- }
665
- };
666
- };
667
-
668
144
  var arrayIndexOfSupport = typeof Array.prototype.indexOf !== 'undefined';
669
145
  var postMessageSupport = typeof window !== 'undefined' && typeof window.postMessage !== 'undefined';
146
+
670
147
  if (!isNode && (!arrayIndexOfSupport || !postMessageSupport)) {
671
148
  throw new Error('Sorry, the Vimeo Player API is not available in this browser.');
672
149
  }
673
150
 
674
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
151
+ var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
675
152
 
676
153
  function createCommonjsModule(fn, module) {
677
154
  return module = { exports: {} }, fn(module, module.exports), module.exports;
678
155
  }
679
156
 
680
157
  /*!
681
- * weakmap-polyfill v2.0.4 - ECMAScript6 WeakMap polyfill
158
+ * weakmap-polyfill v2.0.0 - ECMAScript6 WeakMap polyfill
682
159
  * https://github.com/polygonplanet/weakmap-polyfill
683
- * Copyright (c) 2015-2021 polygonplanet <polygon.planet.aqua@gmail.com>
160
+ * Copyright (c) 2015-2016 polygon planet <polygon.planet.aqua@gmail.com>
684
161
  * @license MIT
685
162
  */
686
-
687
163
  (function (self) {
688
164
 
689
165
  if (self.WeakMap) {
690
166
  return;
691
167
  }
168
+
692
169
  var hasOwnProperty = Object.prototype.hasOwnProperty;
693
- var hasDefine = Object.defineProperty && function () {
694
- try {
695
- // Avoid IE8's broken Object.defineProperty
696
- return Object.defineProperty({}, 'x', {
697
- value: 1
698
- }).x === 1;
699
- } catch (e) {}
700
- }();
170
+
701
171
  var defineProperty = function (object, name, value) {
702
- if (hasDefine) {
172
+ if (Object.defineProperty) {
703
173
  Object.defineProperty(object, name, {
704
174
  configurable: true,
705
175
  writable: true,
@@ -709,119 +179,138 @@
709
179
  object[name] = value;
710
180
  }
711
181
  };
182
+
712
183
  self.WeakMap = function () {
713
184
  // ECMA-262 23.3 WeakMap Objects
714
185
  function WeakMap() {
715
186
  if (this === void 0) {
716
187
  throw new TypeError("Constructor WeakMap requires 'new'");
717
188
  }
718
- defineProperty(this, '_id', genId('_WeakMap'));
719
189
 
720
- // ECMA-262 23.3.1.1 WeakMap([iterable])
190
+ defineProperty(this, '_id', genId('_WeakMap')); // ECMA-262 23.3.1.1 WeakMap([iterable])
191
+
721
192
  if (arguments.length > 0) {
722
193
  // Currently, WeakMap `iterable` argument is not supported
723
194
  throw new TypeError('WeakMap iterable is not supported');
724
195
  }
725
- }
196
+ } // ECMA-262 23.3.3.2 WeakMap.prototype.delete(key)
197
+
726
198
 
727
- // ECMA-262 23.3.3.2 WeakMap.prototype.delete(key)
728
199
  defineProperty(WeakMap.prototype, 'delete', function (key) {
729
200
  checkInstance(this, 'delete');
201
+
730
202
  if (!isObject(key)) {
731
203
  return false;
732
204
  }
205
+
733
206
  var entry = key[this._id];
207
+
734
208
  if (entry && entry[0] === key) {
735
209
  delete key[this._id];
736
210
  return true;
737
211
  }
212
+
738
213
  return false;
739
- });
214
+ }); // ECMA-262 23.3.3.3 WeakMap.prototype.get(key)
740
215
 
741
- // ECMA-262 23.3.3.3 WeakMap.prototype.get(key)
742
216
  defineProperty(WeakMap.prototype, 'get', function (key) {
743
217
  checkInstance(this, 'get');
218
+
744
219
  if (!isObject(key)) {
745
220
  return void 0;
746
221
  }
222
+
747
223
  var entry = key[this._id];
224
+
748
225
  if (entry && entry[0] === key) {
749
226
  return entry[1];
750
227
  }
228
+
751
229
  return void 0;
752
- });
230
+ }); // ECMA-262 23.3.3.4 WeakMap.prototype.has(key)
753
231
 
754
- // ECMA-262 23.3.3.4 WeakMap.prototype.has(key)
755
232
  defineProperty(WeakMap.prototype, 'has', function (key) {
756
233
  checkInstance(this, 'has');
234
+
757
235
  if (!isObject(key)) {
758
236
  return false;
759
237
  }
238
+
760
239
  var entry = key[this._id];
240
+
761
241
  if (entry && entry[0] === key) {
762
242
  return true;
763
243
  }
244
+
764
245
  return false;
765
- });
246
+ }); // ECMA-262 23.3.3.5 WeakMap.prototype.set(key, value)
766
247
 
767
- // ECMA-262 23.3.3.5 WeakMap.prototype.set(key, value)
768
248
  defineProperty(WeakMap.prototype, 'set', function (key, value) {
769
249
  checkInstance(this, 'set');
250
+
770
251
  if (!isObject(key)) {
771
252
  throw new TypeError('Invalid value used as weak map key');
772
253
  }
254
+
773
255
  var entry = key[this._id];
256
+
774
257
  if (entry && entry[0] === key) {
775
258
  entry[1] = value;
776
259
  return this;
777
260
  }
261
+
778
262
  defineProperty(key, this._id, [key, value]);
779
263
  return this;
780
264
  });
265
+
781
266
  function checkInstance(x, methodName) {
782
267
  if (!isObject(x) || !hasOwnProperty.call(x, '_id')) {
783
268
  throw new TypeError(methodName + ' method called on incompatible receiver ' + typeof x);
784
269
  }
785
270
  }
271
+
786
272
  function genId(prefix) {
787
273
  return prefix + '_' + rand() + '.' + rand();
788
274
  }
275
+
789
276
  function rand() {
790
277
  return Math.random().toString().substring(2);
791
278
  }
279
+
792
280
  defineProperty(WeakMap, '_polyfill', true);
793
281
  return WeakMap;
794
282
  }();
283
+
795
284
  function isObject(x) {
796
285
  return Object(x) === x;
797
286
  }
798
- })(typeof globalThis !== 'undefined' ? globalThis : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : commonjsGlobal);
287
+ })(typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : commonjsGlobal);
799
288
 
800
289
  var npo_src = createCommonjsModule(function (module) {
801
290
  /*! Native Promise Only
802
291
  v0.8.1 (c) Kyle Simpson
803
292
  MIT License: http://getify.mit-license.org
804
293
  */
805
-
806
294
  (function UMD(name, context, definition) {
807
295
  // special form of UMD for polyfilling across evironments
808
296
  context[name] = context[name] || definition();
809
- if ( module.exports) {
297
+
298
+ if (module.exports) {
810
299
  module.exports = context[name];
811
300
  }
812
301
  })("Promise", typeof commonjsGlobal != "undefined" ? commonjsGlobal : commonjsGlobal, function DEF() {
813
302
 
814
303
  var builtInProp,
815
- cycle,
816
- scheduling_queue,
817
- ToString = Object.prototype.toString,
818
- timer = typeof setImmediate != "undefined" ? function timer(fn) {
819
- return setImmediate(fn);
820
- } : setTimeout;
821
-
822
- // dammit, IE8.
304
+ cycle,
305
+ scheduling_queue,
306
+ ToString = Object.prototype.toString,
307
+ timer = typeof setImmediate != "undefined" ? function timer(fn) {
308
+ return setImmediate(fn);
309
+ } : setTimeout; // dammit, IE8.
310
+
823
311
  try {
824
312
  Object.defineProperty({}, "x", {});
313
+
825
314
  builtInProp = function builtInProp(obj, name, val, config) {
826
315
  return Object.defineProperty(obj, name, {
827
316
  value: val,
@@ -834,30 +323,35 @@
834
323
  obj[name] = val;
835
324
  return obj;
836
325
  };
837
- }
326
+ } // Note: using a queue instead of array for efficiency
327
+
838
328
 
839
- // Note: using a queue instead of array for efficiency
840
329
  scheduling_queue = function Queue() {
841
330
  var first, last, item;
331
+
842
332
  function Item(fn, self) {
843
333
  this.fn = fn;
844
334
  this.self = self;
845
335
  this.next = void 0;
846
336
  }
337
+
847
338
  return {
848
339
  add: function add(fn, self) {
849
340
  item = new Item(fn, self);
341
+
850
342
  if (last) {
851
343
  last.next = item;
852
344
  } else {
853
345
  first = item;
854
346
  }
347
+
855
348
  last = item;
856
349
  item = void 0;
857
350
  },
858
351
  drain: function drain() {
859
352
  var f = first;
860
353
  first = last = cycle = void 0;
354
+
861
355
  while (f) {
862
356
  f.fn.call(f.self);
863
357
  f = f.next;
@@ -865,34 +359,41 @@
865
359
  }
866
360
  };
867
361
  }();
362
+
868
363
  function schedule(fn, self) {
869
364
  scheduling_queue.add(fn, self);
365
+
870
366
  if (!cycle) {
871
367
  cycle = timer(scheduling_queue.drain);
872
368
  }
873
- }
369
+ } // promise duck typing
370
+
874
371
 
875
- // promise duck typing
876
372
  function isThenable(o) {
877
373
  var _then,
878
- o_type = typeof o;
374
+ o_type = typeof o;
375
+
879
376
  if (o != null && (o_type == "object" || o_type == "function")) {
880
377
  _then = o.then;
881
378
  }
379
+
882
380
  return typeof _then == "function" ? _then : false;
883
381
  }
382
+
884
383
  function notify() {
885
384
  for (var i = 0; i < this.chain.length; i++) {
886
385
  notifyIsolated(this, this.state === 1 ? this.chain[i].success : this.chain[i].failure, this.chain[i]);
887
386
  }
888
- this.chain.length = 0;
889
- }
890
387
 
891
- // NOTE: This is a separate function to isolate
388
+ this.chain.length = 0;
389
+ } // NOTE: This is a separate function to isolate
892
390
  // the `try..catch` so that other code can be
893
391
  // optimized better
392
+
393
+
894
394
  function notifyIsolated(self, cb, chain) {
895
395
  var ret, _then;
396
+
896
397
  try {
897
398
  if (cb === false) {
898
399
  chain.reject(self.msg);
@@ -902,6 +403,7 @@
902
403
  } else {
903
404
  ret = cb.call(void 0, self.msg);
904
405
  }
406
+
905
407
  if (ret === chain.promise) {
906
408
  chain.reject(TypeError("Promise-chain cycle"));
907
409
  } else if (_then = isThenable(ret)) {
@@ -914,24 +416,27 @@
914
416
  chain.reject(err);
915
417
  }
916
418
  }
419
+
917
420
  function resolve(msg) {
918
421
  var _then,
919
- self = this;
422
+ self = this; // already triggered?
423
+
920
424
 
921
- // already triggered?
922
425
  if (self.triggered) {
923
426
  return;
924
427
  }
925
- self.triggered = true;
926
428
 
927
- // unwrap
429
+ self.triggered = true; // unwrap
430
+
928
431
  if (self.def) {
929
432
  self = self.def;
930
433
  }
434
+
931
435
  try {
932
436
  if (_then = isThenable(msg)) {
933
437
  schedule(function () {
934
438
  var def_wrapper = new MakeDefWrapper(self);
439
+
935
440
  try {
936
441
  _then.call(msg, function $resolve$() {
937
442
  resolve.apply(def_wrapper, arguments);
@@ -945,6 +450,7 @@
945
450
  } else {
946
451
  self.msg = msg;
947
452
  self.state = 1;
453
+
948
454
  if (self.chain.length > 0) {
949
455
  schedule(notify, self);
950
456
  }
@@ -953,25 +459,28 @@
953
459
  reject.call(new MakeDefWrapper(self), err);
954
460
  }
955
461
  }
462
+
956
463
  function reject(msg) {
957
- var self = this;
464
+ var self = this; // already triggered?
958
465
 
959
- // already triggered?
960
466
  if (self.triggered) {
961
467
  return;
962
468
  }
963
- self.triggered = true;
964
469
 
965
- // unwrap
470
+ self.triggered = true; // unwrap
471
+
966
472
  if (self.def) {
967
473
  self = self.def;
968
474
  }
475
+
969
476
  self.msg = msg;
970
477
  self.state = 2;
478
+
971
479
  if (self.chain.length > 0) {
972
480
  schedule(notify, self);
973
481
  }
974
482
  }
483
+
975
484
  function iteratePromises(Constructor, arr, resolver, rejecter) {
976
485
  for (var idx = 0; idx < arr.length; idx++) {
977
486
  (function IIFE(idx) {
@@ -981,10 +490,12 @@
981
490
  })(idx);
982
491
  }
983
492
  }
493
+
984
494
  function MakeDefWrapper(self) {
985
495
  this.def = self;
986
496
  this.triggered = false;
987
497
  }
498
+
988
499
  function MakeDef(self) {
989
500
  this.promise = self;
990
501
  this.state = 0;
@@ -992,42 +503,50 @@
992
503
  this.chain = [];
993
504
  this.msg = void 0;
994
505
  }
506
+
995
507
  function Promise(executor) {
996
508
  if (typeof executor != "function") {
997
509
  throw TypeError("Not a function");
998
510
  }
511
+
999
512
  if (this.__NPO__ !== 0) {
1000
513
  throw TypeError("Not a promise");
1001
- }
1002
-
1003
- // instance shadowing the inherited "brand"
514
+ } // instance shadowing the inherited "brand"
1004
515
  // to signal an already "initialized" promise
516
+
517
+
1005
518
  this.__NPO__ = 1;
1006
519
  var def = new MakeDef(this);
520
+
1007
521
  this["then"] = function then(success, failure) {
1008
522
  var o = {
1009
523
  success: typeof success == "function" ? success : true,
1010
524
  failure: typeof failure == "function" ? failure : false
1011
- };
1012
- // Note: `then(..)` itself can be borrowed to be used against
525
+ }; // Note: `then(..)` itself can be borrowed to be used against
1013
526
  // a different promise constructor for making the chained promise,
1014
527
  // by substituting a different `this` binding.
528
+
1015
529
  o.promise = new this.constructor(function extractChain(resolve, reject) {
1016
530
  if (typeof resolve != "function" || typeof reject != "function") {
1017
531
  throw TypeError("Not a function");
1018
532
  }
533
+
1019
534
  o.resolve = resolve;
1020
535
  o.reject = reject;
1021
536
  });
1022
537
  def.chain.push(o);
538
+
1023
539
  if (def.state !== 0) {
1024
540
  schedule(notify, def);
1025
541
  }
542
+
1026
543
  return o.promise;
1027
544
  };
545
+
1028
546
  this["catch"] = function $catch$(failure) {
1029
547
  return this.then(void 0, failure);
1030
548
  };
549
+
1031
550
  try {
1032
551
  executor.call(void 0, function publicResolve(msg) {
1033
552
  resolve.call(def, msg);
@@ -1038,25 +557,29 @@
1038
557
  reject.call(def, err);
1039
558
  }
1040
559
  }
1041
- var PromisePrototype = builtInProp({}, "constructor", Promise, /*configurable=*/false);
1042
560
 
1043
- // Note: Android 4 cannot use `Object.defineProperty(..)` here
1044
- Promise.prototype = PromisePrototype;
561
+ var PromisePrototype = builtInProp({}, "constructor", Promise,
562
+ /*configurable=*/
563
+ false); // Note: Android 4 cannot use `Object.defineProperty(..)` here
1045
564
 
1046
- // built-in "brand" to signal an "uninitialized" promise
1047
- builtInProp(PromisePrototype, "__NPO__", 0, /*configurable=*/false);
1048
- builtInProp(Promise, "resolve", function Promise$resolve(msg) {
1049
- var Constructor = this;
565
+ Promise.prototype = PromisePrototype; // built-in "brand" to signal an "uninitialized" promise
1050
566
 
1051
- // spec mandated checks
567
+ builtInProp(PromisePrototype, "__NPO__", 0,
568
+ /*configurable=*/
569
+ false);
570
+ builtInProp(Promise, "resolve", function Promise$resolve(msg) {
571
+ var Constructor = this; // spec mandated checks
1052
572
  // note: best "isPromise" check that's practical for now
573
+
1053
574
  if (msg && typeof msg == "object" && msg.__NPO__ === 1) {
1054
575
  return msg;
1055
576
  }
577
+
1056
578
  return new Constructor(function executor(resolve, reject) {
1057
579
  if (typeof resolve != "function" || typeof reject != "function") {
1058
580
  throw TypeError("Not a function");
1059
581
  }
582
+
1060
583
  resolve(msg);
1061
584
  });
1062
585
  });
@@ -1065,28 +588,32 @@
1065
588
  if (typeof resolve != "function" || typeof reject != "function") {
1066
589
  throw TypeError("Not a function");
1067
590
  }
591
+
1068
592
  reject(msg);
1069
593
  });
1070
594
  });
1071
595
  builtInProp(Promise, "all", function Promise$all(arr) {
1072
- var Constructor = this;
596
+ var Constructor = this; // spec mandated checks
1073
597
 
1074
- // spec mandated checks
1075
598
  if (ToString.call(arr) != "[object Array]") {
1076
599
  return Constructor.reject(TypeError("Not an array"));
1077
600
  }
601
+
1078
602
  if (arr.length === 0) {
1079
603
  return Constructor.resolve([]);
1080
604
  }
605
+
1081
606
  return new Constructor(function executor(resolve, reject) {
1082
607
  if (typeof resolve != "function" || typeof reject != "function") {
1083
608
  throw TypeError("Not a function");
1084
609
  }
610
+
1085
611
  var len = arr.length,
1086
- msgs = Array(len),
1087
- count = 0;
612
+ msgs = Array(len),
613
+ count = 0;
1088
614
  iteratePromises(Constructor, arr, function resolver(idx, msg) {
1089
615
  msgs[idx] = msg;
616
+
1090
617
  if (++count === len) {
1091
618
  resolve(msgs);
1092
619
  }
@@ -1094,16 +621,17 @@
1094
621
  });
1095
622
  });
1096
623
  builtInProp(Promise, "race", function Promise$race(arr) {
1097
- var Constructor = this;
624
+ var Constructor = this; // spec mandated checks
1098
625
 
1099
- // spec mandated checks
1100
626
  if (ToString.call(arr) != "[object Array]") {
1101
627
  return Constructor.reject(TypeError("Not an array"));
1102
628
  }
629
+
1103
630
  return new Constructor(function executor(resolve, reject) {
1104
631
  if (typeof resolve != "function" || typeof reject != "function") {
1105
632
  throw TypeError("Not a function");
1106
633
  }
634
+
1107
635
  iteratePromises(Constructor, arr, function resolver(idx, msg) {
1108
636
  resolve(msg);
1109
637
  }, reject);
@@ -1116,9 +644,7 @@
1116
644
  /**
1117
645
  * @module lib/callbacks
1118
646
  */
1119
-
1120
647
  var callbackMap = new WeakMap();
1121
-
1122
648
  /**
1123
649
  * Store a callback for a method or event for a player.
1124
650
  *
@@ -1128,15 +654,17 @@
1128
654
  * The callback to call or an object with resolve and reject functions for a promise.
1129
655
  * @return {void}
1130
656
  */
657
+
1131
658
  function storeCallback(player, name, callback) {
1132
659
  var playerCallbacks = callbackMap.get(player.element) || {};
660
+
1133
661
  if (!(name in playerCallbacks)) {
1134
662
  playerCallbacks[name] = [];
1135
663
  }
664
+
1136
665
  playerCallbacks[name].push(callback);
1137
666
  callbackMap.set(player.element, playerCallbacks);
1138
667
  }
1139
-
1140
668
  /**
1141
669
  * Get the callbacks for a player and event or method.
1142
670
  *
@@ -1144,11 +672,11 @@
1144
672
  * @param {string} name The method or event name
1145
673
  * @return {function[]}
1146
674
  */
675
+
1147
676
  function getCallbacks(player, name) {
1148
677
  var playerCallbacks = callbackMap.get(player.element) || {};
1149
678
  return playerCallbacks[name] || [];
1150
679
  }
1151
-
1152
680
  /**
1153
681
  * Remove a stored callback for a method or event for a player.
1154
682
  *
@@ -1157,26 +685,30 @@
1157
685
  * @param {function} [callback] The specific callback to remove.
1158
686
  * @return {boolean} Was this the last callback?
1159
687
  */
688
+
1160
689
  function removeCallback(player, name, callback) {
1161
690
  var playerCallbacks = callbackMap.get(player.element) || {};
691
+
1162
692
  if (!playerCallbacks[name]) {
1163
693
  return true;
1164
- }
694
+ } // If no callback is passed, remove all callbacks for the event
695
+
1165
696
 
1166
- // If no callback is passed, remove all callbacks for the event
1167
697
  if (!callback) {
1168
698
  playerCallbacks[name] = [];
1169
699
  callbackMap.set(player.element, playerCallbacks);
1170
700
  return true;
1171
701
  }
702
+
1172
703
  var index = playerCallbacks[name].indexOf(callback);
704
+
1173
705
  if (index !== -1) {
1174
706
  playerCallbacks[name].splice(index, 1);
1175
707
  }
708
+
1176
709
  callbackMap.set(player.element, playerCallbacks);
1177
710
  return playerCallbacks[name] && playerCallbacks[name].length === 0;
1178
711
  }
1179
-
1180
712
  /**
1181
713
  * Return the first stored callback for a player and event or method.
1182
714
  *
@@ -1184,16 +716,18 @@
1184
716
  * @param {string} name The method or event name.
1185
717
  * @return {function} The callback, or false if there were none
1186
718
  */
719
+
1187
720
  function shiftCallbacks(player, name) {
1188
721
  var playerCallbacks = getCallbacks(player, name);
722
+
1189
723
  if (playerCallbacks.length < 1) {
1190
724
  return false;
1191
725
  }
726
+
1192
727
  var callback = playerCallbacks.shift();
1193
728
  removeCallback(player, name, callback);
1194
729
  return callback;
1195
730
  }
1196
-
1197
731
  /**
1198
732
  * Move callbacks associated with an element to another element.
1199
733
  *
@@ -1201,110 +735,17 @@
1201
735
  * @param {HTMLElement} newElement The new element.
1202
736
  * @return {void}
1203
737
  */
738
+
1204
739
  function swapCallbacks(oldElement, newElement) {
1205
740
  var playerCallbacks = callbackMap.get(oldElement);
1206
741
  callbackMap.set(newElement, playerCallbacks);
1207
742
  callbackMap.delete(oldElement);
1208
743
  }
1209
744
 
1210
- /**
1211
- * @module lib/postmessage
1212
- */
1213
-
1214
- /**
1215
- * Parse a message received from postMessage.
1216
- *
1217
- * @param {*} data The data received from postMessage.
1218
- * @return {object}
1219
- */
1220
- function parseMessageData(data) {
1221
- if (typeof data === 'string') {
1222
- try {
1223
- data = JSON.parse(data);
1224
- } catch (error) {
1225
- // If the message cannot be parsed, throw the error as a warning
1226
- console.warn(error);
1227
- return {};
1228
- }
1229
- }
1230
- return data;
1231
- }
1232
-
1233
- /**
1234
- * Post a message to the specified target.
1235
- *
1236
- * @param {Player} player The player object to use.
1237
- * @param {string} method The API method to call.
1238
- * @param {object} params The parameters to send to the player.
1239
- * @return {void}
1240
- */
1241
- function postMessage(player, method, params) {
1242
- if (!player.element.contentWindow || !player.element.contentWindow.postMessage) {
1243
- return;
1244
- }
1245
- var message = {
1246
- method: method
1247
- };
1248
- if (params !== undefined) {
1249
- message.value = params;
1250
- }
1251
-
1252
- // IE 8 and 9 do not support passing messages, so stringify them
1253
- var ieVersion = parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/, '$1'));
1254
- if (ieVersion >= 8 && ieVersion < 10) {
1255
- message = JSON.stringify(message);
1256
- }
1257
- player.element.contentWindow.postMessage(message, player.origin);
1258
- }
1259
-
1260
- /**
1261
- * Parse the data received from a message event.
1262
- *
1263
- * @param {Player} player The player that received the message.
1264
- * @param {(Object|string)} data The message data. Strings will be parsed into JSON.
1265
- * @return {void}
1266
- */
1267
- function processData(player, data) {
1268
- data = parseMessageData(data);
1269
- var callbacks = [];
1270
- var param;
1271
- if (data.event) {
1272
- if (data.event === 'error') {
1273
- var promises = getCallbacks(player, data.data.method);
1274
- promises.forEach(function (promise) {
1275
- var error = new Error(data.data.message);
1276
- error.name = data.data.name;
1277
- promise.reject(error);
1278
- removeCallback(player, data.data.method, promise);
1279
- });
1280
- }
1281
- callbacks = getCallbacks(player, "event:".concat(data.event));
1282
- param = data.data;
1283
- } else if (data.method) {
1284
- var callback = shiftCallbacks(player, data.method);
1285
- if (callback) {
1286
- callbacks.push(callback);
1287
- param = data.value;
1288
- }
1289
- }
1290
- callbacks.forEach(function (callback) {
1291
- try {
1292
- if (typeof callback === 'function') {
1293
- callback.call(player, param);
1294
- return;
1295
- }
1296
- callback.resolve(param);
1297
- } catch (e) {
1298
- // empty
1299
- }
1300
- });
1301
- }
1302
-
1303
745
  /**
1304
746
  * @module lib/embed
1305
747
  */
1306
- var oEmbedParameters = ['airplay', 'audio_tracks', 'autopause', 'autoplay', 'background', 'byline', 'cc', 'chapters', 'chromecast', 'color', 'colors', 'controls', 'dnt', 'fullscreen', 'height', 'id', 'interactive_params', 'keyboard', 'loop', 'maxheight', 'maxwidth', 'muted', 'play_button_position', 'playsinline', 'portrait', 'progress_bar', 'quality_selector', 'responsive', 'speed', 'texttrack', 'title', 'transcript', 'transparent', 'url', 'vimeo_logo', 'volume', 'width'];
1307
-
748
+ var oEmbedParameters = ['autopause', 'autoplay', 'background', 'byline', 'color', 'controls', 'dnt', 'height', 'id', 'loop', 'maxheight', 'maxwidth', 'muted', 'playsinline', 'portrait', 'responsive', 'speed', 'texttrack', 'title', 'transparent', 'url', 'width'];
1308
749
  /**
1309
750
  * Get the 'data-vimeo'-prefixed attributes from an element as an object.
1310
751
  *
@@ -1312,17 +753,19 @@
1312
753
  * @param {Object} [defaults={}] The default values to use.
1313
754
  * @return {Object<string, string>}
1314
755
  */
756
+
1315
757
  function getOEmbedParameters(element) {
1316
758
  var defaults = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1317
759
  return oEmbedParameters.reduce(function (params, param) {
1318
760
  var value = element.getAttribute("data-vimeo-".concat(param));
761
+
1319
762
  if (value || value === '') {
1320
763
  params[param] = value === '' ? 1 : value;
1321
764
  }
765
+
1322
766
  return params;
1323
767
  }, defaults);
1324
768
  }
1325
-
1326
769
  /**
1327
770
  * Create an embed from oEmbed data inside an element.
1328
771
  *
@@ -1330,21 +773,24 @@
1330
773
  * @param {HTMLElement} element The element to put the iframe in.
1331
774
  * @return {HTMLIFrameElement} The iframe embed.
1332
775
  */
776
+
1333
777
  function createEmbed(_ref, element) {
1334
778
  var html = _ref.html;
779
+
1335
780
  if (!element) {
1336
781
  throw new TypeError('An element must be provided');
1337
782
  }
783
+
1338
784
  if (element.getAttribute('data-vimeo-initialized') !== null) {
1339
785
  return element.querySelector('iframe');
1340
786
  }
787
+
1341
788
  var div = document.createElement('div');
1342
789
  div.innerHTML = html;
1343
790
  element.appendChild(div.firstChild);
1344
791
  element.setAttribute('data-vimeo-initialized', 'true');
1345
792
  return element.querySelector('iframe');
1346
793
  }
1347
-
1348
794
  /**
1349
795
  * Make an oEmbed call for the specified URL.
1350
796
  *
@@ -1353,6 +799,7 @@
1353
799
  * @param {HTMLElement} element The element.
1354
800
  * @return {Promise}
1355
801
  */
802
+
1356
803
  function getOEmbedData(videoUrl) {
1357
804
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1358
805
  var element = arguments.length > 2 ? arguments[2] : undefined;
@@ -1360,65 +807,77 @@
1360
807
  if (!isVimeoUrl(videoUrl)) {
1361
808
  throw new TypeError("\u201C".concat(videoUrl, "\u201D is not a vimeo.com url."));
1362
809
  }
810
+
1363
811
  var url = "https://vimeo.com/api/oembed.json?url=".concat(encodeURIComponent(videoUrl));
812
+
1364
813
  for (var param in params) {
1365
814
  if (params.hasOwnProperty(param)) {
1366
815
  url += "&".concat(param, "=").concat(encodeURIComponent(params[param]));
1367
816
  }
1368
817
  }
818
+
1369
819
  var xhr = 'XDomainRequest' in window ? new XDomainRequest() : new XMLHttpRequest();
1370
820
  xhr.open('GET', url, true);
821
+
1371
822
  xhr.onload = function () {
1372
823
  if (xhr.status === 404) {
1373
824
  reject(new Error("\u201C".concat(videoUrl, "\u201D was not found.")));
1374
825
  return;
1375
826
  }
827
+
1376
828
  if (xhr.status === 403) {
1377
829
  reject(new Error("\u201C".concat(videoUrl, "\u201D is not embeddable.")));
1378
830
  return;
1379
831
  }
832
+
1380
833
  try {
1381
- var json = JSON.parse(xhr.responseText);
1382
- // Check api response for 403 on oembed
834
+ var json = JSON.parse(xhr.responseText); // Check api response for 403 on oembed
835
+
1383
836
  if (json.domain_status_code === 403) {
1384
837
  // We still want to create the embed to give users visual feedback
1385
838
  createEmbed(json, element);
1386
839
  reject(new Error("\u201C".concat(videoUrl, "\u201D is not embeddable.")));
1387
840
  return;
1388
841
  }
842
+
1389
843
  resolve(json);
1390
844
  } catch (error) {
1391
845
  reject(error);
1392
846
  }
1393
847
  };
848
+
1394
849
  xhr.onerror = function () {
1395
850
  var status = xhr.status ? " (".concat(xhr.status, ")") : '';
1396
851
  reject(new Error("There was an error fetching the embed code from Vimeo".concat(status, ".")));
1397
852
  };
853
+
1398
854
  xhr.send();
1399
855
  });
1400
856
  }
1401
-
1402
857
  /**
1403
858
  * Initialize all embeds within a specific element
1404
859
  *
1405
860
  * @param {HTMLElement} [parent=document] The parent element.
1406
861
  * @return {void}
1407
862
  */
863
+
1408
864
  function initializeEmbeds() {
1409
865
  var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
1410
866
  var elements = [].slice.call(parent.querySelectorAll('[data-vimeo-id], [data-vimeo-url]'));
867
+
1411
868
  var handleError = function handleError(error) {
1412
869
  if ('console' in window && console.error) {
1413
870
  console.error("There was an error creating an embed: ".concat(error));
1414
871
  }
1415
872
  };
873
+
1416
874
  elements.forEach(function (element) {
1417
875
  try {
1418
876
  // Skip any that have data-vimeo-defer
1419
877
  if (element.getAttribute('data-vimeo-defer') !== null) {
1420
878
  return;
1421
879
  }
880
+
1422
881
  var params = getOEmbedParameters(element);
1423
882
  var url = getVimeoUrl(params);
1424
883
  getOEmbedData(url, params, element).then(function (data) {
@@ -1429,687 +888,163 @@
1429
888
  }
1430
889
  });
1431
890
  }
1432
-
1433
891
  /**
1434
892
  * Resize embeds when messaged by the player.
1435
893
  *
1436
894
  * @param {HTMLElement} [parent=document] The parent element.
1437
895
  * @return {void}
1438
896
  */
897
+
1439
898
  function resizeEmbeds() {
1440
899
  var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
900
+
1441
901
  // Prevent execution if users include the player.js script multiple times.
1442
902
  if (window.VimeoPlayerResizeEmbeds_) {
1443
903
  return;
1444
904
  }
905
+
1445
906
  window.VimeoPlayerResizeEmbeds_ = true;
907
+
1446
908
  var onMessage = function onMessage(event) {
1447
909
  if (!isVimeoUrl(event.origin)) {
1448
910
  return;
1449
- }
911
+ } // 'spacechange' is fired only on embeds with cards
912
+
1450
913
 
1451
- // 'spacechange' is fired only on embeds with cards
1452
914
  if (!event.data || event.data.event !== 'spacechange') {
1453
915
  return;
1454
916
  }
917
+
1455
918
  var iframes = parent.querySelectorAll('iframe');
919
+
1456
920
  for (var i = 0; i < iframes.length; i++) {
1457
921
  if (iframes[i].contentWindow !== event.source) {
1458
922
  continue;
1459
- }
1460
-
1461
- // Change padding-bottom of the enclosing div to accommodate
923
+ } // Change padding-bottom of the enclosing div to accommodate
1462
924
  // card carousel without distorting aspect ratio
925
+
926
+
1463
927
  var space = iframes[i].parentElement;
1464
928
  space.style.paddingBottom = "".concat(event.data.data[0].bottom, "px");
1465
929
  break;
1466
930
  }
1467
931
  };
1468
- window.addEventListener('message', onMessage);
932
+
933
+ if (window.addEventListener) {
934
+ window.addEventListener('message', onMessage, false);
935
+ } else if (window.attachEvent) {
936
+ window.attachEvent('onmessage', onMessage);
937
+ }
1469
938
  }
1470
939
 
1471
940
  /**
1472
- * Add chapters to existing metadata for Google SEO
941
+ * @module lib/postmessage
942
+ */
943
+ /**
944
+ * Parse a message received from postMessage.
1473
945
  *
1474
- * @param {HTMLElement} [parent=document] The parent element.
1475
- * @return {void}
946
+ * @param {*} data The data received from postMessage.
947
+ * @return {object}
1476
948
  */
1477
- function initAppendVideoMetadata() {
1478
- var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
1479
- // Prevent execution if users include the player.js script multiple times.
1480
- if (window.VimeoSeoMetadataAppended) {
1481
- return;
1482
- }
1483
- window.VimeoSeoMetadataAppended = true;
1484
- var onMessage = function onMessage(event) {
1485
- if (!isVimeoUrl(event.origin)) {
1486
- return;
1487
- }
1488
- var data = parseMessageData(event.data);
1489
- if (!data || data.event !== 'ready') {
1490
- return;
1491
- }
1492
- var iframes = parent.querySelectorAll('iframe');
1493
- for (var i = 0; i < iframes.length; i++) {
1494
- var iframe = iframes[i];
1495
949
 
1496
- // Initiate appendVideoMetadata if iframe is a Vimeo embed
1497
- var isValidMessageSource = iframe.contentWindow === event.source;
1498
- if (isVimeoEmbed(iframe.src) && isValidMessageSource) {
1499
- var player = new Player(iframe);
1500
- player.callMethod('appendVideoMetadata', window.location.href);
1501
- }
950
+ function parseMessageData(data) {
951
+ if (typeof data === 'string') {
952
+ try {
953
+ data = JSON.parse(data);
954
+ } catch (error) {
955
+ // If the message cannot be parsed, throw the error as a warning
956
+ console.warn(error);
957
+ return {};
1502
958
  }
1503
- };
1504
- window.addEventListener('message', onMessage);
1505
- }
959
+ }
1506
960
 
961
+ return data;
962
+ }
1507
963
  /**
1508
- * Seek to time indicated by vimeo_t query parameter if present in URL
964
+ * Post a message to the specified target.
1509
965
  *
1510
- * @param {HTMLElement} [parent=document] The parent element.
966
+ * @param {Player} player The player object to use.
967
+ * @param {string} method The API method to call.
968
+ * @param {object} params The parameters to send to the player.
1511
969
  * @return {void}
1512
970
  */
1513
- function checkUrlTimeParam() {
1514
- var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
1515
- // Prevent execution if users include the player.js script multiple times.
1516
- if (window.VimeoCheckedUrlTimeParam) {
971
+
972
+ function postMessage(player, method, params) {
973
+ if (!player.element.contentWindow || !player.element.contentWindow.postMessage) {
1517
974
  return;
1518
975
  }
1519
- window.VimeoCheckedUrlTimeParam = true;
1520
- var handleError = function handleError(error) {
1521
- if ('console' in window && console.error) {
1522
- console.error("There was an error getting video Id: ".concat(error));
1523
- }
1524
- };
1525
- var onMessage = function onMessage(event) {
1526
- if (!isVimeoUrl(event.origin)) {
1527
- return;
1528
- }
1529
- var data = parseMessageData(event.data);
1530
- if (!data || data.event !== 'ready') {
1531
- return;
1532
- }
1533
- var iframes = parent.querySelectorAll('iframe');
1534
- var _loop = function _loop() {
1535
- var iframe = iframes[i];
1536
- var isValidMessageSource = iframe.contentWindow === event.source;
1537
- if (isVimeoEmbed(iframe.src) && isValidMessageSource) {
1538
- var player = new Player(iframe);
1539
- player.getVideoId().then(function (videoId) {
1540
- var matches = new RegExp("[?&]vimeo_t_".concat(videoId, "=([^&#]*)")).exec(window.location.href);
1541
- if (matches && matches[1]) {
1542
- var sec = decodeURI(matches[1]);
1543
- player.setCurrentTime(sec);
1544
- }
1545
- return;
1546
- }).catch(handleError);
1547
- }
1548
- };
1549
- for (var i = 0; i < iframes.length; i++) {
1550
- _loop();
1551
- }
1552
- };
1553
- window.addEventListener('message', onMessage);
1554
- }
1555
976
 
1556
- /* MIT License
1557
-
1558
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
1559
-
1560
- 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:
1561
-
1562
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1563
-
1564
- 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.
1565
- Terms */
1566
-
1567
- function initializeScreenfull() {
1568
- var fn = function () {
1569
- var val;
1570
- var fnMap = [['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror'],
1571
- // New WebKit
1572
- ['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror'],
1573
- // Old WebKit
1574
- ['webkitRequestFullScreen', 'webkitCancelFullScreen', 'webkitCurrentFullScreenElement', 'webkitCancelFullScreen', 'webkitfullscreenchange', 'webkitfullscreenerror'], ['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror'], ['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError']];
1575
- var i = 0;
1576
- var l = fnMap.length;
1577
- var ret = {};
1578
- for (; i < l; i++) {
1579
- val = fnMap[i];
1580
- if (val && val[1] in document) {
1581
- for (i = 0; i < val.length; i++) {
1582
- ret[fnMap[0][i]] = val[i];
1583
- }
1584
- return ret;
1585
- }
1586
- }
1587
- return false;
1588
- }();
1589
- var eventNameMap = {
1590
- fullscreenchange: fn.fullscreenchange,
1591
- fullscreenerror: fn.fullscreenerror
1592
- };
1593
- var screenfull = {
1594
- request: function request(element) {
1595
- return new Promise(function (resolve, reject) {
1596
- var onFullScreenEntered = function onFullScreenEntered() {
1597
- screenfull.off('fullscreenchange', onFullScreenEntered);
1598
- resolve();
1599
- };
1600
- screenfull.on('fullscreenchange', onFullScreenEntered);
1601
- element = element || document.documentElement;
1602
- var returnPromise = element[fn.requestFullscreen]();
1603
- if (returnPromise instanceof Promise) {
1604
- returnPromise.then(onFullScreenEntered).catch(reject);
1605
- }
1606
- });
1607
- },
1608
- exit: function exit() {
1609
- return new Promise(function (resolve, reject) {
1610
- if (!screenfull.isFullscreen) {
1611
- resolve();
1612
- return;
1613
- }
1614
- var onFullScreenExit = function onFullScreenExit() {
1615
- screenfull.off('fullscreenchange', onFullScreenExit);
1616
- resolve();
1617
- };
1618
- screenfull.on('fullscreenchange', onFullScreenExit);
1619
- var returnPromise = document[fn.exitFullscreen]();
1620
- if (returnPromise instanceof Promise) {
1621
- returnPromise.then(onFullScreenExit).catch(reject);
1622
- }
1623
- });
1624
- },
1625
- on: function on(event, callback) {
1626
- var eventName = eventNameMap[event];
1627
- if (eventName) {
1628
- document.addEventListener(eventName, callback);
1629
- }
1630
- },
1631
- off: function off(event, callback) {
1632
- var eventName = eventNameMap[event];
1633
- if (eventName) {
1634
- document.removeEventListener(eventName, callback);
1635
- }
1636
- }
977
+ var message = {
978
+ method: method
1637
979
  };
1638
- Object.defineProperties(screenfull, {
1639
- isFullscreen: {
1640
- get: function get() {
1641
- return Boolean(document[fn.fullscreenElement]);
1642
- }
1643
- },
1644
- element: {
1645
- enumerable: true,
1646
- get: function get() {
1647
- return document[fn.fullscreenElement];
1648
- }
1649
- },
1650
- isEnabled: {
1651
- enumerable: true,
1652
- get: function get() {
1653
- // Coerce to boolean in case of old WebKit
1654
- return Boolean(document[fn.fullscreenEnabled]);
1655
- }
1656
- }
1657
- });
1658
- return screenfull;
1659
- }
1660
980
 
1661
- /** @typedef {import('./timing-src-connector.types').PlayerControls} PlayerControls */
1662
- /** @typedef {import('./timing-object.types').TimingObject} TimingObject */
1663
- /** @typedef {import('./timing-src-connector.types').TimingSrcConnectorOptions} TimingSrcConnectorOptions */
1664
- /** @typedef {(msg: string) => any} Logger */
1665
- /** @typedef {import('timing-object.types').TConnectionState} TConnectionState */
981
+ if (params !== undefined) {
982
+ message.value = params;
983
+ } // IE 8 and 9 do not support passing messages, so stringify them
984
+
1666
985
 
1667
- /**
1668
- * @type {TimingSrcConnectorOptions}
1669
- *
1670
- * For details on these properties and their effects, see the typescript definition referenced above.
1671
- */
1672
- var defaultOptions = {
1673
- role: 'viewer',
1674
- autoPlayMuted: true,
1675
- allowedDrift: 0.3,
1676
- maxAllowedDrift: 1,
1677
- minCheckInterval: 0.1,
1678
- maxRateAdjustment: 0.2,
1679
- maxTimeToCatchUp: 1
1680
- };
986
+ var ieVersion = parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/, '$1'));
1681
987
 
988
+ if (ieVersion >= 8 && ieVersion < 10) {
989
+ message = JSON.stringify(message);
990
+ }
991
+
992
+ player.element.contentWindow.postMessage(message, player.origin);
993
+ }
1682
994
  /**
1683
- * 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.
1684
- *
1685
- * Proposed spec: https://webtiming.github.io/timingobject/
1686
- * V3 Spec: https://timingsrc.readthedocs.io/en/latest/
1687
- * Demuxed talk: https://www.youtube.com/watch?v=cZSjDaGDmX8
1688
- *
1689
- * 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.
1690
- *
1691
- * There are 5 general responsibilities in TimingSrcConnector:
995
+ * Parse the data received from a message event.
1692
996
  *
1693
- * 1. `updatePlayer()` which sets the player's currentTime, playbackRate and pause/play state based on current state of the TimingObject.
1694
- * 2. `updateTimingObject()` which sets the TimingObject's position and velocity from the player's state.
1695
- * 3. `playerUpdater` which listens for change events on the TimingObject and will respond by calling updatePlayer.
1696
- * 4. `timingObjectUpdater` which listens to the player events of seeked, play and pause and will respond by calling `updateTimingObject()`.
1697
- * 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.
997
+ * @param {Player} player The player that received the message.
998
+ * @param {(Object|string)} data The message data. Strings will be parsed into JSON.
999
+ * @return {void}
1698
1000
  */
1699
- var TimingSrcConnector = /*#__PURE__*/function (_EventTarget) {
1700
- _inherits(TimingSrcConnector, _EventTarget);
1701
- var _super = _createSuper(TimingSrcConnector);
1702
- /**
1703
- * @param {PlayerControls} player
1704
- * @param {TimingObject} timingObject
1705
- * @param {TimingSrcConnectorOptions} options
1706
- * @param {Logger} logger
1707
- */
1708
- function TimingSrcConnector(_player, timingObject) {
1709
- var _this;
1710
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1711
- var logger = arguments.length > 3 ? arguments[3] : undefined;
1712
- _classCallCheck(this, TimingSrcConnector);
1713
- _this = _super.call(this);
1714
- _defineProperty(_assertThisInitialized(_this), "logger", void 0);
1715
- _defineProperty(_assertThisInitialized(_this), "speedAdjustment", 0);
1716
- /**
1717
- * @param {PlayerControls} player
1718
- * @param {number} newAdjustment
1719
- * @return {Promise<void>}
1720
- */
1721
- _defineProperty(_assertThisInitialized(_this), "adjustSpeed", /*#__PURE__*/function () {
1722
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(player, newAdjustment) {
1723
- var newPlaybackRate;
1724
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1725
- while (1) switch (_context.prev = _context.next) {
1726
- case 0:
1727
- if (!(_this.speedAdjustment === newAdjustment)) {
1728
- _context.next = 2;
1729
- break;
1730
- }
1731
- return _context.abrupt("return");
1732
- case 2:
1733
- _context.next = 4;
1734
- return player.getPlaybackRate();
1735
- case 4:
1736
- _context.t0 = _context.sent;
1737
- _context.t1 = _this.speedAdjustment;
1738
- _context.t2 = _context.t0 - _context.t1;
1739
- _context.t3 = newAdjustment;
1740
- newPlaybackRate = _context.t2 + _context.t3;
1741
- _this.log("New playbackRate: ".concat(newPlaybackRate));
1742
- _context.next = 12;
1743
- return player.setPlaybackRate(newPlaybackRate);
1744
- case 12:
1745
- _this.speedAdjustment = newAdjustment;
1746
- case 13:
1747
- case "end":
1748
- return _context.stop();
1749
- }
1750
- }, _callee);
1751
- }));
1752
- return function (_x, _x2) {
1753
- return _ref.apply(this, arguments);
1754
- };
1755
- }());
1756
- _this.logger = logger;
1757
- _this.init(timingObject, _player, _objectSpread2(_objectSpread2({}, defaultOptions), options));
1758
- return _this;
1759
- }
1760
- _createClass(TimingSrcConnector, [{
1761
- key: "disconnect",
1762
- value: function disconnect() {
1763
- this.dispatchEvent(new Event('disconnect'));
1764
- }
1765
1001
 
1766
- /**
1767
- * @param {TimingObject} timingObject
1768
- * @param {PlayerControls} player
1769
- * @param {TimingSrcConnectorOptions} options
1770
- * @return {Promise<void>}
1771
- */
1772
- }, {
1773
- key: "init",
1774
- value: function () {
1775
- var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(timingObject, player, options) {
1776
- var _this2 = this;
1777
- var playerUpdater, positionSync, timingObjectUpdater;
1778
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1779
- while (1) switch (_context2.prev = _context2.next) {
1780
- case 0:
1781
- _context2.next = 2;
1782
- return this.waitForTOReadyState(timingObject, 'open');
1783
- case 2:
1784
- if (!(options.role === 'viewer')) {
1785
- _context2.next = 10;
1786
- break;
1787
- }
1788
- _context2.next = 5;
1789
- return this.updatePlayer(timingObject, player, options);
1790
- case 5:
1791
- playerUpdater = subscribe(timingObject, 'change', function () {
1792
- return _this2.updatePlayer(timingObject, player, options);
1793
- });
1794
- positionSync = this.maintainPlaybackPosition(timingObject, player, options);
1795
- this.addEventListener('disconnect', function () {
1796
- positionSync.cancel();
1797
- playerUpdater.cancel();
1798
- });
1799
- _context2.next = 14;
1800
- break;
1801
- case 10:
1802
- _context2.next = 12;
1803
- return this.updateTimingObject(timingObject, player);
1804
- case 12:
1805
- timingObjectUpdater = subscribe(player, ['seeked', 'play', 'pause', 'ratechange'], function () {
1806
- return _this2.updateTimingObject(timingObject, player);
1807
- }, 'on', 'off');
1808
- this.addEventListener('disconnect', function () {
1809
- return timingObjectUpdater.cancel();
1810
- });
1811
- case 14:
1812
- case "end":
1813
- return _context2.stop();
1814
- }
1815
- }, _callee2, this);
1816
- }));
1817
- function init(_x3, _x4, _x5) {
1818
- return _init.apply(this, arguments);
1819
- }
1820
- return init;
1821
- }()
1822
- /**
1823
- * Sets the TimingObject's state to reflect that of the player
1824
- *
1825
- * @param {TimingObject} timingObject
1826
- * @param {PlayerControls} player
1827
- * @return {Promise<void>}
1828
- */
1829
- }, {
1830
- key: "updateTimingObject",
1831
- value: function () {
1832
- var _updateTimingObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(timingObject, player) {
1833
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1834
- while (1) switch (_context3.prev = _context3.next) {
1835
- case 0:
1836
- _context3.t0 = timingObject;
1837
- _context3.next = 3;
1838
- return player.getCurrentTime();
1839
- case 3:
1840
- _context3.t1 = _context3.sent;
1841
- _context3.next = 6;
1842
- return player.getPaused();
1843
- case 6:
1844
- if (!_context3.sent) {
1845
- _context3.next = 10;
1846
- break;
1847
- }
1848
- _context3.t2 = 0;
1849
- _context3.next = 13;
1850
- break;
1851
- case 10:
1852
- _context3.next = 12;
1853
- return player.getPlaybackRate();
1854
- case 12:
1855
- _context3.t2 = _context3.sent;
1856
- case 13:
1857
- _context3.t3 = _context3.t2;
1858
- _context3.t4 = {
1859
- position: _context3.t1,
1860
- velocity: _context3.t3
1861
- };
1862
- _context3.t0.update.call(_context3.t0, _context3.t4);
1863
- case 16:
1864
- case "end":
1865
- return _context3.stop();
1866
- }
1867
- }, _callee3);
1868
- }));
1869
- function updateTimingObject(_x6, _x7) {
1870
- return _updateTimingObject.apply(this, arguments);
1871
- }
1872
- return updateTimingObject;
1873
- }()
1874
- /**
1875
- * Sets the player's timing state to reflect that of the TimingObject
1876
- *
1877
- * @param {TimingObject} timingObject
1878
- * @param {PlayerControls} player
1879
- * @param {TimingSrcConnectorOptions} options
1880
- * @return {Promise<void>}
1881
- */
1882
- }, {
1883
- key: "updatePlayer",
1884
- value: function () {
1885
- var _updatePlayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(timingObject, player, options) {
1886
- var _timingObject$query, position, velocity;
1887
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1888
- while (1) switch (_context5.prev = _context5.next) {
1889
- case 0:
1890
- _timingObject$query = timingObject.query(), position = _timingObject$query.position, velocity = _timingObject$query.velocity;
1891
- if (typeof position === 'number') {
1892
- player.setCurrentTime(position);
1893
- }
1894
- if (!(typeof velocity === 'number')) {
1895
- _context5.next = 25;
1896
- break;
1897
- }
1898
- if (!(velocity === 0)) {
1899
- _context5.next = 11;
1900
- break;
1901
- }
1902
- _context5.next = 6;
1903
- return player.getPaused();
1904
- case 6:
1905
- _context5.t0 = _context5.sent;
1906
- if (!(_context5.t0 === false)) {
1907
- _context5.next = 9;
1908
- break;
1909
- }
1910
- player.pause();
1911
- case 9:
1912
- _context5.next = 25;
1913
- break;
1914
- case 11:
1915
- if (!(velocity > 0)) {
1916
- _context5.next = 25;
1917
- break;
1918
- }
1919
- _context5.next = 14;
1920
- return player.getPaused();
1921
- case 14:
1922
- _context5.t1 = _context5.sent;
1923
- if (!(_context5.t1 === true)) {
1924
- _context5.next = 19;
1925
- break;
1926
- }
1927
- _context5.next = 18;
1928
- return player.play().catch( /*#__PURE__*/function () {
1929
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(err) {
1930
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1931
- while (1) switch (_context4.prev = _context4.next) {
1932
- case 0:
1933
- if (!(err.name === 'NotAllowedError' && options.autoPlayMuted)) {
1934
- _context4.next = 5;
1935
- break;
1936
- }
1937
- _context4.next = 3;
1938
- return player.setMuted(true);
1939
- case 3:
1940
- _context4.next = 5;
1941
- return player.play().catch(function (err2) {
1942
- return console.error('Couldn\'t play the video from TimingSrcConnector. Error:', err2);
1943
- });
1944
- case 5:
1945
- case "end":
1946
- return _context4.stop();
1947
- }
1948
- }, _callee4);
1949
- }));
1950
- return function (_x11) {
1951
- return _ref2.apply(this, arguments);
1952
- };
1953
- }());
1954
- case 18:
1955
- this.updatePlayer(timingObject, player, options);
1956
- case 19:
1957
- _context5.next = 21;
1958
- return player.getPlaybackRate();
1959
- case 21:
1960
- _context5.t2 = _context5.sent;
1961
- _context5.t3 = velocity;
1962
- if (!(_context5.t2 !== _context5.t3)) {
1963
- _context5.next = 25;
1964
- break;
1965
- }
1966
- player.setPlaybackRate(velocity);
1967
- case 25:
1968
- case "end":
1969
- return _context5.stop();
1970
- }
1971
- }, _callee5, this);
1972
- }));
1973
- function updatePlayer(_x8, _x9, _x10) {
1974
- return _updatePlayer.apply(this, arguments);
1975
- }
1976
- return updatePlayer;
1977
- }()
1978
- /**
1979
- * Since video players do not play with 100% time precision, we need to closely monitor
1980
- * our player to be sure it remains in sync with the TimingObject.
1981
- *
1982
- * If out of sync, we use the current conditions and the options provided to determine
1983
- * whether to re-sync via setting currentTime or adjusting the playbackRate
1984
- *
1985
- * @param {TimingObject} timingObject
1986
- * @param {PlayerControls} player
1987
- * @param {TimingSrcConnectorOptions} options
1988
- * @return {{cancel: (function(): void)}}
1989
- */
1990
- }, {
1991
- key: "maintainPlaybackPosition",
1992
- value: function maintainPlaybackPosition(timingObject, player, options) {
1993
- var _this3 = this;
1994
- var allowedDrift = options.allowedDrift,
1995
- maxAllowedDrift = options.maxAllowedDrift,
1996
- minCheckInterval = options.minCheckInterval,
1997
- maxRateAdjustment = options.maxRateAdjustment,
1998
- maxTimeToCatchUp = options.maxTimeToCatchUp;
1999
- var syncInterval = Math.min(maxTimeToCatchUp, Math.max(minCheckInterval, maxAllowedDrift)) * 1000;
2000
- var check = /*#__PURE__*/function () {
2001
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
2002
- var diff, diffAbs, min, max, adjustment;
2003
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
2004
- while (1) switch (_context6.prev = _context6.next) {
2005
- case 0:
2006
- _context6.t0 = timingObject.query().velocity === 0;
2007
- if (_context6.t0) {
2008
- _context6.next = 6;
2009
- break;
2010
- }
2011
- _context6.next = 4;
2012
- return player.getPaused();
2013
- case 4:
2014
- _context6.t1 = _context6.sent;
2015
- _context6.t0 = _context6.t1 === true;
2016
- case 6:
2017
- if (!_context6.t0) {
2018
- _context6.next = 8;
2019
- break;
2020
- }
2021
- return _context6.abrupt("return");
2022
- case 8:
2023
- _context6.t2 = timingObject.query().position;
2024
- _context6.next = 11;
2025
- return player.getCurrentTime();
2026
- case 11:
2027
- _context6.t3 = _context6.sent;
2028
- diff = _context6.t2 - _context6.t3;
2029
- diffAbs = Math.abs(diff);
2030
- _this3.log("Drift: ".concat(diff));
2031
- if (!(diffAbs > maxAllowedDrift)) {
2032
- _context6.next = 22;
2033
- break;
2034
- }
2035
- _context6.next = 18;
2036
- return _this3.adjustSpeed(player, 0);
2037
- case 18:
2038
- player.setCurrentTime(timingObject.query().position);
2039
- _this3.log('Resync by currentTime');
2040
- _context6.next = 29;
2041
- break;
2042
- case 22:
2043
- if (!(diffAbs > allowedDrift)) {
2044
- _context6.next = 29;
2045
- break;
2046
- }
2047
- min = diffAbs / maxTimeToCatchUp;
2048
- max = maxRateAdjustment;
2049
- adjustment = min < max ? (max - min) / 2 : max;
2050
- _context6.next = 28;
2051
- return _this3.adjustSpeed(player, adjustment * Math.sign(diff));
2052
- case 28:
2053
- _this3.log('Resync by playbackRate');
2054
- case 29:
2055
- case "end":
2056
- return _context6.stop();
2057
- }
2058
- }, _callee6);
2059
- }));
2060
- return function check() {
2061
- return _ref3.apply(this, arguments);
2062
- };
2063
- }();
2064
- var interval = setInterval(function () {
2065
- return check();
2066
- }, syncInterval);
2067
- return {
2068
- cancel: function cancel() {
2069
- return clearInterval(interval);
2070
- }
2071
- };
1002
+ function processData(player, data) {
1003
+ data = parseMessageData(data);
1004
+ var callbacks = [];
1005
+ var param;
1006
+
1007
+ if (data.event) {
1008
+ if (data.event === 'error') {
1009
+ var promises = getCallbacks(player, data.data.method);
1010
+ promises.forEach(function (promise) {
1011
+ var error = new Error(data.data.message);
1012
+ error.name = data.data.name;
1013
+ promise.reject(error);
1014
+ removeCallback(player, data.data.method, promise);
1015
+ });
2072
1016
  }
2073
1017
 
2074
- /**
2075
- * @param {string} msg
2076
- */
2077
- }, {
2078
- key: "log",
2079
- value: function log(msg) {
2080
- var _this$logger;
2081
- (_this$logger = this.logger) === null || _this$logger === void 0 ? void 0 : _this$logger.call(this, "TimingSrcConnector: ".concat(msg));
1018
+ callbacks = getCallbacks(player, "event:".concat(data.event));
1019
+ param = data.data;
1020
+ } else if (data.method) {
1021
+ var callback = shiftCallbacks(player, data.method);
1022
+
1023
+ if (callback) {
1024
+ callbacks.push(callback);
1025
+ param = data.value;
2082
1026
  }
2083
- }, {
2084
- key: "waitForTOReadyState",
2085
- value:
2086
- /**
2087
- * @param {TimingObject} timingObject
2088
- * @param {TConnectionState} state
2089
- * @return {Promise<void>}
2090
- */
2091
- function waitForTOReadyState(timingObject, state) {
2092
- return new Promise(function (resolve) {
2093
- var check = function check() {
2094
- if (timingObject.readyState === state) {
2095
- resolve();
2096
- } else {
2097
- timingObject.addEventListener('readystatechange', check, {
2098
- once: true
2099
- });
2100
- }
2101
- };
2102
- check();
2103
- });
1027
+ }
1028
+
1029
+ callbacks.forEach(function (callback) {
1030
+ try {
1031
+ if (typeof callback === 'function') {
1032
+ callback.call(player, param);
1033
+ return;
1034
+ }
1035
+
1036
+ callback.resolve(param);
1037
+ } catch (e) {// empty
2104
1038
  }
2105
- }]);
2106
- return TimingSrcConnector;
2107
- }( /*#__PURE__*/_wrapNativeSuper(EventTarget));
1039
+ });
1040
+ }
2108
1041
 
2109
1042
  var playerMap = new WeakMap();
2110
1043
  var readyMap = new WeakMap();
2111
- var screenfull = {};
2112
- var Player = /*#__PURE__*/function () {
1044
+
1045
+ var Player =
1046
+ /*#__PURE__*/
1047
+ function () {
2113
1048
  /**
2114
1049
  * Create a Player.
2115
1050
  *
@@ -2120,80 +1055,99 @@
2120
1055
  */
2121
1056
  function Player(element) {
2122
1057
  var _this = this;
1058
+
2123
1059
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1060
+
2124
1061
  _classCallCheck(this, Player);
1062
+
2125
1063
  /* global jQuery */
2126
1064
  if (window.jQuery && element instanceof jQuery) {
2127
1065
  if (element.length > 1 && window.console && console.warn) {
2128
1066
  console.warn('A jQuery object with multiple elements was passed, using the first element.');
2129
1067
  }
1068
+
2130
1069
  element = element[0];
2131
- }
1070
+ } // Find an element by ID
1071
+
2132
1072
 
2133
- // Find an element by ID
2134
1073
  if (typeof document !== 'undefined' && typeof element === 'string') {
2135
1074
  element = document.getElementById(element);
2136
- }
1075
+ } // Not an element!
1076
+
2137
1077
 
2138
- // Not an element!
2139
1078
  if (!isDomElement(element)) {
2140
1079
  throw new TypeError('You must pass either a valid element or a valid id.');
2141
1080
  }
2142
1081
 
2143
- // Already initialized an embed in this div, so grab the iframe
1082
+ var win = element.ownerDocument.defaultView; // Already initialized an embed in this div, so grab the iframe
1083
+
2144
1084
  if (element.nodeName !== 'IFRAME') {
2145
1085
  var iframe = element.querySelector('iframe');
1086
+
2146
1087
  if (iframe) {
2147
1088
  element = iframe;
2148
1089
  }
2149
- }
1090
+ } // iframe url is not a Vimeo url
1091
+
2150
1092
 
2151
- // iframe url is not a Vimeo url
2152
1093
  if (element.nodeName === 'IFRAME' && !isVimeoUrl(element.getAttribute('src') || '')) {
2153
1094
  throw new Error('The player element passed isn’t a Vimeo embed.');
2154
- }
1095
+ } // If there is already a player object in the map, return that
1096
+
2155
1097
 
2156
- // If there is already a player object in the map, return that
2157
1098
  if (playerMap.has(element)) {
2158
1099
  return playerMap.get(element);
2159
1100
  }
2160
- this._window = element.ownerDocument.defaultView;
1101
+
2161
1102
  this.element = element;
2162
1103
  this.origin = '*';
2163
1104
  var readyPromise = new npo_src(function (resolve, reject) {
2164
- _this._onMessage = function (event) {
1105
+ var onMessage = function onMessage(event) {
2165
1106
  if (!isVimeoUrl(event.origin) || _this.element.contentWindow !== event.source) {
2166
1107
  return;
2167
1108
  }
1109
+
2168
1110
  if (_this.origin === '*') {
2169
1111
  _this.origin = event.origin;
2170
1112
  }
1113
+
2171
1114
  var data = parseMessageData(event.data);
2172
1115
  var isError = data && data.event === 'error';
2173
1116
  var isReadyError = isError && data.data && data.data.method === 'ready';
1117
+
2174
1118
  if (isReadyError) {
2175
1119
  var error = new Error(data.data.message);
2176
1120
  error.name = data.data.name;
2177
1121
  reject(error);
2178
1122
  return;
2179
1123
  }
1124
+
2180
1125
  var isReadyEvent = data && data.event === 'ready';
2181
1126
  var isPingResponse = data && data.method === 'ping';
1127
+
2182
1128
  if (isReadyEvent || isPingResponse) {
2183
1129
  _this.element.setAttribute('data-ready', 'true');
1130
+
2184
1131
  resolve();
2185
1132
  return;
2186
1133
  }
1134
+
2187
1135
  processData(_this, data);
2188
1136
  };
2189
- _this._window.addEventListener('message', _this._onMessage);
1137
+
1138
+ if (win.addEventListener) {
1139
+ win.addEventListener('message', onMessage, false);
1140
+ } else if (win.attachEvent) {
1141
+ win.attachEvent('onmessage', onMessage);
1142
+ }
1143
+
2190
1144
  if (_this.element.nodeName !== 'IFRAME') {
2191
1145
  var params = getOEmbedParameters(element, options);
2192
1146
  var url = getVimeoUrl(params);
2193
1147
  getOEmbedData(url, params, element).then(function (data) {
2194
- var iframe = createEmbed(data, element);
2195
- // Overwrite element with the new iframe,
1148
+ var iframe = createEmbed(data, element); // Overwrite element with the new iframe,
2196
1149
  // but store reference to the original element
1150
+
2197
1151
  _this.element = iframe;
2198
1152
  _this._originalElement = element;
2199
1153
  swapCallbacks(element, iframe);
@@ -2201,37 +1155,18 @@
2201
1155
  return data;
2202
1156
  }).catch(reject);
2203
1157
  }
2204
- });
1158
+ }); // Store a copy of this Player in the map
2205
1159
 
2206
- // Store a copy of this Player in the map
2207
1160
  readyMap.set(this, readyPromise);
2208
- playerMap.set(this.element, this);
2209
-
2210
- // Send a ping to the iframe so the ready promise will be resolved if
1161
+ playerMap.set(this.element, this); // Send a ping to the iframe so the ready promise will be resolved if
2211
1162
  // the player is already ready.
1163
+
2212
1164
  if (this.element.nodeName === 'IFRAME') {
2213
1165
  postMessage(this, 'ping');
2214
1166
  }
2215
- if (screenfull.isEnabled) {
2216
- var exitFullscreen = function exitFullscreen() {
2217
- return screenfull.exit();
2218
- };
2219
- this.fullscreenchangeHandler = function () {
2220
- if (screenfull.isFullscreen) {
2221
- storeCallback(_this, 'event:exitFullscreen', exitFullscreen);
2222
- } else {
2223
- removeCallback(_this, 'event:exitFullscreen', exitFullscreen);
2224
- }
2225
- // eslint-disable-next-line
2226
- _this.ready().then(function () {
2227
- postMessage(_this, 'fullscreenchange', screenfull.isFullscreen);
2228
- });
2229
- };
2230
- screenfull.on('fullscreenchange', this.fullscreenchangeHandler);
2231
- }
1167
+
2232
1168
  return this;
2233
1169
  }
2234
-
2235
1170
  /**
2236
1171
  * Get a promise for a method.
2237
1172
  *
@@ -2239,10 +1174,13 @@
2239
1174
  * @param {Object} [args={}] Arguments to send via postMessage.
2240
1175
  * @return {Promise}
2241
1176
  */
1177
+
1178
+
2242
1179
  _createClass(Player, [{
2243
1180
  key: "callMethod",
2244
1181
  value: function callMethod(name) {
2245
1182
  var _this2 = this;
1183
+
2246
1184
  var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2247
1185
  return new npo_src(function (resolve, reject) {
2248
1186
  // We are storing the resolve/reject handlers to call later, so we
@@ -2257,23 +1195,23 @@
2257
1195
  }).catch(reject);
2258
1196
  });
2259
1197
  }
2260
-
2261
1198
  /**
2262
1199
  * Get a promise for the value of a player property.
2263
1200
  *
2264
1201
  * @param {string} name The property name
2265
1202
  * @return {Promise}
2266
1203
  */
1204
+
2267
1205
  }, {
2268
1206
  key: "get",
2269
1207
  value: function get(name) {
2270
1208
  var _this3 = this;
2271
- return new npo_src(function (resolve, reject) {
2272
- name = getMethodName(name, 'get');
2273
1209
 
2274
- // We are storing the resolve/reject handlers to call later, so we
1210
+ return new npo_src(function (resolve, reject) {
1211
+ name = getMethodName(name, 'get'); // We are storing the resolve/reject handlers to call later, so we
2275
1212
  // can’t return here.
2276
1213
  // eslint-disable-next-line promise/always-return
1214
+
2277
1215
  return _this3.ready().then(function () {
2278
1216
  storeCallback(_this3, name, {
2279
1217
  resolve: resolve,
@@ -2283,7 +1221,6 @@
2283
1221
  }).catch(reject);
2284
1222
  });
2285
1223
  }
2286
-
2287
1224
  /**
2288
1225
  * Get a promise for setting the value of a player property.
2289
1226
  *
@@ -2291,19 +1228,22 @@
2291
1228
  * @param {mixed} value The value to set.
2292
1229
  * @return {Promise}
2293
1230
  */
1231
+
2294
1232
  }, {
2295
1233
  key: "set",
2296
1234
  value: function set(name, value) {
2297
1235
  var _this4 = this;
1236
+
2298
1237
  return new npo_src(function (resolve, reject) {
2299
1238
  name = getMethodName(name, 'set');
1239
+
2300
1240
  if (value === undefined || value === null) {
2301
1241
  throw new TypeError('There must be a value to set.');
2302
- }
2303
-
2304
- // We are storing the resolve/reject handlers to call later, so we
1242
+ } // We are storing the resolve/reject handlers to call later, so we
2305
1243
  // can’t return here.
2306
1244
  // eslint-disable-next-line promise/always-return
1245
+
1246
+
2307
1247
  return _this4.ready().then(function () {
2308
1248
  storeCallback(_this4, name, {
2309
1249
  resolve: resolve,
@@ -2313,7 +1253,6 @@
2313
1253
  }).catch(reject);
2314
1254
  });
2315
1255
  }
2316
-
2317
1256
  /**
2318
1257
  * Add an event listener for the specified event. Will call the
2319
1258
  * callback with a single parameter, `data`, that contains the data for
@@ -2323,28 +1262,32 @@
2323
1262
  * @param {function(*)} callback The function to call when the event fires.
2324
1263
  * @return {void}
2325
1264
  */
1265
+
2326
1266
  }, {
2327
1267
  key: "on",
2328
1268
  value: function on(eventName, callback) {
2329
1269
  if (!eventName) {
2330
1270
  throw new TypeError('You must pass an event name.');
2331
1271
  }
1272
+
2332
1273
  if (!callback) {
2333
1274
  throw new TypeError('You must pass a callback function.');
2334
1275
  }
1276
+
2335
1277
  if (typeof callback !== 'function') {
2336
1278
  throw new TypeError('The callback must be a function.');
2337
1279
  }
1280
+
2338
1281
  var callbacks = getCallbacks(this, "event:".concat(eventName));
1282
+
2339
1283
  if (callbacks.length === 0) {
2340
- this.callMethod('addEventListener', eventName).catch(function () {
2341
- // Ignore the error. There will be an error event fired that
1284
+ this.callMethod('addEventListener', eventName).catch(function () {// Ignore the error. There will be an error event fired that
2342
1285
  // will trigger the error callback if they are listening.
2343
1286
  });
2344
1287
  }
1288
+
2345
1289
  storeCallback(this, "event:".concat(eventName), callback);
2346
1290
  }
2347
-
2348
1291
  /**
2349
1292
  * Remove an event listener for the specified event. Will remove all
2350
1293
  * listeners for that event if a `callback` isn’t passed, or only that
@@ -2354,47 +1297,48 @@
2354
1297
  * @param {function} [callback] The specific callback to remove.
2355
1298
  * @return {void}
2356
1299
  */
1300
+
2357
1301
  }, {
2358
1302
  key: "off",
2359
1303
  value: function off(eventName, callback) {
2360
1304
  if (!eventName) {
2361
1305
  throw new TypeError('You must pass an event name.');
2362
1306
  }
1307
+
2363
1308
  if (callback && typeof callback !== 'function') {
2364
1309
  throw new TypeError('The callback must be a function.');
2365
1310
  }
2366
- var lastCallback = removeCallback(this, "event:".concat(eventName), callback);
2367
1311
 
2368
- // If there are no callbacks left, remove the listener
1312
+ var lastCallback = removeCallback(this, "event:".concat(eventName), callback); // If there are no callbacks left, remove the listener
1313
+
2369
1314
  if (lastCallback) {
2370
- this.callMethod('removeEventListener', eventName).catch(function (e) {
2371
- // Ignore the error. There will be an error event fired that
1315
+ this.callMethod('removeEventListener', eventName).catch(function (e) {// Ignore the error. There will be an error event fired that
2372
1316
  // will trigger the error callback if they are listening.
2373
1317
  });
2374
1318
  }
2375
1319
  }
2376
-
2377
1320
  /**
2378
1321
  * A promise to load a new video.
2379
1322
  *
2380
1323
  * @promise LoadVideoPromise
2381
- * @fulfill {number} The video with this id or url successfully loaded.
1324
+ * @fulfill {number} The video with this id successfully loaded.
2382
1325
  * @reject {TypeError} The id was not a number.
2383
1326
  */
1327
+
2384
1328
  /**
2385
1329
  * Load a new video into this embed. The promise will be resolved if
2386
1330
  * the video is successfully loaded, or it will be rejected if it could
2387
1331
  * not be loaded.
2388
1332
  *
2389
- * @param {number|string|object} options The id of the video, the url of the video, or an object with embed options.
1333
+ * @param {number|object} options The id of the video or an object with embed options.
2390
1334
  * @return {LoadVideoPromise}
2391
1335
  */
1336
+
2392
1337
  }, {
2393
1338
  key: "loadVideo",
2394
1339
  value: function loadVideo(options) {
2395
1340
  return this.callMethod('loadVideo', options);
2396
1341
  }
2397
-
2398
1342
  /**
2399
1343
  * A promise to perform an action when the Player is ready.
2400
1344
  *
@@ -2402,6 +1346,7 @@
2402
1346
  * @promise LoadVideoPromise
2403
1347
  * @fulfill {void}
2404
1348
  */
1349
+
2405
1350
  /**
2406
1351
  * Trigger a function when the player iframe has initialized. You do not
2407
1352
  * need to wait for `ready` to trigger to begin adding event listeners
@@ -2409,6 +1354,7 @@
2409
1354
  *
2410
1355
  * @return {ReadyPromise}
2411
1356
  */
1357
+
2412
1358
  }, {
2413
1359
  key: "ready",
2414
1360
  value: function ready() {
@@ -2417,7 +1363,6 @@
2417
1363
  });
2418
1364
  return npo_src.resolve(readyPromise);
2419
1365
  }
2420
-
2421
1366
  /**
2422
1367
  * A promise to add a cue point to the player.
2423
1368
  *
@@ -2428,6 +1373,7 @@
2428
1373
  * @reject {UnsupportedError} Cue points are not supported with the current
2429
1374
  * player or browser.
2430
1375
  */
1376
+
2431
1377
  /**
2432
1378
  * Add a cue point to the player.
2433
1379
  *
@@ -2435,6 +1381,7 @@
2435
1381
  * @param {object} [data] Arbitrary data to be returned with the cue point.
2436
1382
  * @return {AddCuePointPromise}
2437
1383
  */
1384
+
2438
1385
  }, {
2439
1386
  key: "addCuePoint",
2440
1387
  value: function addCuePoint(time) {
@@ -2444,7 +1391,6 @@
2444
1391
  data: data
2445
1392
  });
2446
1393
  }
2447
-
2448
1394
  /**
2449
1395
  * A promise to remove a cue point from the player.
2450
1396
  *
@@ -2455,18 +1401,19 @@
2455
1401
  * @reject {UnsupportedError} Cue points are not supported with the current
2456
1402
  * player or browser.
2457
1403
  */
1404
+
2458
1405
  /**
2459
1406
  * Remove a cue point from the video.
2460
1407
  *
2461
1408
  * @param {string} id The id of the cue point to remove.
2462
1409
  * @return {RemoveCuePointPromise}
2463
1410
  */
1411
+
2464
1412
  }, {
2465
1413
  key: "removeCuePoint",
2466
1414
  value: function removeCuePoint(id) {
2467
1415
  return this.callMethod('removeCuePoint', id);
2468
1416
  }
2469
-
2470
1417
  /**
2471
1418
  * A representation of a text track on a video.
2472
1419
  *
@@ -2475,6 +1422,7 @@
2475
1422
  * @property {string} kind The kind of track it is (captions or subtitles).
2476
1423
  * @property {string} label The human‐readable label for the track.
2477
1424
  */
1425
+
2478
1426
  /**
2479
1427
  * A promise to enable a text track.
2480
1428
  *
@@ -2485,6 +1433,7 @@
2485
1433
  * @reject {InvalidTrackError} No track was available with the specified
2486
1434
  * language and kind.
2487
1435
  */
1436
+
2488
1437
  /**
2489
1438
  * Enable the text track with the specified language, and optionally the
2490
1439
  * specified kind (captions or subtitles).
@@ -2496,176 +1445,94 @@
2496
1445
  * @param {string} [kind] The kind of track to enable (captions or subtitles).
2497
1446
  * @return {EnableTextTrackPromise}
2498
1447
  */
1448
+
2499
1449
  }, {
2500
1450
  key: "enableTextTrack",
2501
1451
  value: function enableTextTrack(language, kind) {
2502
1452
  if (!language) {
2503
1453
  throw new TypeError('You must pass a language.');
2504
1454
  }
1455
+
2505
1456
  return this.callMethod('enableTextTrack', {
2506
1457
  language: language,
2507
1458
  kind: kind
2508
1459
  });
2509
1460
  }
2510
-
2511
1461
  /**
2512
1462
  * A promise to disable the active text track.
2513
1463
  *
2514
1464
  * @promise DisableTextTrackPromise
2515
1465
  * @fulfill {void} The track was disabled.
2516
1466
  */
1467
+
2517
1468
  /**
2518
1469
  * Disable the currently-active text track.
2519
1470
  *
2520
1471
  * @return {DisableTextTrackPromise}
2521
1472
  */
1473
+
2522
1474
  }, {
2523
1475
  key: "disableTextTrack",
2524
1476
  value: function disableTextTrack() {
2525
1477
  return this.callMethod('disableTextTrack');
2526
1478
  }
2527
-
2528
1479
  /**
2529
1480
  * A promise to pause the video.
2530
1481
  *
2531
1482
  * @promise PausePromise
2532
1483
  * @fulfill {void} The video was paused.
2533
1484
  */
2534
- /**
2535
- * Pause the video if it’s playing.
2536
- *
2537
- * @return {PausePromise}
2538
- */
2539
- }, {
2540
- key: "pause",
2541
- value: function pause() {
2542
- return this.callMethod('pause');
2543
- }
2544
-
2545
- /**
2546
- * A promise to play the video.
2547
- *
2548
- * @promise PlayPromise
2549
- * @fulfill {void} The video was played.
2550
- */
2551
- /**
2552
- * Play the video if it’s paused. **Note:** on iOS and some other
2553
- * mobile devices, you cannot programmatically trigger play. Once the
2554
- * viewer has tapped on the play button in the player, however, you
2555
- * will be able to use this function.
2556
- *
2557
- * @return {PlayPromise}
2558
- */
2559
- }, {
2560
- key: "play",
2561
- value: function play() {
2562
- return this.callMethod('play');
2563
- }
2564
-
2565
- /**
2566
- * Request that the player enters fullscreen.
2567
- * @return {Promise}
2568
- */
2569
- }, {
2570
- key: "requestFullscreen",
2571
- value: function requestFullscreen() {
2572
- if (screenfull.isEnabled) {
2573
- return screenfull.request(this.element);
2574
- }
2575
- return this.callMethod('requestFullscreen');
2576
- }
2577
-
2578
- /**
2579
- * Request that the player exits fullscreen.
2580
- * @return {Promise}
2581
- */
2582
- }, {
2583
- key: "exitFullscreen",
2584
- value: function exitFullscreen() {
2585
- if (screenfull.isEnabled) {
2586
- return screenfull.exit();
2587
- }
2588
- return this.callMethod('exitFullscreen');
2589
- }
2590
-
2591
- /**
2592
- * Returns true if the player is currently fullscreen.
2593
- * @return {Promise}
2594
- */
2595
- }, {
2596
- key: "getFullscreen",
2597
- value: function getFullscreen() {
2598
- if (screenfull.isEnabled) {
2599
- return npo_src.resolve(screenfull.isFullscreen);
2600
- }
2601
- return this.get('fullscreen');
2602
- }
2603
-
2604
- /**
2605
- * Request that the player enters picture-in-picture.
2606
- * @return {Promise}
2607
- */
2608
- }, {
2609
- key: "requestPictureInPicture",
2610
- value: function requestPictureInPicture() {
2611
- return this.callMethod('requestPictureInPicture');
2612
- }
2613
1485
 
2614
1486
  /**
2615
- * Request that the player exits picture-in-picture.
2616
- * @return {Promise}
1487
+ * Pause the video if it’s playing.
1488
+ *
1489
+ * @return {PausePromise}
2617
1490
  */
2618
- }, {
2619
- key: "exitPictureInPicture",
2620
- value: function exitPictureInPicture() {
2621
- return this.callMethod('exitPictureInPicture');
2622
- }
2623
1491
 
2624
- /**
2625
- * Returns true if the player is currently picture-in-picture.
2626
- * @return {Promise}
2627
- */
2628
1492
  }, {
2629
- key: "getPictureInPicture",
2630
- value: function getPictureInPicture() {
2631
- return this.get('pictureInPicture');
1493
+ key: "pause",
1494
+ value: function pause() {
1495
+ return this.callMethod('pause');
2632
1496
  }
2633
-
2634
1497
  /**
2635
- * A promise to prompt the viewer to initiate remote playback.
1498
+ * A promise to play the video.
2636
1499
  *
2637
- * @promise RemotePlaybackPromptPromise
2638
- * @fulfill {void}
2639
- * @reject {NotFoundError} No remote playback device is available.
1500
+ * @promise PlayPromise
1501
+ * @fulfill {void} The video was played.
2640
1502
  */
1503
+
2641
1504
  /**
2642
- * Request to prompt the user to initiate remote playback.
1505
+ * Play the video if it’s paused. **Note:** on iOS and some other
1506
+ * mobile devices, you cannot programmatically trigger play. Once the
1507
+ * viewer has tapped on the play button in the player, however, you
1508
+ * will be able to use this function.
2643
1509
  *
2644
- * @return {RemotePlaybackPromptPromise}
1510
+ * @return {PlayPromise}
2645
1511
  */
1512
+
2646
1513
  }, {
2647
- key: "remotePlaybackPrompt",
2648
- value: function remotePlaybackPrompt() {
2649
- return this.callMethod('remotePlaybackPrompt');
1514
+ key: "play",
1515
+ value: function play() {
1516
+ return this.callMethod('play');
2650
1517
  }
2651
-
2652
1518
  /**
2653
1519
  * A promise to unload the video.
2654
1520
  *
2655
1521
  * @promise UnloadPromise
2656
1522
  * @fulfill {void} The video was unloaded.
2657
1523
  */
1524
+
2658
1525
  /**
2659
1526
  * Return the player to its initial state.
2660
1527
  *
2661
1528
  * @return {UnloadPromise}
2662
1529
  */
1530
+
2663
1531
  }, {
2664
1532
  key: "unload",
2665
1533
  value: function unload() {
2666
1534
  return this.callMethod('unload');
2667
1535
  }
2668
-
2669
1536
  /**
2670
1537
  * Cleanup the player and remove it from the DOM
2671
1538
  *
@@ -2674,50 +1541,29 @@
2674
1541
  *
2675
1542
  * @return {Promise}
2676
1543
  */
1544
+
2677
1545
  }, {
2678
1546
  key: "destroy",
2679
1547
  value: function destroy() {
2680
1548
  var _this5 = this;
1549
+
2681
1550
  return new npo_src(function (resolve) {
2682
1551
  readyMap.delete(_this5);
2683
1552
  playerMap.delete(_this5.element);
1553
+
2684
1554
  if (_this5._originalElement) {
2685
1555
  playerMap.delete(_this5._originalElement);
1556
+
2686
1557
  _this5._originalElement.removeAttribute('data-vimeo-initialized');
2687
1558
  }
1559
+
2688
1560
  if (_this5.element && _this5.element.nodeName === 'IFRAME' && _this5.element.parentNode) {
2689
- // If we've added an additional wrapper div, remove that from the DOM.
2690
- // If not, just remove the iframe element.
2691
- if (_this5.element.parentNode.parentNode && _this5._originalElement && _this5._originalElement !== _this5.element.parentNode) {
2692
- _this5.element.parentNode.parentNode.removeChild(_this5.element.parentNode);
2693
- } else {
2694
- _this5.element.parentNode.removeChild(_this5.element);
2695
- }
1561
+ _this5.element.parentNode.removeChild(_this5.element);
2696
1562
  }
2697
1563
 
2698
- // If the clip is private there is a case where the element stays the
2699
- // div element. Destroy should reset the div and remove the iframe child.
2700
- if (_this5.element && _this5.element.nodeName === 'DIV' && _this5.element.parentNode) {
2701
- _this5.element.removeAttribute('data-vimeo-initialized');
2702
- var iframe = _this5.element.querySelector('iframe');
2703
- if (iframe && iframe.parentNode) {
2704
- // If we've added an additional wrapper div, remove that from the DOM.
2705
- // If not, just remove the iframe element.
2706
- if (iframe.parentNode.parentNode && _this5._originalElement && _this5._originalElement !== iframe.parentNode) {
2707
- iframe.parentNode.parentNode.removeChild(iframe.parentNode);
2708
- } else {
2709
- iframe.parentNode.removeChild(iframe);
2710
- }
2711
- }
2712
- }
2713
- _this5._window.removeEventListener('message', _this5._onMessage);
2714
- if (screenfull.isEnabled) {
2715
- screenfull.off('fullscreenchange', _this5.fullscreenchangeHandler);
2716
- }
2717
1564
  resolve();
2718
1565
  });
2719
1566
  }
2720
-
2721
1567
  /**
2722
1568
  * A promise to get the autopause behavior of the video.
2723
1569
  *
@@ -2726,17 +1572,18 @@
2726
1572
  * @reject {UnsupportedError} Autopause is not supported with the current
2727
1573
  * player or browser.
2728
1574
  */
1575
+
2729
1576
  /**
2730
1577
  * Get the autopause behavior for this player.
2731
1578
  *
2732
1579
  * @return {GetAutopausePromise}
2733
1580
  */
1581
+
2734
1582
  }, {
2735
1583
  key: "getAutopause",
2736
1584
  value: function getAutopause() {
2737
1585
  return this.get('autopause');
2738
1586
  }
2739
-
2740
1587
  /**
2741
1588
  * A promise to set the autopause behavior of the video.
2742
1589
  *
@@ -2745,6 +1592,7 @@
2745
1592
  * @reject {UnsupportedError} Autopause is not supported with the current
2746
1593
  * player or browser.
2747
1594
  */
1595
+
2748
1596
  /**
2749
1597
  * Enable or disable the autopause behavior of this player.
2750
1598
  *
@@ -2756,150 +1604,50 @@
2756
1604
  * @param {boolean} autopause
2757
1605
  * @return {SetAutopausePromise}
2758
1606
  */
1607
+
2759
1608
  }, {
2760
1609
  key: "setAutopause",
2761
1610
  value: function setAutopause(autopause) {
2762
1611
  return this.set('autopause', autopause);
2763
1612
  }
2764
-
2765
1613
  /**
2766
1614
  * A promise to get the buffered property of the video.
2767
1615
  *
2768
1616
  * @promise GetBufferedPromise
2769
1617
  * @fulfill {Array} Buffered Timeranges converted to an Array.
2770
1618
  */
1619
+
2771
1620
  /**
2772
1621
  * Get the buffered property of the video.
2773
1622
  *
2774
1623
  * @return {GetBufferedPromise}
2775
1624
  */
1625
+
2776
1626
  }, {
2777
1627
  key: "getBuffered",
2778
1628
  value: function getBuffered() {
2779
1629
  return this.get('buffered');
2780
1630
  }
2781
-
2782
- /**
2783
- * @typedef {Object} CameraProperties
2784
- * @prop {number} props.yaw - Number between 0 and 360.
2785
- * @prop {number} props.pitch - Number between -90 and 90.
2786
- * @prop {number} props.roll - Number between -180 and 180.
2787
- * @prop {number} props.fov - The field of view in degrees.
2788
- */
2789
- /**
2790
- * A promise to get the camera properties of the player.
2791
- *
2792
- * @promise GetCameraPromise
2793
- * @fulfill {CameraProperties} The camera properties.
2794
- */
2795
- /**
2796
- * For 360° videos get the camera properties for this player.
2797
- *
2798
- * @return {GetCameraPromise}
2799
- */
2800
- }, {
2801
- key: "getCameraProps",
2802
- value: function getCameraProps() {
2803
- return this.get('cameraProps');
2804
- }
2805
-
2806
- /**
2807
- * A promise to set the camera properties of the player.
2808
- *
2809
- * @promise SetCameraPromise
2810
- * @fulfill {Object} The camera was successfully set.
2811
- * @reject {RangeError} The range was out of bounds.
2812
- */
2813
- /**
2814
- * For 360° videos set the camera properties for this player.
2815
- *
2816
- * @param {CameraProperties} camera The camera properties
2817
- * @return {SetCameraPromise}
2818
- */
2819
- }, {
2820
- key: "setCameraProps",
2821
- value: function setCameraProps(camera) {
2822
- return this.set('cameraProps', camera);
2823
- }
2824
-
2825
- /**
2826
- * A representation of a chapter.
2827
- *
2828
- * @typedef {Object} VimeoChapter
2829
- * @property {number} startTime The start time of the chapter.
2830
- * @property {object} title The title of the chapter.
2831
- * @property {number} index The place in the order of Chapters. Starts at 1.
2832
- */
2833
- /**
2834
- * A promise to get chapters for the video.
2835
- *
2836
- * @promise GetChaptersPromise
2837
- * @fulfill {VimeoChapter[]} The chapters for the video.
2838
- */
2839
- /**
2840
- * Get an array of all the chapters for the video.
2841
- *
2842
- * @return {GetChaptersPromise}
2843
- */
2844
- }, {
2845
- key: "getChapters",
2846
- value: function getChapters() {
2847
- return this.get('chapters');
2848
- }
2849
-
2850
- /**
2851
- * A promise to get the currently active chapter.
2852
- *
2853
- * @promise GetCurrentChaptersPromise
2854
- * @fulfill {VimeoChapter|undefined} The current chapter for the video.
2855
- */
2856
- /**
2857
- * Get the currently active chapter for the video.
2858
- *
2859
- * @return {GetCurrentChaptersPromise}
2860
- */
2861
- }, {
2862
- key: "getCurrentChapter",
2863
- value: function getCurrentChapter() {
2864
- return this.get('currentChapter');
2865
- }
2866
-
2867
1631
  /**
2868
- * A promise to get the accent color of the player.
1632
+ * A promise to get the color of the player.
2869
1633
  *
2870
1634
  * @promise GetColorPromise
2871
1635
  * @fulfill {string} The hex color of the player.
2872
1636
  */
1637
+
2873
1638
  /**
2874
- * Get the accent color for this player. Note this is deprecated in place of `getColorTwo`.
1639
+ * Get the color for this player.
2875
1640
  *
2876
1641
  * @return {GetColorPromise}
2877
1642
  */
1643
+
2878
1644
  }, {
2879
1645
  key: "getColor",
2880
1646
  value: function getColor() {
2881
1647
  return this.get('color');
2882
1648
  }
2883
-
2884
- /**
2885
- * A promise to get all colors for the player in an array.
2886
- *
2887
- * @promise GetColorsPromise
2888
- * @fulfill {string[]} The hex colors of the player.
2889
- */
2890
- /**
2891
- * Get all the colors for this player in an array: [colorOne, colorTwo, colorThree, colorFour]
2892
- *
2893
- * @return {GetColorPromise}
2894
- */
2895
- }, {
2896
- key: "getColors",
2897
- value: function getColors() {
2898
- return npo_src.all([this.get('colorOne'), this.get('colorTwo'), this.get('colorThree'), this.get('colorFour')]);
2899
- }
2900
-
2901
1649
  /**
2902
- * A promise to set the accent color of the player.
1650
+ * A promise to set the color of the player.
2903
1651
  *
2904
1652
  * @promise SetColorPromise
2905
1653
  * @fulfill {string} The color was successfully set.
@@ -2909,57 +1657,21 @@
2909
1657
  * @reject {EmbedSettingsError} The owner of the player has chosen to
2910
1658
  * use a specific color.
2911
1659
  */
1660
+
2912
1661
  /**
2913
- * Set the accent color of this player to a hex or rgb string. Setting the
1662
+ * Set the color of this player to a hex or rgb string. Setting the
2914
1663
  * color may fail if the owner of the video has set their embed
2915
1664
  * preferences to force a specific color.
2916
- * Note this is deprecated in place of `setColorTwo`.
2917
1665
  *
2918
1666
  * @param {string} color The hex or rgb color string to set.
2919
1667
  * @return {SetColorPromise}
2920
1668
  */
1669
+
2921
1670
  }, {
2922
1671
  key: "setColor",
2923
1672
  value: function setColor(color) {
2924
1673
  return this.set('color', color);
2925
1674
  }
2926
-
2927
- /**
2928
- * A promise to set all colors for the player.
2929
- *
2930
- * @promise SetColorsPromise
2931
- * @fulfill {string[]} The colors were successfully set.
2932
- * @reject {TypeError} The string was not a valid hex or rgb color.
2933
- * @reject {ContrastError} The color was set, but the contrast is
2934
- * outside of the acceptable range.
2935
- * @reject {EmbedSettingsError} The owner of the player has chosen to
2936
- * use a specific color.
2937
- */
2938
- /**
2939
- * Set the colors of this player to a hex or rgb string. Setting the
2940
- * color may fail if the owner of the video has set their embed
2941
- * preferences to force a specific color.
2942
- * The colors should be passed in as an array: [colorOne, colorTwo, colorThree, colorFour].
2943
- * If a color should not be set, the index in the array can be left as null.
2944
- *
2945
- * @param {string[]} colors Array of the hex or rgb color strings to set.
2946
- * @return {SetColorsPromise}
2947
- */
2948
- }, {
2949
- key: "setColors",
2950
- value: function setColors(colors) {
2951
- if (!Array.isArray(colors)) {
2952
- return new npo_src(function (resolve, reject) {
2953
- return reject(new TypeError('Argument must be an array.'));
2954
- });
2955
- }
2956
- var nullPromise = new npo_src(function (resolve) {
2957
- return resolve(null);
2958
- });
2959
- 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];
2960
- return npo_src.all(colorPromises);
2961
- }
2962
-
2963
1675
  /**
2964
1676
  * A representation of a cue point.
2965
1677
  *
@@ -2968,6 +1680,7 @@
2968
1680
  * @property {object} data The data passed when adding the cue point.
2969
1681
  * @property {string} id The unique id for use with removeCuePoint.
2970
1682
  */
1683
+
2971
1684
  /**
2972
1685
  * A promise to get the cue points of a video.
2973
1686
  *
@@ -2976,34 +1689,36 @@
2976
1689
  * @reject {UnsupportedError} Cue points are not supported with the current
2977
1690
  * player or browser.
2978
1691
  */
1692
+
2979
1693
  /**
2980
1694
  * Get an array of the cue points added to the video.
2981
1695
  *
2982
1696
  * @return {GetCuePointsPromise}
2983
1697
  */
1698
+
2984
1699
  }, {
2985
1700
  key: "getCuePoints",
2986
1701
  value: function getCuePoints() {
2987
1702
  return this.get('cuePoints');
2988
1703
  }
2989
-
2990
1704
  /**
2991
1705
  * A promise to get the current time of the video.
2992
1706
  *
2993
1707
  * @promise GetCurrentTimePromise
2994
1708
  * @fulfill {number} The current time in seconds.
2995
1709
  */
1710
+
2996
1711
  /**
2997
1712
  * Get the current playback position in seconds.
2998
1713
  *
2999
1714
  * @return {GetCurrentTimePromise}
3000
1715
  */
1716
+
3001
1717
  }, {
3002
1718
  key: "getCurrentTime",
3003
1719
  value: function getCurrentTime() {
3004
1720
  return this.get('currentTime');
3005
1721
  }
3006
-
3007
1722
  /**
3008
1723
  * A promise to set the current time of the video.
3009
1724
  *
@@ -3012,6 +1727,7 @@
3012
1727
  * @reject {RangeError} the time was less than 0 or greater than the
3013
1728
  * video’s duration.
3014
1729
  */
1730
+
3015
1731
  /**
3016
1732
  * Set the current playback position in seconds. If the player was
3017
1733
  * paused, it will remain paused. Likewise, if the player was playing,
@@ -3024,18 +1740,19 @@
3024
1740
  * @param {number} currentTime
3025
1741
  * @return {SetCurrentTimePromise}
3026
1742
  */
1743
+
3027
1744
  }, {
3028
1745
  key: "setCurrentTime",
3029
1746
  value: function setCurrentTime(currentTime) {
3030
1747
  return this.set('currentTime', currentTime);
3031
1748
  }
3032
-
3033
1749
  /**
3034
1750
  * A promise to get the duration of the video.
3035
1751
  *
3036
1752
  * @promise GetDurationPromise
3037
1753
  * @fulfill {number} The duration in seconds.
3038
1754
  */
1755
+
3039
1756
  /**
3040
1757
  * Get the duration of the video in seconds. It will be rounded to the
3041
1758
  * nearest second before playback begins, and to the nearest thousandth
@@ -3043,53 +1760,56 @@
3043
1760
  *
3044
1761
  * @return {GetDurationPromise}
3045
1762
  */
1763
+
3046
1764
  }, {
3047
1765
  key: "getDuration",
3048
1766
  value: function getDuration() {
3049
1767
  return this.get('duration');
3050
1768
  }
3051
-
3052
1769
  /**
3053
1770
  * A promise to get the ended state of the video.
3054
1771
  *
3055
1772
  * @promise GetEndedPromise
3056
1773
  * @fulfill {boolean} Whether or not the video has ended.
3057
1774
  */
1775
+
3058
1776
  /**
3059
1777
  * Get the ended state of the video. The video has ended if
3060
1778
  * `currentTime === duration`.
3061
1779
  *
3062
1780
  * @return {GetEndedPromise}
3063
1781
  */
1782
+
3064
1783
  }, {
3065
1784
  key: "getEnded",
3066
1785
  value: function getEnded() {
3067
1786
  return this.get('ended');
3068
1787
  }
3069
-
3070
1788
  /**
3071
1789
  * A promise to get the loop state of the player.
3072
1790
  *
3073
1791
  * @promise GetLoopPromise
3074
1792
  * @fulfill {boolean} Whether or not the player is set to loop.
3075
1793
  */
1794
+
3076
1795
  /**
3077
1796
  * Get the loop state of the player.
3078
1797
  *
3079
1798
  * @return {GetLoopPromise}
3080
1799
  */
1800
+
3081
1801
  }, {
3082
1802
  key: "getLoop",
3083
1803
  value: function getLoop() {
3084
1804
  return this.get('loop');
3085
1805
  }
3086
-
3087
1806
  /**
3088
1807
  * A promise to set the loop state of the player.
3089
1808
  *
3090
1809
  * @promise SetLoopPromise
3091
1810
  * @fulfill {boolean} The loop state that was set.
3092
1811
  */
1812
+
3093
1813
  /**
3094
1814
  * Set the loop state of the player. When set to `true`, the player
3095
1815
  * will start over immediately once playback ends.
@@ -3097,18 +1817,19 @@
3097
1817
  * @param {boolean} loop
3098
1818
  * @return {SetLoopPromise}
3099
1819
  */
1820
+
3100
1821
  }, {
3101
1822
  key: "setLoop",
3102
1823
  value: function setLoop(loop) {
3103
1824
  return this.set('loop', loop);
3104
1825
  }
3105
-
3106
1826
  /**
3107
1827
  * A promise to set the muted state of the player.
3108
1828
  *
3109
1829
  * @promise SetMutedPromise
3110
1830
  * @fulfill {boolean} The muted state that was set.
3111
1831
  */
1832
+
3112
1833
  /**
3113
1834
  * Set the muted state of the player. When set to `true`, the player
3114
1835
  * volume will be muted.
@@ -3116,326 +1837,252 @@
3116
1837
  * @param {boolean} muted
3117
1838
  * @return {SetMutedPromise}
3118
1839
  */
1840
+
3119
1841
  }, {
3120
1842
  key: "setMuted",
3121
1843
  value: function setMuted(muted) {
3122
1844
  return this.set('muted', muted);
3123
1845
  }
3124
-
3125
1846
  /**
3126
1847
  * A promise to get the muted state of the player.
3127
1848
  *
3128
1849
  * @promise GetMutedPromise
3129
1850
  * @fulfill {boolean} Whether or not the player is muted.
3130
1851
  */
1852
+
3131
1853
  /**
3132
1854
  * Get the muted state of the player.
3133
1855
  *
3134
1856
  * @return {GetMutedPromise}
3135
1857
  */
1858
+
3136
1859
  }, {
3137
1860
  key: "getMuted",
3138
1861
  value: function getMuted() {
3139
1862
  return this.get('muted');
3140
1863
  }
3141
-
3142
1864
  /**
3143
1865
  * A promise to get the paused state of the player.
3144
1866
  *
3145
1867
  * @promise GetLoopPromise
3146
1868
  * @fulfill {boolean} Whether or not the video is paused.
3147
1869
  */
1870
+
3148
1871
  /**
3149
1872
  * Get the paused state of the player.
3150
1873
  *
3151
1874
  * @return {GetLoopPromise}
3152
1875
  */
1876
+
3153
1877
  }, {
3154
1878
  key: "getPaused",
3155
1879
  value: function getPaused() {
3156
1880
  return this.get('paused');
3157
1881
  }
3158
-
3159
1882
  /**
3160
1883
  * A promise to get the playback rate of the player.
3161
1884
  *
3162
1885
  * @promise GetPlaybackRatePromise
3163
- * @fulfill {number} The playback rate of the player on a scale from 0 to 2.
1886
+ * @fulfill {number} The playback rate of the player on a scale from 0.5 to 2.
3164
1887
  */
1888
+
3165
1889
  /**
3166
- * Get the playback rate of the player on a scale from `0` to `2`.
1890
+ * Get the playback rate of the player on a scale from `0.5` to `2`.
3167
1891
  *
3168
1892
  * @return {GetPlaybackRatePromise}
3169
1893
  */
1894
+
3170
1895
  }, {
3171
1896
  key: "getPlaybackRate",
3172
1897
  value: function getPlaybackRate() {
3173
1898
  return this.get('playbackRate');
3174
1899
  }
3175
-
3176
1900
  /**
3177
1901
  * A promise to set the playbackrate of the player.
3178
1902
  *
3179
1903
  * @promise SetPlaybackRatePromise
3180
1904
  * @fulfill {number} The playback rate was set.
3181
- * @reject {RangeError} The playback rate was less than 0 or greater than 2.
1905
+ * @reject {RangeError} The playback rate was less than 0.5 or greater than 2.
3182
1906
  */
1907
+
3183
1908
  /**
3184
- * Set the playback rate of the player on a scale from `0` to `2`. When set
1909
+ * Set the playback rate of the player on a scale from `0.5` to `2`. When set
3185
1910
  * via the API, the playback rate will not be synchronized to other
3186
1911
  * players or stored as the viewer's preference.
3187
1912
  *
3188
1913
  * @param {number} playbackRate
3189
1914
  * @return {SetPlaybackRatePromise}
3190
1915
  */
1916
+
3191
1917
  }, {
3192
1918
  key: "setPlaybackRate",
3193
1919
  value: function setPlaybackRate(playbackRate) {
3194
1920
  return this.set('playbackRate', playbackRate);
3195
1921
  }
3196
-
3197
1922
  /**
3198
1923
  * A promise to get the played property of the video.
3199
1924
  *
3200
1925
  * @promise GetPlayedPromise
3201
1926
  * @fulfill {Array} Played Timeranges converted to an Array.
3202
1927
  */
1928
+
3203
1929
  /**
3204
1930
  * Get the played property of the video.
3205
1931
  *
3206
1932
  * @return {GetPlayedPromise}
3207
1933
  */
1934
+
3208
1935
  }, {
3209
1936
  key: "getPlayed",
3210
1937
  value: function getPlayed() {
3211
1938
  return this.get('played');
3212
1939
  }
3213
-
3214
- /**
3215
- * A promise to get the qualities available of the current video.
3216
- *
3217
- * @promise GetQualitiesPromise
3218
- * @fulfill {Array} The qualities of the video.
3219
- */
3220
- /**
3221
- * Get the qualities of the current video.
3222
- *
3223
- * @return {GetQualitiesPromise}
3224
- */
3225
- }, {
3226
- key: "getQualities",
3227
- value: function getQualities() {
3228
- return this.get('qualities');
3229
- }
3230
-
3231
- /**
3232
- * A promise to get the current set quality of the video.
3233
- *
3234
- * @promise GetQualityPromise
3235
- * @fulfill {string} The current set quality.
3236
- */
3237
- /**
3238
- * Get the current set quality of the video.
3239
- *
3240
- * @return {GetQualityPromise}
3241
- */
3242
- }, {
3243
- key: "getQuality",
3244
- value: function getQuality() {
3245
- return this.get('quality');
3246
- }
3247
-
3248
- /**
3249
- * A promise to set the video quality.
3250
- *
3251
- * @promise SetQualityPromise
3252
- * @fulfill {number} The quality was set.
3253
- * @reject {RangeError} The quality is not available.
3254
- */
3255
- /**
3256
- * Set a video quality.
3257
- *
3258
- * @param {string} quality
3259
- * @return {SetQualityPromise}
3260
- */
3261
- }, {
3262
- key: "setQuality",
3263
- value: function setQuality(quality) {
3264
- return this.set('quality', quality);
3265
- }
3266
-
3267
- /**
3268
- * A promise to get the remote playback availability.
3269
- *
3270
- * @promise RemotePlaybackAvailabilityPromise
3271
- * @fulfill {boolean} Whether remote playback is available.
3272
- */
3273
- /**
3274
- * Get the availability of remote playback.
3275
- *
3276
- * @return {RemotePlaybackAvailabilityPromise}
3277
- */
3278
- }, {
3279
- key: "getRemotePlaybackAvailability",
3280
- value: function getRemotePlaybackAvailability() {
3281
- return this.get('remotePlaybackAvailability');
3282
- }
3283
-
3284
- /**
3285
- * A promise to get the current remote playback state.
3286
- *
3287
- * @promise RemotePlaybackStatePromise
3288
- * @fulfill {string} The state of the remote playback: connecting, connected, or disconnected.
3289
- */
3290
- /**
3291
- * Get the current remote playback state.
3292
- *
3293
- * @return {RemotePlaybackStatePromise}
3294
- */
3295
- }, {
3296
- key: "getRemotePlaybackState",
3297
- value: function getRemotePlaybackState() {
3298
- return this.get('remotePlaybackState');
3299
- }
3300
-
3301
1940
  /**
3302
1941
  * A promise to get the seekable property of the video.
3303
1942
  *
3304
1943
  * @promise GetSeekablePromise
3305
1944
  * @fulfill {Array} Seekable Timeranges converted to an Array.
3306
1945
  */
1946
+
3307
1947
  /**
3308
1948
  * Get the seekable property of the video.
3309
1949
  *
3310
1950
  * @return {GetSeekablePromise}
3311
1951
  */
1952
+
3312
1953
  }, {
3313
1954
  key: "getSeekable",
3314
1955
  value: function getSeekable() {
3315
1956
  return this.get('seekable');
3316
1957
  }
3317
-
3318
1958
  /**
3319
1959
  * A promise to get the seeking property of the player.
3320
1960
  *
3321
1961
  * @promise GetSeekingPromise
3322
1962
  * @fulfill {boolean} Whether or not the player is currently seeking.
3323
1963
  */
1964
+
3324
1965
  /**
3325
1966
  * Get if the player is currently seeking.
3326
1967
  *
3327
1968
  * @return {GetSeekingPromise}
3328
1969
  */
1970
+
3329
1971
  }, {
3330
1972
  key: "getSeeking",
3331
1973
  value: function getSeeking() {
3332
1974
  return this.get('seeking');
3333
1975
  }
3334
-
3335
1976
  /**
3336
1977
  * A promise to get the text tracks of a video.
3337
1978
  *
3338
1979
  * @promise GetTextTracksPromise
3339
1980
  * @fulfill {VimeoTextTrack[]} The text tracks associated with the video.
3340
1981
  */
1982
+
3341
1983
  /**
3342
1984
  * Get an array of the text tracks that exist for the video.
3343
1985
  *
3344
1986
  * @return {GetTextTracksPromise}
3345
1987
  */
1988
+
3346
1989
  }, {
3347
1990
  key: "getTextTracks",
3348
1991
  value: function getTextTracks() {
3349
1992
  return this.get('textTracks');
3350
1993
  }
3351
-
3352
1994
  /**
3353
1995
  * A promise to get the embed code for the video.
3354
1996
  *
3355
1997
  * @promise GetVideoEmbedCodePromise
3356
1998
  * @fulfill {string} The `<iframe>` embed code for the video.
3357
1999
  */
2000
+
3358
2001
  /**
3359
2002
  * Get the `<iframe>` embed code for the video.
3360
2003
  *
3361
2004
  * @return {GetVideoEmbedCodePromise}
3362
2005
  */
2006
+
3363
2007
  }, {
3364
2008
  key: "getVideoEmbedCode",
3365
2009
  value: function getVideoEmbedCode() {
3366
2010
  return this.get('videoEmbedCode');
3367
2011
  }
3368
-
3369
2012
  /**
3370
2013
  * A promise to get the id of the video.
3371
2014
  *
3372
2015
  * @promise GetVideoIdPromise
3373
2016
  * @fulfill {number} The id of the video.
3374
2017
  */
2018
+
3375
2019
  /**
3376
2020
  * Get the id of the video.
3377
2021
  *
3378
2022
  * @return {GetVideoIdPromise}
3379
2023
  */
2024
+
3380
2025
  }, {
3381
2026
  key: "getVideoId",
3382
2027
  value: function getVideoId() {
3383
2028
  return this.get('videoId');
3384
2029
  }
3385
-
3386
2030
  /**
3387
2031
  * A promise to get the title of the video.
3388
2032
  *
3389
2033
  * @promise GetVideoTitlePromise
3390
2034
  * @fulfill {number} The title of the video.
3391
2035
  */
2036
+
3392
2037
  /**
3393
2038
  * Get the title of the video.
3394
2039
  *
3395
2040
  * @return {GetVideoTitlePromise}
3396
2041
  */
2042
+
3397
2043
  }, {
3398
2044
  key: "getVideoTitle",
3399
2045
  value: function getVideoTitle() {
3400
2046
  return this.get('videoTitle');
3401
2047
  }
3402
-
3403
2048
  /**
3404
2049
  * A promise to get the native width of the video.
3405
2050
  *
3406
2051
  * @promise GetVideoWidthPromise
3407
2052
  * @fulfill {number} The native width of the video.
3408
2053
  */
2054
+
3409
2055
  /**
3410
2056
  * Get the native width of the currently‐playing video. The width of
3411
2057
  * the highest‐resolution available will be used before playback begins.
3412
2058
  *
3413
2059
  * @return {GetVideoWidthPromise}
3414
2060
  */
2061
+
3415
2062
  }, {
3416
2063
  key: "getVideoWidth",
3417
2064
  value: function getVideoWidth() {
3418
2065
  return this.get('videoWidth');
3419
2066
  }
3420
-
3421
2067
  /**
3422
2068
  * A promise to get the native height of the video.
3423
2069
  *
3424
2070
  * @promise GetVideoHeightPromise
3425
2071
  * @fulfill {number} The native height of the video.
3426
2072
  */
2073
+
3427
2074
  /**
3428
2075
  * Get the native height of the currently‐playing video. The height of
3429
2076
  * the highest‐resolution available will be used before playback begins.
3430
2077
  *
3431
2078
  * @return {GetVideoHeightPromise}
3432
2079
  */
2080
+
3433
2081
  }, {
3434
2082
  key: "getVideoHeight",
3435
2083
  value: function getVideoHeight() {
3436
2084
  return this.get('videoHeight');
3437
2085
  }
3438
-
3439
2086
  /**
3440
2087
  * A promise to get the vimeo.com url for the video.
3441
2088
  *
@@ -3443,23 +2090,25 @@
3443
2090
  * @fulfill {number} The vimeo.com url for the video.
3444
2091
  * @reject {PrivacyError} The url isn’t available because of the video’s privacy setting.
3445
2092
  */
2093
+
3446
2094
  /**
3447
2095
  * Get the vimeo.com url for the video.
3448
2096
  *
3449
2097
  * @return {GetVideoUrlPromise}
3450
2098
  */
2099
+
3451
2100
  }, {
3452
2101
  key: "getVideoUrl",
3453
2102
  value: function getVideoUrl() {
3454
2103
  return this.get('videoUrl');
3455
2104
  }
3456
-
3457
2105
  /**
3458
2106
  * A promise to get the volume level of the player.
3459
2107
  *
3460
2108
  * @promise GetVolumePromise
3461
2109
  * @fulfill {number} The volume level of the player on a scale from 0 to 1.
3462
2110
  */
2111
+
3463
2112
  /**
3464
2113
  * Get the current volume level of the player on a scale from `0` to `1`.
3465
2114
  *
@@ -3468,12 +2117,12 @@
3468
2117
  *
3469
2118
  * @return {GetVolumePromise}
3470
2119
  */
2120
+
3471
2121
  }, {
3472
2122
  key: "getVolume",
3473
2123
  value: function getVolume() {
3474
2124
  return this.get('volume');
3475
2125
  }
3476
-
3477
2126
  /**
3478
2127
  * A promise to set the volume level of the player.
3479
2128
  *
@@ -3481,6 +2130,7 @@
3481
2130
  * @fulfill {number} The volume was set.
3482
2131
  * @reject {RangeError} The volume was less than 0 or greater than 1.
3483
2132
  */
2133
+
3484
2134
  /**
3485
2135
  * Set the volume of the player on a scale from `0` to `1`. When set
3486
2136
  * via the API, the volume level will not be synchronized to other
@@ -3492,71 +2142,23 @@
3492
2142
  * @param {number} volume
3493
2143
  * @return {SetVolumePromise}
3494
2144
  */
2145
+
3495
2146
  }, {
3496
2147
  key: "setVolume",
3497
2148
  value: function setVolume(volume) {
3498
2149
  return this.set('volume', volume);
3499
2150
  }
3500
-
3501
- /** @typedef {import('./lib/timing-object.types').TimingObject} TimingObject */
3502
- /** @typedef {import('./lib/timing-src-connector.types').TimingSrcConnectorOptions} TimingSrcConnectorOptions */
3503
- /** @typedef {import('./lib/timing-src-connector').TimingSrcConnector} TimingSrcConnector */
3504
-
3505
- /**
3506
- * Connects a TimingObject to the video player (https://webtiming.github.io/timingobject/)
3507
- *
3508
- * @param {TimingObject} timingObject
3509
- * @param {TimingSrcConnectorOptions} options
3510
- *
3511
- * @return {Promise<TimingSrcConnector>}
3512
- */
3513
- }, {
3514
- key: "setTimingSrc",
3515
- value: function () {
3516
- var _setTimingSrc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(timingObject, options) {
3517
- var _this6 = this;
3518
- var connector;
3519
- return _regeneratorRuntime().wrap(function _callee$(_context) {
3520
- while (1) switch (_context.prev = _context.next) {
3521
- case 0:
3522
- if (timingObject) {
3523
- _context.next = 2;
3524
- break;
3525
- }
3526
- throw new TypeError('A Timing Object must be provided.');
3527
- case 2:
3528
- _context.next = 4;
3529
- return this.ready();
3530
- case 4:
3531
- connector = new TimingSrcConnector(this, timingObject, options);
3532
- postMessage(this, 'notifyTimingObjectConnect');
3533
- connector.addEventListener('disconnect', function () {
3534
- return postMessage(_this6, 'notifyTimingObjectDisconnect');
3535
- });
3536
- return _context.abrupt("return", connector);
3537
- case 8:
3538
- case "end":
3539
- return _context.stop();
3540
- }
3541
- }, _callee, this);
3542
- }));
3543
- function setTimingSrc(_x, _x2) {
3544
- return _setTimingSrc.apply(this, arguments);
3545
- }
3546
- return setTimingSrc;
3547
- }()
3548
2151
  }]);
2152
+
3549
2153
  return Player;
3550
2154
  }(); // Setup embed only if this is not a node environment
3551
2155
 
2156
+
3552
2157
  if (!isNode) {
3553
- screenfull = initializeScreenfull();
3554
2158
  initializeEmbeds();
3555
2159
  resizeEmbeds();
3556
- initAppendVideoMetadata();
3557
- checkUrlTimeParam();
3558
2160
  }
3559
2161
 
3560
2162
  return Player;
3561
2163
 
3562
- })));
2164
+ }));