ravnur-player-public 3.4.3 → 3.4.4

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 (260) hide show
  1. package/.eslintignore +7 -0
  2. package/.eslintrc.js +206 -0
  3. package/.flowconfig +3 -0
  4. package/.vscode/extensions.json +7 -0
  5. package/.vscode/launch.json +37 -0
  6. package/.vscode/settings.json +4 -0
  7. package/README-Private.md +54 -0
  8. package/babel.config.js +28 -0
  9. package/bitbucket-pipelines.yml +61 -0
  10. package/cert.pem +23 -0
  11. package/demo/BaseM.mp4 +0 -0
  12. package/demo/HD.mp4 +0 -0
  13. package/demo/annotations.json +50 -0
  14. package/demo/annotations_ge.json +50 -0
  15. package/demo/base.mp3 +0 -0
  16. package/demo/cc_2125en.vtt +4958 -0
  17. package/demo/cc_en.vtt +171 -0
  18. package/demo/cc_ge.vtt +178 -0
  19. package/demo/chapters_en.vtt +38 -0
  20. package/demo/chapters_ge.vtt +5 -0
  21. package/demo/chapters_ge1.json +23 -0
  22. package/demo/hls/audio/stereo/en/128kbit.m3u8 +912 -0
  23. package/demo/hls/audio/stereo/none/128kbit.m3u8 +912 -0
  24. package/demo/hls/audio/surround/en/320kbit.m3u8 +912 -0
  25. package/demo/hls/playlist.m3u8 +31 -0
  26. package/demo/hls/video/10000kbit.m3u8 +894 -0
  27. package/demo/hls/video/1100kbit.m3u8 +894 -0
  28. package/demo/hls/video/1500kbit.m3u8 +894 -0
  29. package/demo/hls/video/250kbit.m3u8 +894 -0
  30. package/demo/hls/video/4000kbit.m3u8 +894 -0
  31. package/demo/hls/video/500kbit.m3u8 +894 -0
  32. package/demo/hls/video/6000kbit.m3u8 +894 -0
  33. package/demo/hls/video/800kbit.m3u8 +894 -0
  34. package/demo/hls.js +5 -0
  35. package/demo/hls.js.map +1 -0
  36. package/demo/hls.min.js +2 -0
  37. package/demo/hls.min.js.map +1 -0
  38. package/demo/playlist.m3u8 +31 -0
  39. package/demo/ravnur-flash-audio.swf +0 -0
  40. package/demo/ravnur-flash-video-hls.swf +0 -0
  41. package/demo/ravnur-flash-video.swf +0 -0
  42. package/demo/shaka/shaka-player.foo.debug.d.ts +4532 -0
  43. package/demo/shaka/shaka-player.foo.debug.externs.js +3886 -0
  44. package/demo/shaka/shaka-player.foo.debug.js +1746 -0
  45. package/demo/shaka/shaka-player.foo.debug.map +8 -0
  46. package/demo/shaka/wrapper.js +7 -0
  47. package/demo/test.html +458 -0
  48. package/dist/RavnurMediaPlayer.min.js +1 -1
  49. package/dist/cdn/RavnurMediaPlayer.min.js +1 -1
  50. package/jest.config.js +4 -0
  51. package/key.pem +27 -0
  52. package/lib/es5.js +344 -0
  53. package/lib/images/Spinner-small.gif +0 -0
  54. package/lib/images/close.png +0 -0
  55. package/lib/images/ic_check_box_black_24dp_1x.png +0 -0
  56. package/lib/images/ic_check_box_outline_blank_black_24dp_1x.png +0 -0
  57. package/lib/images/ic_chevron_left_white_24dp_1x.png +0 -0
  58. package/lib/images/ic_chevron_right_white_24dp_1x.png +0 -0
  59. package/lib/images/ic_closed_caption_white_24dp_1x.png +0 -0
  60. package/lib/images/ic_fast_forward_white_24dp_1x.png +0 -0
  61. package/lib/images/ic_fast_rewind_white_24dp_1x.png +0 -0
  62. package/lib/images/ic_fullscreen_exit_white_24dp_1x.png +0 -0
  63. package/lib/images/ic_fullscreen_white_24dp_1x.png +0 -0
  64. package/lib/images/ic_hd_white_24dp_1x.png +0 -0
  65. package/lib/images/ic_keyboard_arrow_left_black_24dp_1x.png +0 -0
  66. package/lib/images/ic_keyboard_arrow_right_black_24dp_1x.png +0 -0
  67. package/lib/images/ic_pause_white_24dp_1x.png +0 -0
  68. package/lib/images/ic_photo_white_24dp_1x.png +0 -0
  69. package/lib/images/ic_play_arrow_white_24dp_1x.png +0 -0
  70. package/lib/images/ic_refresh_white_24dp_1x.png +0 -0
  71. package/lib/images/ic_settings_white_24dp_1x.png +0 -0
  72. package/lib/images/ic_skip_next_white_24dp_1x.png +0 -0
  73. package/lib/images/ic_skip_previous_white_24dp_1x.png +0 -0
  74. package/lib/images/ic_toc_white_24dp_1x.png +0 -0
  75. package/lib/images/ic_volume_off_white_24dp_1x.png +0 -0
  76. package/lib/images/ic_volume_up_white_24dp_1x.png +0 -0
  77. package/lib/player4ie8.css +225 -0
  78. package/package.json +3 -7
  79. package/server.js +29 -0
  80. package/src/config/cc.js +56 -0
  81. package/src/config/i18n.js +101 -0
  82. package/src/config/options.js +123 -0
  83. package/src/config/playlist.js +9 -0
  84. package/src/config/source.js +23 -0
  85. package/src/config/statuses.js +8 -0
  86. package/src/config/styles.js +16 -0
  87. package/src/entity.js +27 -0
  88. package/src/events.js +5 -0
  89. package/src/extensions/annotations.js +142 -0
  90. package/src/extensions/audio-tarcks.js +115 -0
  91. package/src/extensions/backward.js +45 -0
  92. package/src/extensions/base.js +73 -0
  93. package/src/extensions/bottom-next.js +50 -0
  94. package/src/extensions/bottom-prev.js +50 -0
  95. package/src/extensions/buffering.js +78 -0
  96. package/src/extensions/c2pa.js +350 -0
  97. package/src/extensions/caption-search.js +230 -0
  98. package/src/extensions/cc.js +874 -0
  99. package/src/extensions/crawl.js +118 -0
  100. package/src/extensions/download.js +411 -0
  101. package/src/extensions/error.js +47 -0
  102. package/src/extensions/forward.js +44 -0
  103. package/src/extensions/fullscreen.js +84 -0
  104. package/src/extensions/help.js +201 -0
  105. package/src/extensions/helpers/FileSaver.js +157 -0
  106. package/src/extensions/helpers/clickOpener.js +180 -0
  107. package/src/extensions/helpers/opener.js +30 -0
  108. package/src/extensions/helpers/openerHeightChecker.js +13 -0
  109. package/src/extensions/helpers/popover.js +33 -0
  110. package/src/extensions/helpers/popoverPosition.js +30 -0
  111. package/src/extensions/helpers/scrollIntoView.js +9 -0
  112. package/src/extensions/helpers/storage.js +20 -0
  113. package/src/extensions/helpers/textContent.js +6 -0
  114. package/src/extensions/helpers/timeCodeToSeconds.js +44 -0
  115. package/src/extensions/helpers/transport.js +43 -0
  116. package/src/extensions/helpers/vtt-loader.js +42 -0
  117. package/src/extensions/index.js +87 -0
  118. package/src/extensions/live.js +76 -0
  119. package/src/extensions/mux.js +57 -0
  120. package/src/extensions/next-frame.js +44 -0
  121. package/src/extensions/next.js +48 -0
  122. package/src/extensions/placeholder.js +241 -0
  123. package/src/extensions/play.js +102 -0
  124. package/src/extensions/poster.js +47 -0
  125. package/src/extensions/prev-frame.js +44 -0
  126. package/src/extensions/prev.js +48 -0
  127. package/src/extensions/progress.js +465 -0
  128. package/src/extensions/resizer.js +37 -0
  129. package/src/extensions/settings.js +367 -0
  130. package/src/extensions/theater.js +56 -0
  131. package/src/extensions/title.js +38 -0
  132. package/src/extensions/toc.js +334 -0
  133. package/src/extensions/volume.js +196 -0
  134. package/src/flash/FlashPlugin.js +301 -0
  135. package/src/flash/MediaElement.js +361 -0
  136. package/src/flash/plugins.js +32 -0
  137. package/src/flash-detector.js +66 -0
  138. package/src/helpers/$t.js +10 -0
  139. package/src/helpers/binder.js +11 -0
  140. package/src/helpers/isAndroid.js +5 -0
  141. package/src/helpers/isBlackBerry.js +5 -0
  142. package/src/helpers/isCanvasSupported.js +6 -0
  143. package/src/helpers/isIE.js +21 -0
  144. package/src/helpers/isMobile.js +10 -0
  145. package/src/helpers/isWindows.js +5 -0
  146. package/src/helpers/isWindowsPhone.js +5 -0
  147. package/src/helpers/isiOS.js +5 -0
  148. package/src/html5media.js +19 -0
  149. package/src/index.js +2 -0
  150. package/src/logger.js +31 -0
  151. package/src/microevent.js +65 -0
  152. package/src/normalize-options.js +139 -0
  153. package/src/player.js +864 -0
  154. package/src/players/base.js +209 -0
  155. package/src/players/flash.js +172 -0
  156. package/src/players/hls.js +278 -0
  157. package/src/players/html.js +205 -0
  158. package/src/players/index.js +59 -0
  159. package/src/players/shaka.js +219 -0
  160. package/src/playlist.js +362 -0
  161. package/src/screenfull.js +121 -0
  162. package/src/state.js +474 -0
  163. package/src/static/es5.js +344 -0
  164. package/src/static/images/Spinner-small.gif +0 -0
  165. package/src/static/images/close.png +0 -0
  166. package/src/static/images/ic_check_box_black_24dp_1x.png +0 -0
  167. package/src/static/images/ic_check_box_outline_blank_black_24dp_1x.png +0 -0
  168. package/src/static/images/ic_chevron_left_white_24dp_1x.png +0 -0
  169. package/src/static/images/ic_chevron_right_white_24dp_1x.png +0 -0
  170. package/src/static/images/ic_closed_caption_white_24dp_1x.png +0 -0
  171. package/src/static/images/ic_fast_forward_white_24dp_1x.png +0 -0
  172. package/src/static/images/ic_fast_rewind_white_24dp_1x.png +0 -0
  173. package/src/static/images/ic_fullscreen_exit_white_24dp_1x.png +0 -0
  174. package/src/static/images/ic_fullscreen_white_24dp_1x.png +0 -0
  175. package/src/static/images/ic_hd_white_24dp_1x.png +0 -0
  176. package/src/static/images/ic_keyboard_arrow_left_black_24dp_1x.png +0 -0
  177. package/src/static/images/ic_keyboard_arrow_right_black_24dp_1x.png +0 -0
  178. package/src/static/images/ic_pause_white_24dp_1x.png +0 -0
  179. package/src/static/images/ic_play_arrow_white_24dp_1x.png +0 -0
  180. package/src/static/images/ic_refresh_white_24dp_1x.png +0 -0
  181. package/src/static/images/ic_settings_white_24dp_1x.png +0 -0
  182. package/src/static/images/ic_skip_next_white_24dp_1x.png +0 -0
  183. package/src/static/images/ic_skip_previous_white_24dp_1x.png +0 -0
  184. package/src/static/images/ic_toc_white_24dp_1x.png +0 -0
  185. package/src/static/images/ic_volume_off_white_24dp_1x.png +0 -0
  186. package/src/static/images/ic_volume_up_white_24dp_1x.png +0 -0
  187. package/src/static/player4ie8.css +225 -0
  188. package/src/styles/bplaylist.css.js +124 -0
  189. package/src/styles/index.js +1966 -0
  190. package/src/styles/playlist.css.js +84 -0
  191. package/src/styles/rplaylist.css.js +98 -0
  192. package/src/svgs.js +111 -0
  193. package/src/types/Logger.js +10 -0
  194. package/src/types/Options.js +179 -0
  195. package/src/types/Playlist.js +3 -0
  196. package/src/types/Source.js +28 -0
  197. package/src/types/State.js +46 -0
  198. package/src/types/Styles.js +11 -0
  199. package/src/types/TimeData.js +8 -0
  200. package/src/types/Translation.js +69 -0
  201. package/src/utils/absolutizeUrl.js +9 -0
  202. package/src/utils/addClass.js +9 -0
  203. package/src/utils/addEvent.js +31 -0
  204. package/src/utils/addProperty.js +65 -0
  205. package/src/utils/appendChild.js +14 -0
  206. package/src/utils/buff2hex.js +5 -0
  207. package/src/utils/contains.js +33 -0
  208. package/src/utils/createElement.js +24 -0
  209. package/src/utils/each.js +34 -0
  210. package/src/utils/escapeHTML.js +8 -0
  211. package/src/utils/existy.js +4 -0
  212. package/src/utils/extend.js +17 -0
  213. package/src/utils/filter.js +16 -0
  214. package/src/utils/find.js +11 -0
  215. package/src/utils/findIndex.js +20 -0
  216. package/src/utils/first.js +5 -0
  217. package/src/utils/get.js +19 -0
  218. package/src/utils/has.js +5 -0
  219. package/src/utils/hasClass.js +6 -0
  220. package/src/utils/head.js +11 -0
  221. package/src/utils/inRange.js +16 -0
  222. package/src/utils/index.js +73 -0
  223. package/src/utils/isArray.js +4 -0
  224. package/src/utils/isBoolean.js +3 -0
  225. package/src/utils/isElement.js +7 -0
  226. package/src/utils/isEmpty.js +6 -0
  227. package/src/utils/isEqual.js +33 -0
  228. package/src/utils/isEqualBuffer.js +13 -0
  229. package/src/utils/isFunction.js +3 -0
  230. package/src/utils/isNotEmpty.js +5 -0
  231. package/src/utils/isObject.js +5 -0
  232. package/src/utils/isString.js +9 -0
  233. package/src/utils/last.js +4 -0
  234. package/src/utils/map.js +11 -0
  235. package/src/utils/negate.js +8 -0
  236. package/src/utils/noop.js +1 -0
  237. package/src/utils/notExisty.js +5 -0
  238. package/src/utils/reduce.js +8 -0
  239. package/src/utils/remove.js +7 -0
  240. package/src/utils/removeClass.js +8 -0
  241. package/src/utils/removeEvent.js +7 -0
  242. package/src/utils/toArray.js +7 -0
  243. package/src/utils/toggleClass.js +16 -0
  244. package/src/utils/uidGenerator.js +8 -0
  245. package/src/utils/upperFirst.js +4 -0
  246. package/tests/extensions/__snapshots__/download.spec.js.snap +226 -0
  247. package/tests/extensions/__snapshots__/fullscreen.spec.js.snap +30 -0
  248. package/tests/extensions/__snapshots__/title.spec.js.snap +16 -0
  249. package/tests/extensions/download.spec.js +111 -0
  250. package/tests/extensions/fullscreen.spec.js +56 -0
  251. package/tests/extensions/title.spec.js +35 -0
  252. package/tests/mocks/assets/BaseM.mp4 +0 -0
  253. package/tests/mocks/assets/hls.min.js +5 -0
  254. package/tests/mocks/assets/styleMock.js +1 -0
  255. package/tests/mocks/base-player-options.js +47 -0
  256. package/tests/mocks/sources.js +58 -0
  257. package/tests/mocks/timedata/cc_en.vtt +171 -0
  258. package/tests/mocks/timedata/cc_ge.vtt +178 -0
  259. package/tests/utils/wait.js +1 -0
  260. package/webpack.config.js +78 -0
@@ -0,0 +1,8 @@
1
+ /* eslint no-magic-numbers: 0, eqeqeq: 0, no-bitwise: 0, no-extra-parens: 0 */
2
+
3
+ export default function uidGenerator() {
4
+ return 'rav_id_xxxxxxxxxxxx'.replace(/[xy]/g, function _repl(c) {
5
+ var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
6
+ return v.toString(16);
7
+ });
8
+ }
@@ -0,0 +1,4 @@
1
+ export default function upperFirst(str) {
2
+ // eslint-disable-next-line no-magic-numbers
3
+ return str.substring(0, 1).toUpperCase() + str.substring(1);
4
+ }
@@ -0,0 +1,226 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Download extension Download button should be rendered correctly 1`] = `
4
+ <span
5
+ class="rmp-ext-settings"
6
+ data-testid="download"
7
+ >
8
+ <span
9
+ class="rmp-ext-popover"
10
+ tabindex="0"
11
+ />
12
+ <button
13
+ aria-label="Download"
14
+ class="rmp-ext-settings__button"
15
+ type="button"
16
+ >
17
+ <svg
18
+ height="32"
19
+ viewBox="0 0 24 24"
20
+ width="32"
21
+ >
22
+ <path
23
+ d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"
24
+ />
25
+ </svg>
26
+ </button>
27
+ <div
28
+ class="rmp-ext-settings__selector"
29
+ >
30
+ <a
31
+ style="display: none;"
32
+ />
33
+ <div
34
+ class="rmp-ext-settings__main-step"
35
+ >
36
+ <button
37
+ class="rmp-ext-settings__download-cc rmp-ext-settings__more"
38
+ type="button"
39
+ >
40
+ <span>
41
+ Closed Captions
42
+ </span>
43
+ <span
44
+ class="arrow"
45
+ >
46
+ <svg
47
+ height="32"
48
+ viewBox="0 0 24 24"
49
+ width="32"
50
+ >
51
+ <path
52
+ d="M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"
53
+ />
54
+ </svg>
55
+ </span>
56
+ </button>
57
+ <button
58
+ class="rmp-ext-settings__download-cc rmp-ext-settings__more"
59
+ type="button"
60
+ >
61
+ <span>
62
+ Transcript
63
+ </span>
64
+ <span
65
+ class="arrow"
66
+ >
67
+ <svg
68
+ height="32"
69
+ viewBox="0 0 24 24"
70
+ width="32"
71
+ >
72
+ <path
73
+ d="M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"
74
+ />
75
+ </svg>
76
+ </span>
77
+ </button>
78
+ <button
79
+ class="rmp-ext-settings__download-cc"
80
+ type="button"
81
+ >
82
+ <span>
83
+ Video
84
+ </span>
85
+ </button>
86
+ </div>
87
+ <div
88
+ class="rmp-ext-settings__additional-step"
89
+ >
90
+ <button
91
+ class="rmp-ext-settings__back"
92
+ type="button"
93
+ >
94
+ <span
95
+ class="arrow"
96
+ >
97
+ <svg
98
+ height="32"
99
+ viewBox="0 0 24 24"
100
+ width="32"
101
+ >
102
+ <path
103
+ d="M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"
104
+ />
105
+ </svg>
106
+ </span>
107
+ <span />
108
+ </button>
109
+ <div
110
+ class="tab-content"
111
+ />
112
+ </div>
113
+ </div>
114
+ </span>
115
+ `;
116
+
117
+ exports[`Download extension Should render next step 1`] = `
118
+ <div
119
+ class="rmp-ext-settings__selector"
120
+ >
121
+ <a
122
+ style="display: none;"
123
+ />
124
+ <div
125
+ class="rmp-ext-settings__main-step"
126
+ style="max-height: -100px;"
127
+ >
128
+ <button
129
+ class="rmp-ext-settings__download-cc rmp-ext-settings__more"
130
+ type="button"
131
+ >
132
+ <span>
133
+ Closed Captions
134
+ </span>
135
+ <span
136
+ class="arrow"
137
+ >
138
+ <svg
139
+ height="32"
140
+ viewBox="0 0 24 24"
141
+ width="32"
142
+ >
143
+ <path
144
+ d="M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"
145
+ />
146
+ </svg>
147
+ </span>
148
+ </button>
149
+ <button
150
+ class="rmp-ext-settings__download-cc rmp-ext-settings__more"
151
+ type="button"
152
+ >
153
+ <span>
154
+ Transcript
155
+ </span>
156
+ <span
157
+ class="arrow"
158
+ >
159
+ <svg
160
+ height="32"
161
+ viewBox="0 0 24 24"
162
+ width="32"
163
+ >
164
+ <path
165
+ d="M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"
166
+ />
167
+ </svg>
168
+ </span>
169
+ </button>
170
+ <button
171
+ class="rmp-ext-settings__download-cc"
172
+ type="button"
173
+ >
174
+ <span>
175
+ Video
176
+ </span>
177
+ </button>
178
+ </div>
179
+ <div
180
+ class="rmp-ext-settings__additional-step"
181
+ style="max-height: -100px;"
182
+ >
183
+ <button
184
+ class="rmp-ext-settings__back"
185
+ type="button"
186
+ >
187
+ <span
188
+ class="arrow"
189
+ >
190
+ <svg
191
+ height="32"
192
+ viewBox="0 0 24 24"
193
+ width="32"
194
+ >
195
+ <path
196
+ d="M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"
197
+ />
198
+ </svg>
199
+ </span>
200
+ <span>
201
+ Closed Captions
202
+ </span>
203
+ </button>
204
+ <div
205
+ class="tab-content"
206
+ >
207
+ <button
208
+ class="rmp-ext-settings__download-cc"
209
+ type="button"
210
+ >
211
+ <span>
212
+ English
213
+ </span>
214
+ </button>
215
+ <button
216
+ class="rmp-ext-settings__download-cc"
217
+ type="button"
218
+ >
219
+ <span>
220
+ German
221
+ </span>
222
+ </button>
223
+ </div>
224
+ </div>
225
+ </div>
226
+ `;
@@ -0,0 +1,30 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Full screen extension Should render fullscreen button 1`] = `
4
+ <button
5
+ class="rmp-ext-fullscreen"
6
+ data-testid="fullscreen"
7
+ type="button"
8
+ >
9
+ <svg
10
+ class="fullscreen-icon"
11
+ height="32"
12
+ viewBox="0 0 24 24"
13
+ width="32"
14
+ >
15
+ <path
16
+ d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"
17
+ />
18
+ </svg>
19
+ <svg
20
+ class="exit-fullscreen-icon"
21
+ height="32"
22
+ viewBox="0 0 24 24"
23
+ width="32"
24
+ >
25
+ <path
26
+ d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"
27
+ />
28
+ </svg>
29
+ </button>
30
+ `;
@@ -0,0 +1,16 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Title extension Should render fullscreen button 1`] = `
4
+ <div
5
+ class="rmp-ext-title"
6
+ data-testid="title"
7
+ >
8
+ <span
9
+ class="rmp-ext-title__title"
10
+ tabindex="0"
11
+ title="Test title"
12
+ >
13
+ Test title
14
+ </span>
15
+ </div>
16
+ `;
@@ -0,0 +1,111 @@
1
+ import Player from '../../src/player';
2
+ import sources from '../mocks/sources';
3
+ import { wait } from '../utils/wait';
4
+ import { BASE_OPTIONS } from '../mocks/base-player-options';
5
+
6
+ let container;
7
+ let player;
8
+
9
+ // jest.mock('@ravnur-inc/c2pa', () => ({
10
+ // C2PA: jest.fn(),
11
+ // ValidationResult: jest.fn(),
12
+ // C2PAValidationError: jest.fn()
13
+ // }));
14
+
15
+ const SELECTOR = '[data-testid="download"]';
16
+
17
+ describe('Download extension', () => {
18
+ const renderPlayer = (src, options = {}) => {
19
+ container = document.createElement('div');
20
+ container.removeAttribute('style');
21
+
22
+ player = new Player(container, {});
23
+ player.setup(src, {
24
+ ...BASE_OPTIONS,
25
+ ...options
26
+ });
27
+ };
28
+
29
+ it('Download button should be rendered correctly', () => {
30
+ renderPlayer(sources[1], {
31
+ showDownload: true,
32
+ showDownloadCC: true,
33
+ downloadVideoURL: '/dummy-video.mp4'
34
+ });
35
+
36
+ const wrapper = container.querySelector(SELECTOR);
37
+ expect(wrapper).toBeInstanceOf(HTMLSpanElement);
38
+ expect(wrapper).toMatchSnapshot();
39
+ });
40
+
41
+ it('Shuould not render download button if disabled', () => {
42
+ renderPlayer(sources[1], {
43
+ showDownload: false,
44
+ showDownloadCC: true,
45
+ downloadVideoURL: '/dummy-video.mp4'
46
+ });
47
+
48
+ const wrapper = container.querySelector(SELECTOR);
49
+ expect(wrapper).toBeNull();
50
+ });
51
+
52
+ it('Should not render download button if no values', () => {
53
+ renderPlayer(sources[0], {
54
+ downloadVideoURL: '',
55
+ showDownload: true,
56
+ showDownloadCC: true
57
+ });
58
+
59
+ const wrapper = container.querySelector(SELECTOR);
60
+ expect(wrapper).toBeNull();
61
+ });
62
+
63
+ it('Should check that button works', async () => {
64
+ renderPlayer(sources[1], {
65
+ showDownload: true,
66
+ downloadVideoURL: '/dummy-video.mp4'
67
+ });
68
+
69
+ const wrapper = container.querySelector(SELECTOR);
70
+ const button = wrapper.querySelector('[class*="__button"]');
71
+ const menu = wrapper.querySelector('[class*="__selector"]');
72
+
73
+ expect(menu).toBeTruthy();
74
+
75
+ button.click();
76
+ let openedMenu = container.querySelector('[class*="__selector--open"]');
77
+ expect(openedMenu).toBeTruthy();
78
+
79
+ wrapper.click();
80
+
81
+ await wait();
82
+
83
+ openedMenu = container.querySelector('[class*="__selector--open"]');
84
+ expect(openedMenu).toBeNull();
85
+ });
86
+
87
+ it('Should render next step', async () => {
88
+ renderPlayer(sources[1], {
89
+ showDownload: true,
90
+ showDownloadCC: true
91
+ });
92
+
93
+ const wrapper = container.querySelector(SELECTOR);
94
+ const button = wrapper.querySelector('[class*="__button"]');
95
+
96
+ button.click();
97
+
98
+ const openedMenu = container.querySelector('[class*="__selector--open"]');
99
+ const menuItem = openedMenu.querySelectorAll('[class*="__more"]');
100
+
101
+ menuItem[0].click();
102
+
103
+ await wait();
104
+
105
+ const tabContent = openedMenu.querySelector('.tab-content');
106
+ const languages = tabContent.querySelectorAll('span');
107
+ expect(languages.length).toBe(2);
108
+
109
+ expect(openedMenu).toMatchSnapshot();
110
+ });
111
+ });
@@ -0,0 +1,56 @@
1
+ import Player from '../../src/player';
2
+ import sources from '../mocks/sources';
3
+ import { BASE_OPTIONS } from '../mocks/base-player-options';
4
+
5
+ let container;
6
+ let player;
7
+
8
+ // jest.mock('@ravnur-inc/c2pa', () => ({
9
+ // C2PA: jest.fn(),
10
+ // ValidationResult: jest.fn(),
11
+ // C2PAValidationError: jest.fn()
12
+ // }));
13
+
14
+ const SELECTOR = '[data-testid="fullscreen"]';
15
+
16
+ describe('Full screen extension', () => {
17
+ const renderPlayer = (options = {}) => {
18
+ container = document.createElement('div');
19
+ container.removeAttribute('style');
20
+
21
+ player = new Player(container, {});
22
+ player.setup(sources[0], {
23
+ ...BASE_OPTIONS,
24
+ ...options
25
+ });
26
+ };
27
+
28
+ it('Should render fullscreen button', () => {
29
+ renderPlayer();
30
+
31
+ const button = container.querySelector(SELECTOR);
32
+ expect(button).toBeInstanceOf(HTMLButtonElement);
33
+ expect(button).toMatchSnapshot();
34
+ });
35
+
36
+ it('Shuould not render fullscreen button', () => {
37
+ renderPlayer({
38
+ showFullScreen: false
39
+ });
40
+
41
+ const button = container.querySelector(SELECTOR);
42
+ expect(button).toBeNull();
43
+ });
44
+
45
+ it('Should check that fullscreen button works', () => {
46
+ renderPlayer();
47
+
48
+ const button = container.querySelector(SELECTOR);
49
+
50
+ button.click();
51
+ expect(container.classList.contains('rplayer--fullscreen')).toBe(true);
52
+
53
+ button.click();
54
+ expect(container.classList.contains('rplayer--fullscreen')).toBe(false);
55
+ });
56
+ });
@@ -0,0 +1,35 @@
1
+ import Player from '../../src/player';
2
+ import { BASE_OPTIONS } from '../mocks/base-player-options';
3
+ import sources from '../mocks/sources';
4
+
5
+ let container;
6
+ let player;
7
+
8
+ // jest.mock('@ravnur-inc/c2pa', () => ({
9
+ // C2PA: jest.fn(),
10
+ // ValidationResult: jest.fn(),
11
+ // C2PAValidationError: jest.fn()
12
+ // }));
13
+
14
+ const SELECTOR = '[data-testid="title"]';
15
+
16
+ describe('Title extension', () => {
17
+ const renderPlayer = (options = {}) => {
18
+ container = document.createElement('div');
19
+ container.removeAttribute('style');
20
+
21
+ player = new Player(container, {});
22
+ player.setup(sources[0], {
23
+ ...BASE_OPTIONS,
24
+ ...options
25
+ });
26
+ };
27
+
28
+ it('Should render fullscreen button', () => {
29
+ renderPlayer();
30
+
31
+ const button = container.querySelector(SELECTOR);
32
+ expect(button).toBeInstanceOf(HTMLDivElement);
33
+ expect(button).toMatchSnapshot();
34
+ });
35
+ });
Binary file