ravnur-player-public 3.4.4 → 3.4.6

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/dist/RavnurMediaPlayer.min.js +1 -1
  2. package/dist/cdn/RavnurMediaPlayer.min.js +1 -1
  3. package/package.json +72 -68
  4. package/.eslintignore +0 -7
  5. package/.eslintrc.js +0 -206
  6. package/.flowconfig +0 -3
  7. package/.vscode/extensions.json +0 -7
  8. package/.vscode/launch.json +0 -37
  9. package/.vscode/settings.json +0 -4
  10. package/README-Private.md +0 -54
  11. package/babel.config.js +0 -28
  12. package/bitbucket-pipelines.yml +0 -61
  13. package/cert.pem +0 -23
  14. package/demo/BaseM.mp4 +0 -0
  15. package/demo/HD.mp4 +0 -0
  16. package/demo/annotations.json +0 -50
  17. package/demo/annotations_ge.json +0 -50
  18. package/demo/base.mp3 +0 -0
  19. package/demo/cc_2125en.vtt +0 -4958
  20. package/demo/cc_en.vtt +0 -171
  21. package/demo/cc_ge.vtt +0 -178
  22. package/demo/chapters_en.vtt +0 -38
  23. package/demo/chapters_ge.vtt +0 -5
  24. package/demo/chapters_ge1.json +0 -23
  25. package/demo/hls/audio/stereo/en/128kbit.m3u8 +0 -912
  26. package/demo/hls/audio/stereo/none/128kbit.m3u8 +0 -912
  27. package/demo/hls/audio/surround/en/320kbit.m3u8 +0 -912
  28. package/demo/hls/playlist.m3u8 +0 -31
  29. package/demo/hls/video/10000kbit.m3u8 +0 -894
  30. package/demo/hls/video/1100kbit.m3u8 +0 -894
  31. package/demo/hls/video/1500kbit.m3u8 +0 -894
  32. package/demo/hls/video/250kbit.m3u8 +0 -894
  33. package/demo/hls/video/4000kbit.m3u8 +0 -894
  34. package/demo/hls/video/500kbit.m3u8 +0 -894
  35. package/demo/hls/video/6000kbit.m3u8 +0 -894
  36. package/demo/hls/video/800kbit.m3u8 +0 -894
  37. package/demo/hls.js +0 -5
  38. package/demo/hls.js.map +0 -1
  39. package/demo/hls.min.js +0 -2
  40. package/demo/hls.min.js.map +0 -1
  41. package/demo/playlist.m3u8 +0 -31
  42. package/demo/ravnur-flash-audio.swf +0 -0
  43. package/demo/ravnur-flash-video-hls.swf +0 -0
  44. package/demo/ravnur-flash-video.swf +0 -0
  45. package/demo/shaka/shaka-player.foo.debug.d.ts +0 -4532
  46. package/demo/shaka/shaka-player.foo.debug.externs.js +0 -3886
  47. package/demo/shaka/shaka-player.foo.debug.js +0 -1746
  48. package/demo/shaka/shaka-player.foo.debug.map +0 -8
  49. package/demo/shaka/wrapper.js +0 -7
  50. package/demo/test.html +0 -458
  51. package/jest.config.js +0 -4
  52. package/key.pem +0 -27
  53. package/lib/es5.js +0 -344
  54. package/lib/images/Spinner-small.gif +0 -0
  55. package/lib/images/close.png +0 -0
  56. package/lib/images/ic_check_box_black_24dp_1x.png +0 -0
  57. package/lib/images/ic_check_box_outline_blank_black_24dp_1x.png +0 -0
  58. package/lib/images/ic_chevron_left_white_24dp_1x.png +0 -0
  59. package/lib/images/ic_chevron_right_white_24dp_1x.png +0 -0
  60. package/lib/images/ic_closed_caption_white_24dp_1x.png +0 -0
  61. package/lib/images/ic_fast_forward_white_24dp_1x.png +0 -0
  62. package/lib/images/ic_fast_rewind_white_24dp_1x.png +0 -0
  63. package/lib/images/ic_fullscreen_exit_white_24dp_1x.png +0 -0
  64. package/lib/images/ic_fullscreen_white_24dp_1x.png +0 -0
  65. package/lib/images/ic_hd_white_24dp_1x.png +0 -0
  66. package/lib/images/ic_keyboard_arrow_left_black_24dp_1x.png +0 -0
  67. package/lib/images/ic_keyboard_arrow_right_black_24dp_1x.png +0 -0
  68. package/lib/images/ic_pause_white_24dp_1x.png +0 -0
  69. package/lib/images/ic_photo_white_24dp_1x.png +0 -0
  70. package/lib/images/ic_play_arrow_white_24dp_1x.png +0 -0
  71. package/lib/images/ic_refresh_white_24dp_1x.png +0 -0
  72. package/lib/images/ic_settings_white_24dp_1x.png +0 -0
  73. package/lib/images/ic_skip_next_white_24dp_1x.png +0 -0
  74. package/lib/images/ic_skip_previous_white_24dp_1x.png +0 -0
  75. package/lib/images/ic_toc_white_24dp_1x.png +0 -0
  76. package/lib/images/ic_volume_off_white_24dp_1x.png +0 -0
  77. package/lib/images/ic_volume_up_white_24dp_1x.png +0 -0
  78. package/lib/player4ie8.css +0 -225
  79. package/server.js +0 -29
  80. package/src/config/cc.js +0 -56
  81. package/src/config/i18n.js +0 -101
  82. package/src/config/options.js +0 -123
  83. package/src/config/playlist.js +0 -9
  84. package/src/config/source.js +0 -23
  85. package/src/config/statuses.js +0 -8
  86. package/src/config/styles.js +0 -16
  87. package/src/entity.js +0 -27
  88. package/src/events.js +0 -5
  89. package/src/extensions/annotations.js +0 -142
  90. package/src/extensions/audio-tarcks.js +0 -115
  91. package/src/extensions/backward.js +0 -45
  92. package/src/extensions/base.js +0 -73
  93. package/src/extensions/bottom-next.js +0 -50
  94. package/src/extensions/bottom-prev.js +0 -50
  95. package/src/extensions/buffering.js +0 -78
  96. package/src/extensions/c2pa.js +0 -350
  97. package/src/extensions/caption-search.js +0 -230
  98. package/src/extensions/cc.js +0 -874
  99. package/src/extensions/crawl.js +0 -118
  100. package/src/extensions/download.js +0 -411
  101. package/src/extensions/error.js +0 -47
  102. package/src/extensions/forward.js +0 -44
  103. package/src/extensions/fullscreen.js +0 -84
  104. package/src/extensions/help.js +0 -201
  105. package/src/extensions/helpers/FileSaver.js +0 -157
  106. package/src/extensions/helpers/clickOpener.js +0 -180
  107. package/src/extensions/helpers/opener.js +0 -30
  108. package/src/extensions/helpers/openerHeightChecker.js +0 -13
  109. package/src/extensions/helpers/popover.js +0 -33
  110. package/src/extensions/helpers/popoverPosition.js +0 -30
  111. package/src/extensions/helpers/scrollIntoView.js +0 -9
  112. package/src/extensions/helpers/storage.js +0 -20
  113. package/src/extensions/helpers/textContent.js +0 -6
  114. package/src/extensions/helpers/timeCodeToSeconds.js +0 -44
  115. package/src/extensions/helpers/transport.js +0 -43
  116. package/src/extensions/helpers/vtt-loader.js +0 -42
  117. package/src/extensions/index.js +0 -87
  118. package/src/extensions/live.js +0 -76
  119. package/src/extensions/mux.js +0 -57
  120. package/src/extensions/next-frame.js +0 -44
  121. package/src/extensions/next.js +0 -48
  122. package/src/extensions/placeholder.js +0 -241
  123. package/src/extensions/play.js +0 -102
  124. package/src/extensions/poster.js +0 -47
  125. package/src/extensions/prev-frame.js +0 -44
  126. package/src/extensions/prev.js +0 -48
  127. package/src/extensions/progress.js +0 -465
  128. package/src/extensions/resizer.js +0 -37
  129. package/src/extensions/settings.js +0 -367
  130. package/src/extensions/theater.js +0 -56
  131. package/src/extensions/title.js +0 -38
  132. package/src/extensions/toc.js +0 -334
  133. package/src/extensions/volume.js +0 -196
  134. package/src/flash/FlashPlugin.js +0 -301
  135. package/src/flash/MediaElement.js +0 -361
  136. package/src/flash/plugins.js +0 -32
  137. package/src/flash-detector.js +0 -66
  138. package/src/helpers/$t.js +0 -10
  139. package/src/helpers/binder.js +0 -11
  140. package/src/helpers/isAndroid.js +0 -5
  141. package/src/helpers/isBlackBerry.js +0 -5
  142. package/src/helpers/isCanvasSupported.js +0 -6
  143. package/src/helpers/isIE.js +0 -21
  144. package/src/helpers/isMobile.js +0 -10
  145. package/src/helpers/isWindows.js +0 -5
  146. package/src/helpers/isWindowsPhone.js +0 -5
  147. package/src/helpers/isiOS.js +0 -5
  148. package/src/html5media.js +0 -19
  149. package/src/index.js +0 -2
  150. package/src/logger.js +0 -31
  151. package/src/microevent.js +0 -65
  152. package/src/normalize-options.js +0 -139
  153. package/src/player.js +0 -864
  154. package/src/players/base.js +0 -209
  155. package/src/players/flash.js +0 -172
  156. package/src/players/hls.js +0 -278
  157. package/src/players/html.js +0 -205
  158. package/src/players/index.js +0 -59
  159. package/src/players/shaka.js +0 -219
  160. package/src/playlist.js +0 -362
  161. package/src/screenfull.js +0 -121
  162. package/src/state.js +0 -474
  163. package/src/static/es5.js +0 -344
  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 +0 -225
  188. package/src/styles/bplaylist.css.js +0 -124
  189. package/src/styles/index.js +0 -1966
  190. package/src/styles/playlist.css.js +0 -84
  191. package/src/styles/rplaylist.css.js +0 -98
  192. package/src/svgs.js +0 -111
  193. package/src/types/Logger.js +0 -10
  194. package/src/types/Options.js +0 -179
  195. package/src/types/Playlist.js +0 -3
  196. package/src/types/Source.js +0 -28
  197. package/src/types/State.js +0 -46
  198. package/src/types/Styles.js +0 -11
  199. package/src/types/TimeData.js +0 -8
  200. package/src/types/Translation.js +0 -69
  201. package/src/utils/absolutizeUrl.js +0 -9
  202. package/src/utils/addClass.js +0 -9
  203. package/src/utils/addEvent.js +0 -31
  204. package/src/utils/addProperty.js +0 -65
  205. package/src/utils/appendChild.js +0 -14
  206. package/src/utils/buff2hex.js +0 -5
  207. package/src/utils/contains.js +0 -33
  208. package/src/utils/createElement.js +0 -24
  209. package/src/utils/each.js +0 -34
  210. package/src/utils/escapeHTML.js +0 -8
  211. package/src/utils/existy.js +0 -4
  212. package/src/utils/extend.js +0 -17
  213. package/src/utils/filter.js +0 -16
  214. package/src/utils/find.js +0 -11
  215. package/src/utils/findIndex.js +0 -20
  216. package/src/utils/first.js +0 -5
  217. package/src/utils/get.js +0 -19
  218. package/src/utils/has.js +0 -5
  219. package/src/utils/hasClass.js +0 -6
  220. package/src/utils/head.js +0 -11
  221. package/src/utils/inRange.js +0 -16
  222. package/src/utils/index.js +0 -73
  223. package/src/utils/isArray.js +0 -4
  224. package/src/utils/isBoolean.js +0 -3
  225. package/src/utils/isElement.js +0 -7
  226. package/src/utils/isEmpty.js +0 -6
  227. package/src/utils/isEqual.js +0 -33
  228. package/src/utils/isEqualBuffer.js +0 -13
  229. package/src/utils/isFunction.js +0 -3
  230. package/src/utils/isNotEmpty.js +0 -5
  231. package/src/utils/isObject.js +0 -5
  232. package/src/utils/isString.js +0 -9
  233. package/src/utils/last.js +0 -4
  234. package/src/utils/map.js +0 -11
  235. package/src/utils/negate.js +0 -8
  236. package/src/utils/noop.js +0 -1
  237. package/src/utils/notExisty.js +0 -5
  238. package/src/utils/reduce.js +0 -8
  239. package/src/utils/remove.js +0 -7
  240. package/src/utils/removeClass.js +0 -8
  241. package/src/utils/removeEvent.js +0 -7
  242. package/src/utils/toArray.js +0 -7
  243. package/src/utils/toggleClass.js +0 -16
  244. package/src/utils/uidGenerator.js +0 -8
  245. package/src/utils/upperFirst.js +0 -4
  246. package/tests/extensions/__snapshots__/download.spec.js.snap +0 -226
  247. package/tests/extensions/__snapshots__/fullscreen.spec.js.snap +0 -30
  248. package/tests/extensions/__snapshots__/title.spec.js.snap +0 -16
  249. package/tests/extensions/download.spec.js +0 -111
  250. package/tests/extensions/fullscreen.spec.js +0 -56
  251. package/tests/extensions/title.spec.js +0 -35
  252. package/tests/mocks/assets/BaseM.mp4 +0 -0
  253. package/tests/mocks/assets/hls.min.js +0 -5
  254. package/tests/mocks/assets/styleMock.js +0 -1
  255. package/tests/mocks/base-player-options.js +0 -47
  256. package/tests/mocks/sources.js +0 -58
  257. package/tests/mocks/timedata/cc_en.vtt +0 -171
  258. package/tests/mocks/timedata/cc_ge.vtt +0 -178
  259. package/tests/utils/wait.js +0 -1
  260. package/webpack.config.js +0 -78
@@ -1,230 +0,0 @@
1
- import BaseExtension from './base';
2
-
3
- import {
4
- createElement,
5
- toggleClass,
6
- each,
7
- toArray,
8
- filter,
9
- isEmpty,
10
- removeClass,
11
- addClass,
12
- inRange,
13
- findIndex,
14
- hasClass
15
- } from '../utils';
16
-
17
- import binder from '../helpers/binder';
18
- import opener from './helpers/clickOpener';
19
- import popover from './helpers/popover';
20
- import { secondsToTime } from './helpers/timeCodeToSeconds';
21
- import createSvg, { SEARCH, CLEAR } from '../svgs';
22
- import scrollIntoView from './helpers/scrollIntoView';
23
- import textContent from './helpers/textContent';
24
-
25
- const CN = 'rmp-ext-search';
26
- const HIDDEN_CN = 'rmp-ext-search--hidden';
27
- const BUTTON_CN = `${CN}__button`;
28
- const SELECTOR_CN = `${CN}__selector`;
29
- const SELECTOR_OPEN_CN = `${SELECTOR_CN}--open`;
30
- const CAPTIONS_CN = `${CN}__captions`;
31
- const INPUT_CN = `${CN}__input`;
32
- const ITEM_CN = `${CN}__item`;
33
- const CURRENT_ITEM_CN = `${ITEM_CN}--current`;
34
- const CC_TIME_CN = `${CN}__cc-time`;
35
- const CC_TEXT_CN = `${CN}__cc-text`;
36
- const CC_CLEAR_CN = `${CN}__cc-clear`;
37
-
38
- export default class CaptionSearchExtension extends BaseExtension {
39
- $el;
40
- filter = '';
41
-
42
- constructor(player, state, options) {
43
- super(player, state, options, ['statechanged', 'timeupdate', 'showpopup', 'loadedmetadata', 'canplaythrough']);
44
- this.logger.debug('search:extension:creating');
45
-
46
- this.render();
47
- this.init();
48
- binder(this, ['onTimeupdate']);
49
-
50
- this.logger.debug('search:extension:created');
51
- }
52
-
53
- render() {
54
- /** @type {HTMLMediaElement} */
55
- this.$el = createElement('div', { class: CN });
56
-
57
- this.$button = createElement('button', { type: 'button', class: BUTTON_CN }, this.$el);
58
-
59
- this.$selector = createElement('div', { class: SELECTOR_CN }, this.$el);
60
-
61
- this.$captions = createElement('div', { class: CAPTIONS_CN }, this.$selector);
62
- this.$input = createElement('input', { class: INPUT_CN, placeholder: this.$t('caption-search') }, this.$selector);
63
- this.$clearBtn = createElement('button', { class: `${CC_CLEAR_CN} ${HIDDEN_CN}` }, this.$selector);
64
-
65
- createSvg(this.$clearBtn, CLEAR);
66
- createSvg(this.$button, SEARCH);
67
- }
68
-
69
- init() {
70
- const $button = this.$button;
71
- const $selector = this.$selector;
72
- const reposition = false;
73
- const closeOnClick = false;
74
- const heightControl = false;
75
-
76
- popover(this, { $button, text: this.$t('caption-search') } );
77
- opener(this, { $button, $selector, SELECTOR_OPEN_CN, reposition, closeOnClick, heightControl });
78
-
79
- this.addEvent(this.$input, 'input', () => {
80
- this.filter = this.$input.value;
81
- this.renderCaptions();
82
-
83
- if (this.$input.value) {
84
- this.$clearBtn.classList.remove(HIDDEN_CN);
85
- } else {
86
- this.$clearBtn.classList.add(HIDDEN_CN);
87
- }
88
- });
89
-
90
- this.$clearBtn.addEventListener('click', () => {
91
- this.$input.value = '';
92
- this.filter = '';
93
- this.renderCaptions();
94
- });
95
- }
96
-
97
- onStatechanged(state, old) {
98
- if (state.cc.lang !== old.cc.lang) {
99
- this.handleCaptionLanguageChanged(state.cc.lang);
100
- } else if ( state.cc.timedata !== old.cc.timedata ) {
101
- this.handleTimeDataChanged();
102
- }
103
- }
104
-
105
- onCanplaythrough() {
106
- this.handleTimeDataChanged();
107
- }
108
-
109
- onLoadedmetadata() {
110
- this.handleTimeDataChanged();
111
- }
112
-
113
- handleCaptionLanguageChanged(lang) {
114
- toggleClass(this.$el, HIDDEN_CN, !lang);
115
- }
116
-
117
- handleTimeDataChanged() {
118
- const lang = this.state.getCCLang();
119
- this.handleCaptionLanguageChanged(lang);
120
- this.renderCaptions();
121
- }
122
-
123
- filteredCaptions() {
124
- const r = new RegExp(escapeRegExp(this.filter), 'ig');
125
- return filter(this.state.getCCTimeData(), td => {
126
- r.lastIndex = 0;
127
- return r.test(td.text);
128
- });
129
- }
130
-
131
- renderCaptions() {
132
- const duration = this.player.getDuration();
133
- if (!duration) {
134
- return;
135
- }
136
- const hasHour = duration > 3600;
137
- each(toArray(this.$captions.childNodes), btn => this.$captions.removeChild(btn) );
138
-
139
- const list = this.filteredCaptions();
140
- each(list, caption => {
141
- const item = createElement('button', { type: 'button', class: ITEM_CN, id: _id(caption.id) }, this.$captions);
142
- const time = createElement('span', { class: CC_TIME_CN }, item);
143
- time.textContent = secondsToTime(caption.from, hasHour);
144
- const captionText = textContent(caption.text);
145
- const text = createElement('span', { class: CC_TEXT_CN, title: captionText }, item);
146
- text.textContent = captionText;
147
-
148
- this.addEvent(item, 'click', (e) => {
149
- e.preventDefault();
150
- e.stopPropagation();
151
- const isPaused = this.player.isPaused();
152
- this.player.setCurrentTime(caption.from);
153
- if (isPaused) {
154
- this.player.play();
155
- }
156
- });
157
- });
158
- }
159
-
160
- onShowpopup() {
161
- this.onTimeupdate();
162
- this.scrollToCurrentCaption();
163
- }
164
-
165
- scrollToCurrentCaption() {
166
- const timeData = this.filteredCaptions();
167
- const ct = this.player.getCurrentTime();
168
- const idx = findIndex(timeData, ({ from, to }) => inRange(ct, from, to));
169
-
170
- if (idx > -1) {
171
- const btns = toArray(this.$captions.childNodes);
172
- const btn = btns[Math.max(0, idx - 2)];
173
- if (btn) {
174
- scrollIntoView(btn, this.$captions);
175
- }
176
- }
177
- }
178
-
179
- onTimeupdate() {
180
- const timeData = this.filteredCaptions();
181
-
182
- if (isEmpty(timeData)) {
183
- return;
184
- }
185
-
186
- const ct = this.player.getCurrentTime();
187
- const idx = findIndex(timeData, ({ from, to }) => inRange(ct, from, to));
188
-
189
- if (idx > -1) {
190
- const item = timeData[idx];
191
- const btn = document.getElementById(_id(item.id));
192
-
193
- if (!btn) {
194
- each(toArray(this.$captions.childNodes), btn => removeClass(btn, CURRENT_ITEM_CN));
195
- return;
196
- }
197
-
198
- if (hasClass(btn, CURRENT_ITEM_CN)) {
199
- return;
200
- }
201
-
202
- // this.scrollToCurrentCaption();
203
- each(toArray(this.$captions.childNodes), btn => removeClass(btn, CURRENT_ITEM_CN));
204
- addClass(btn, CURRENT_ITEM_CN);
205
- } else {
206
- each(toArray(this.$captions.childNodes), btn => removeClass(btn, CURRENT_ITEM_CN));
207
- }
208
- }
209
-
210
- getElement() {
211
- return this.$el;
212
- }
213
-
214
- destroy() {
215
- super.destroy();
216
- const parent = this.$el.parentNode;
217
- if (parent instanceof HTMLElement) {
218
- parent.removeChild(this.$el);
219
- }
220
- this.$el = null;
221
- }
222
- }
223
-
224
- function escapeRegExp(text) {
225
- return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
226
- }
227
-
228
- function _id(id) {
229
- return `cc-${id}`;
230
- }