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