@srgssr/pillarbox-web 1.12.2

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 (79) hide show
  1. package/LICENSE +21 -0
  2. package/dist/pillarbox-core.cjs.js +307 -0
  3. package/dist/pillarbox-core.cjs.min.js +2 -0
  4. package/dist/pillarbox-core.cjs.min.js.map +1 -0
  5. package/dist/pillarbox-core.es.js +305 -0
  6. package/dist/pillarbox-core.es.min.js +2 -0
  7. package/dist/pillarbox-core.es.min.js.map +1 -0
  8. package/dist/pillarbox-core.umd.js +68327 -0
  9. package/dist/pillarbox-core.umd.min.js +35 -0
  10. package/dist/pillarbox-core.umd.min.js.map +1 -0
  11. package/dist/pillarbox.cjs.js +3571 -0
  12. package/dist/pillarbox.cjs.min.js +2 -0
  13. package/dist/pillarbox.cjs.min.js.map +1 -0
  14. package/dist/pillarbox.es.js +3569 -0
  15. package/dist/pillarbox.es.min.js +2 -0
  16. package/dist/pillarbox.es.min.js.map +1 -0
  17. package/dist/pillarbox.min.css +1 -0
  18. package/dist/pillarbox.min.css.map +1 -0
  19. package/dist/pillarbox.umd.js +71591 -0
  20. package/dist/pillarbox.umd.min.js +35 -0
  21. package/dist/pillarbox.umd.min.js.map +1 -0
  22. package/dist/types/build.es.d.ts +5 -0
  23. package/dist/types/build.es.d.ts.map +1 -0
  24. package/dist/types/src/analytics/SRGAnalytics.d.ts +414 -0
  25. package/dist/types/src/analytics/SRGAnalytics.d.ts.map +1 -0
  26. package/dist/types/src/components/player.d.ts +116 -0
  27. package/dist/types/src/components/player.d.ts.map +1 -0
  28. package/dist/types/src/components/typedef.d.ts +14 -0
  29. package/dist/types/src/components/typedef.d.ts.map +1 -0
  30. package/dist/types/src/dataProvider/model/MediaComposition.d.ts +154 -0
  31. package/dist/types/src/dataProvider/model/MediaComposition.d.ts.map +1 -0
  32. package/dist/types/src/dataProvider/model/typedef.d.ts +1485 -0
  33. package/dist/types/src/dataProvider/model/typedef.d.ts.map +1 -0
  34. package/dist/types/src/dataProvider/services/DataProvider.d.ts +40 -0
  35. package/dist/types/src/dataProvider/services/DataProvider.d.ts.map +1 -0
  36. package/dist/types/src/lang/de.d.ts +2 -0
  37. package/dist/types/src/lang/de.d.ts.map +1 -0
  38. package/dist/types/src/lang/en.d.ts +2 -0
  39. package/dist/types/src/lang/en.d.ts.map +1 -0
  40. package/dist/types/src/lang/fr.d.ts +2 -0
  41. package/dist/types/src/lang/fr.d.ts.map +1 -0
  42. package/dist/types/src/lang/it.d.ts +2 -0
  43. package/dist/types/src/lang/it.d.ts.map +1 -0
  44. package/dist/types/src/lang/rm.d.ts +2 -0
  45. package/dist/types/src/lang/rm.d.ts.map +1 -0
  46. package/dist/types/src/middleware/srgssr.d.ts +271 -0
  47. package/dist/types/src/middleware/srgssr.d.ts.map +1 -0
  48. package/dist/types/src/middleware/typedef.d.ts +67 -0
  49. package/dist/types/src/middleware/typedef.d.ts.map +1 -0
  50. package/dist/types/src/pillarbox.d.ts +11 -0
  51. package/dist/types/src/pillarbox.d.ts.map +1 -0
  52. package/dist/types/src/utils/AkamaiTokenService.d.ts +73 -0
  53. package/dist/types/src/utils/AkamaiTokenService.d.ts.map +1 -0
  54. package/dist/types/src/utils/Drm.d.ts +31 -0
  55. package/dist/types/src/utils/Drm.d.ts.map +1 -0
  56. package/dist/types/src/utils/Image.d.ts +33 -0
  57. package/dist/types/src/utils/Image.d.ts.map +1 -0
  58. package/dist/types/src/utils/PlayerEvents.d.ts +177 -0
  59. package/dist/types/src/utils/PlayerEvents.d.ts.map +1 -0
  60. package/dist/types/src/utils/typedef.d.ts +17 -0
  61. package/dist/types/src/utils/typedef.d.ts.map +1 -0
  62. package/package.json +109 -0
  63. package/scss/components/_big-play.scss +30 -0
  64. package/scss/components/_captions-settings.scss +71 -0
  65. package/scss/components/_control-bar.scss +15 -0
  66. package/scss/components/_control-spacer.scss +9 -0
  67. package/scss/components/_control.scss +8 -0
  68. package/scss/components/_error.scss +10 -0
  69. package/scss/components/_layout.scss +63 -0
  70. package/scss/components/_loading.scss +34 -0
  71. package/scss/components/_progress.scss +70 -0
  72. package/scss/components/_slider.scss +9 -0
  73. package/scss/components/_text-track.scss +8 -0
  74. package/scss/components/_time.scss +29 -0
  75. package/scss/components/_title-bar.scss +9 -0
  76. package/scss/components/_volume.scss +16 -0
  77. package/scss/components/menu/_menu-popup.scss +30 -0
  78. package/scss/components/menu/_menu.scss +26 -0
  79. package/scss/pillarbox.scss +26 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) SRG SSR
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,307 @@
1
+ 'use strict';
2
+
3
+ var videojs = require('video.js');
4
+ require('videojs-contrib-eme');
5
+
6
+ var version = "1.12.1";
7
+
8
+ /**
9
+ * @ignore
10
+ * @type {typeof import('video.js/dist/types/player').default}
11
+ */
12
+ const vjsPlayer = videojs.getComponent('player');
13
+
14
+ /**
15
+ * This class extends the video.js Player.
16
+ *
17
+ * @class Player
18
+ * @see https://docs.videojs.com/player
19
+ */
20
+ class Player extends vjsPlayer {
21
+ constructor(tag, options, ready) {
22
+ /**
23
+ * Configuration for plugins.
24
+ *
25
+ * @see [Video.js Plugins Option]{@link https://videojs.com/guides/options/#plugins}
26
+ * @type {Object}
27
+ * @property {boolean} eme - Enable the EME (Encrypted Media Extensions) plugin.
28
+ */
29
+ options = videojs.obj.merge(options, {
30
+ plugins: {
31
+ eme: true
32
+ }
33
+ });
34
+ super(tag, options, ready);
35
+ }
36
+
37
+ /**
38
+ * A getter/setter for the media's audio track.
39
+ * Activates the audio track according to the language and kind properties.
40
+ * Falls back on the first audio track found if the kind property is not satisfied.
41
+ *
42
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/AudioTrack/kind
43
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/AudioTrack/language
44
+ *
45
+ * @param {import('./typedef').TrackSelector} [trackSelector]
46
+ *
47
+ * @example
48
+ * // Get the current audio track
49
+ * player.audioTrack();
50
+ *
51
+ * @example
52
+ * // Activate an audio track based on language and kind properties
53
+ * player.audioTrack({language:'en', kind:'description'});
54
+ *
55
+ * @example
56
+ * // Activate first audio track found corresponding to language
57
+ * player.audioTrack({language:'fr'});
58
+ *
59
+ * @return {import('video.js/dist/types/tracks/audio-track').default | undefined} The
60
+ * currently enabled audio track. See {@link https://docs.videojs.com/audiotrack}.
61
+ */
62
+ audioTrack(trackSelector) {
63
+ const audioTracks = Array.from(this.player().audioTracks());
64
+ if (!trackSelector) {
65
+ return audioTracks.find(audioTrack => audioTrack.enabled);
66
+ }
67
+ const {
68
+ kind,
69
+ language
70
+ } = trackSelector;
71
+ const audioTrack = audioTracks.find(audioTrack => audioTrack.language === language && audioTrack.kind === kind) || audioTracks.find(audioTrack => audioTrack.language === language);
72
+ if (audioTrack) {
73
+ audioTrack.enabled = true;
74
+ }
75
+ return audioTrack;
76
+ }
77
+
78
+ /**
79
+ * Calculates an array of ranges based on the `buffered()` data.
80
+ *
81
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/buffered
82
+ *
83
+ * @returns {Array<{start: number, end: number}>} An array of objects representing start and end points of buffered ranges.
84
+ */
85
+ bufferedRanges() {
86
+ const ranges = [];
87
+ for (let i = 0; i < this.buffered().length; i++) {
88
+ const start = this.buffered().start(i);
89
+ const end = this.buffered().end(i);
90
+ ranges.push({
91
+ start,
92
+ end
93
+ });
94
+ }
95
+ return ranges;
96
+ }
97
+
98
+ /**
99
+ * Get the percent (as a decimal) of the media that's been played.
100
+ * This method is not a part of the native HTML video API.
101
+ *
102
+ * Live streams with DVR are not currently supported.
103
+ *
104
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement#htmlmediaelement.played
105
+ *
106
+ * @return {number}
107
+ * A decimal between 0 and 1 representing the percent
108
+ * that is played 0 being 0% and 1 being 100%
109
+ */
110
+ playedPercent() {
111
+ if (!Number.isFinite(this.duration())) return NaN;
112
+ let timePlayed = 0;
113
+ for (let i = 0; i != this.played().length; i++) {
114
+ timePlayed += this.played().end(i) - this.played().start(i);
115
+ }
116
+ const percentPlayed = timePlayed / this.duration();
117
+ return percentPlayed;
118
+ }
119
+
120
+ /**
121
+ * Get an array of ranges based on the `played` data.
122
+ *
123
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement#htmlmediaelement.played
124
+ *
125
+ * @returns {Array<{start: number, end: number}>} An array of objects representing start and end points of played ranges.
126
+ */
127
+ playedRanges() {
128
+ const ranges = [];
129
+ for (let i = 0; i < this.played().length; i++) {
130
+ const start = this.played().start(i);
131
+ const end = this.played().end(i);
132
+ ranges.push({
133
+ start,
134
+ end
135
+ });
136
+ }
137
+ return ranges;
138
+ }
139
+
140
+ /**
141
+ * Calculates an array of ranges based on the `seekable()` data.
142
+ *
143
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/seekable
144
+ *
145
+ * @returns {Array<{start: number, end: number}>} An array of objects representing start and end points of seekable ranges.
146
+ */
147
+ seekableRanges() {
148
+ const ranges = [];
149
+ for (let i = 0; i < this.seekable().length; i++) {
150
+ const start = this.seekable().start(i);
151
+ const end = this.seekable().end(i);
152
+ ranges.push({
153
+ start,
154
+ end
155
+ });
156
+ }
157
+ return ranges;
158
+ }
159
+
160
+ /**
161
+ * A getter/setter for the media's text track.
162
+ * Activates the text track according to the language and kind properties.
163
+ * Falls back on the first text track found if the kind property is not satisfied.
164
+ * Disables all subtitle tracks that are `showing` if the `trackSelector` is truthy but does not satisfy any condition.
165
+ *
166
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/TextTrack/kind
167
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/textTrack/language
168
+ *
169
+ * @param {import('./typedef').TrackSelector} [trackSelector]
170
+ *
171
+ * @example
172
+ * // Get the current text track
173
+ * player.textTrack();
174
+ *
175
+ * @example
176
+ * // Disable all text tracks has a side effect
177
+ * player.textTrack('off');
178
+ * player.textTrack({});
179
+ *
180
+ * @example
181
+ * // Activate an text track based on language and kind properties
182
+ * player.textTrack({language:'en', kind:'captions'});
183
+ *
184
+ * @example
185
+ * // Activate first text track found corresponding to language
186
+ * player.textTrack({language:'fr'});
187
+ *
188
+ * @return {import('video.js/dist/types/tracks/text-track').default | undefined} The
189
+ * currently enabled text track. See {@link https://docs.videojs.com/texttrack}.
190
+ */
191
+ textTrack(trackSelector) {
192
+ const textTracks = Array.from(this.player().textTracks()).filter(textTrack => !['chapters', 'metadata'].includes(textTrack.kind));
193
+ if (!trackSelector) {
194
+ return textTracks.find(textTrack => textTrack.mode === 'showing');
195
+ }
196
+ textTracks.forEach(textTrack => textTrack.mode = 'disabled');
197
+ const {
198
+ kind,
199
+ language
200
+ } = trackSelector;
201
+ const textTrack = textTracks.find(textTrack => {
202
+ if (textTrack.language === language && textTrack.kind === kind) {
203
+ textTrack.mode = 'showing';
204
+ }
205
+ return textTrack.mode === 'showing';
206
+ }) || textTracks.find(textTrack => {
207
+ if (textTrack.language === language) {
208
+ textTrack.mode = 'showing';
209
+ }
210
+ return textTrack.mode === 'showing';
211
+ });
212
+ return textTrack;
213
+ }
214
+ }
215
+ videojs.registerComponent('player', Player);
216
+
217
+ /**
218
+ * Pillarbox is an alias for the video.js namespace with additional options.
219
+ *
220
+ * @namespace
221
+ * @see https://docs.videojs.com/module-videojs-videojs
222
+ * @type {videojs}
223
+ */
224
+ const pillarbox = videojs;
225
+ pillarbox.VERSION = {
226
+ pillarbox: version,
227
+ videojs: videojs.VERSION,
228
+ [videojs.VhsSourceHandler.name]: videojs.VhsSourceHandler.VERSION,
229
+ eme: videojs.getPlugin('eme').VERSION
230
+ };
231
+
232
+ /**
233
+ * Enable smooth seeking for Pillarbox.
234
+ *
235
+ * @see [Video.js enableSmoothSeeking Option]{@link https://videojs.com/guides/options/#enablesmoothseeking}
236
+ * @type {boolean}
237
+ * @default true
238
+ */
239
+ pillarbox.options.enableSmoothSeeking = true;
240
+ /**
241
+ * Enable fill mode for the video player, allowing it to expand to fill the container.
242
+ *
243
+ * @see [Video.js Fill Option]{@link https://videojs.com/guides/layout/#fill-mode}
244
+ * @type {boolean}
245
+ * @default true
246
+ */
247
+ pillarbox.options.fill = true;
248
+ /**
249
+ * Configuration options for HTML5 settings in Pillarbox.
250
+ *
251
+ * @see [VHS useForcedSubtitles Option]{@link https://github.com/videojs/http-streaming/blob/main/README.md#useforcedsubtitles}
252
+ * @type {Object}
253
+ * @property {Object} vhs - Configuration for the Video.js HTTP Streaming.
254
+ * @property {boolean} useForcedSubtitles - Enables the player to display forced subtitles by default.
255
+ * Forced subtitles are pieces of information intended for display when no other text representation
256
+ * is selected. They are used to clarify dialogue, provide alternate languages, display texted graphics,
257
+ * or present location/person IDs that are not otherwise covered in the dubbed/localized audio.
258
+ */
259
+ pillarbox.options.html5 = {
260
+ vhs: {
261
+ useForcedSubtitles: true
262
+ }
263
+ };
264
+ /**
265
+ * Configuration for the live tracker.
266
+ *
267
+ * @see [Video.js liveTracker Option]{@link https://videojs.com/guides/options/#livetrackertrackingthreshold}
268
+ * @type {Object}
269
+ * @property {number} trackingThreshold - A threshold that controls when the liveui should be shown.
270
+ * @property {number} liveTolerance - An option that controls how far from the seekable end should be considered live playback.
271
+ */
272
+ pillarbox.options.liveTracker = {
273
+ trackingThreshold: 120,
274
+ liveTolerance: 15
275
+ };
276
+ /**
277
+ * Allows the player to use the live ui that includes:
278
+ *
279
+ * - A progress bar for seeking within the live window
280
+ * - A button that can be clicked to seek to the live edge with a circle indicating if you are at the live edge or not.
281
+ *
282
+ * @see [Video.js liveui Option]{@link https://videojs.com/guides/options/#liveui}
283
+ * @type {boolean}
284
+ */
285
+ pillarbox.options.liveui = true;
286
+ /**
287
+ * Indicates that the video is to be played "inline", that is within the element's playback area.
288
+ *
289
+ * @see [Video element playsinline attribute]{@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#playsinline}
290
+ * @type {boolean}
291
+ */
292
+ pillarbox.options.playsinline = true;
293
+ /**
294
+ * Enable responsive mode, this will cause the player to customize itself based on responsive breakpoints.
295
+ *
296
+ * @see [Video.js Responsive Option]{@link https://videojs.com/guides/options/#responsive}
297
+ * @type {boolean}
298
+ */
299
+ pillarbox.options.responsive = true;
300
+ /**
301
+ * A placeholder for accessing trackers directly from the player.
302
+ *
303
+ * @type {Object}
304
+ */
305
+ pillarbox.options.trackers = {};
306
+
307
+ module.exports = pillarbox;
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("video.js");require("videojs-contrib-eme");const t=e.getComponent("player");e.registerComponent("player",class extends t{constructor(t,n,s){super(t,n=e.obj.merge(n,{plugins:{eme:!0}}),s)}audioTrack(e){const t=Array.from(this.player().audioTracks());if(!e)return t.find((e=>e.enabled));const{kind:n,language:s}=e,r=t.find((e=>e.language===s&&e.kind===n))||t.find((e=>e.language===s));return r&&(r.enabled=!0),r}bufferedRanges(){const e=[];for(let t=0;t<this.buffered().length;t++){const n=this.buffered().start(t),s=this.buffered().end(t);e.push({start:n,end:s})}return e}playedPercent(){if(!Number.isFinite(this.duration()))return NaN;let e=0;for(let t=0;t!=this.played().length;t++)e+=this.played().end(t)-this.played().start(t);return e/this.duration()}playedRanges(){const e=[];for(let t=0;t<this.played().length;t++){const n=this.played().start(t),s=this.played().end(t);e.push({start:n,end:s})}return e}seekableRanges(){const e=[];for(let t=0;t<this.seekable().length;t++){const n=this.seekable().start(t),s=this.seekable().end(t);e.push({start:n,end:s})}return e}textTrack(e){const t=Array.from(this.player().textTracks()).filter((e=>!["chapters","metadata"].includes(e.kind)));if(!e)return t.find((e=>"showing"===e.mode));t.forEach((e=>e.mode="disabled"));const{kind:n,language:s}=e;return t.find((e=>(e.language===s&&e.kind===n&&(e.mode="showing"),"showing"===e.mode)))||t.find((e=>(e.language===s&&(e.mode="showing"),"showing"===e.mode)))}});const n=e;n.VERSION={pillarbox:"1.12.1",videojs:e.VERSION,[e.VhsSourceHandler.name]:e.VhsSourceHandler.VERSION,eme:e.getPlugin("eme").VERSION},n.options.enableSmoothSeeking=!0,n.options.fill=!0,n.options.html5={vhs:{useForcedSubtitles:!0}},n.options.liveTracker={trackingThreshold:120,liveTolerance:15},n.options.liveui=!0,n.options.playsinline=!0,n.options.responsive=!0,n.options.trackers={},module.exports=n;
2
+ //# sourceMappingURL=pillarbox-core.cjs.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pillarbox-core.cjs.min.js","sources":["../src/components/player.js","../src/pillarbox.js"],"sourcesContent":["import videojs from 'video.js';\nimport 'videojs-contrib-eme';\n\n/**\n * @ignore\n * @type {typeof import('video.js/dist/types/player').default}\n */\nconst vjsPlayer = videojs.getComponent('player');\n\n/**\n * This class extends the video.js Player.\n *\n * @class Player\n * @see https://docs.videojs.com/player\n */\nclass Player extends vjsPlayer {\n constructor(tag, options, ready) {\n /**\n * Configuration for plugins.\n *\n * @see [Video.js Plugins Option]{@link https://videojs.com/guides/options/#plugins}\n * @type {Object}\n * @property {boolean} eme - Enable the EME (Encrypted Media Extensions) plugin.\n */\n options = videojs.obj.merge(options, { plugins: { eme: true }});\n super(tag, options, ready);\n }\n\n /**\n * A getter/setter for the media's audio track.\n * Activates the audio track according to the language and kind properties.\n * Falls back on the first audio track found if the kind property is not satisfied.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/AudioTrack/kind\n * @see https://developer.mozilla.org/en-US/docs/Web/API/AudioTrack/language\n *\n * @param {import('./typedef').TrackSelector} [trackSelector]\n *\n * @example\n * // Get the current audio track\n * player.audioTrack();\n *\n * @example\n * // Activate an audio track based on language and kind properties\n * player.audioTrack({language:'en', kind:'description'});\n *\n * @example\n * // Activate first audio track found corresponding to language\n * player.audioTrack({language:'fr'});\n *\n * @return {import('video.js/dist/types/tracks/audio-track').default | undefined} The\n * currently enabled audio track. See {@link https://docs.videojs.com/audiotrack}.\n */\n audioTrack(trackSelector) {\n const audioTracks = Array.from(this.player().audioTracks());\n\n if (!trackSelector) {\n return audioTracks.find((audioTrack) => audioTrack.enabled);\n }\n\n const { kind, language } = trackSelector;\n const audioTrack =\n audioTracks.find(\n (audioTrack) =>\n audioTrack.language === language && audioTrack.kind === kind\n ) || audioTracks.find((audioTrack) => audioTrack.language === language);\n\n if (audioTrack) {\n audioTrack.enabled = true;\n }\n\n return audioTrack;\n }\n\n /**\n * Calculates an array of ranges based on the `buffered()` data.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/buffered\n *\n * @returns {Array<{start: number, end: number}>} An array of objects representing start and end points of buffered ranges.\n */\n bufferedRanges() {\n const ranges = [];\n\n for (let i = 0; i < this.buffered().length; i++) {\n const start = this.buffered().start(i);\n const end = this.buffered().end(i);\n\n ranges.push({ start, end });\n }\n\n return ranges;\n }\n\n /**\n * Get the percent (as a decimal) of the media that's been played.\n * This method is not a part of the native HTML video API.\n *\n * Live streams with DVR are not currently supported.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement#htmlmediaelement.played\n *\n * @return {number}\n * A decimal between 0 and 1 representing the percent\n * that is played 0 being 0% and 1 being 100%\n */\n playedPercent() {\n if (!Number.isFinite(this.duration())) return NaN;\n\n let timePlayed = 0;\n\n for (let i = 0; i != this.played().length; i++) {\n timePlayed += this.played().end(i) - this.played().start(i);\n }\n\n const percentPlayed = timePlayed / this.duration();\n\n return percentPlayed;\n }\n\n /**\n * Get an array of ranges based on the `played` data.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement#htmlmediaelement.played\n *\n * @returns {Array<{start: number, end: number}>} An array of objects representing start and end points of played ranges.\n */\n playedRanges() {\n const ranges = [];\n\n for (let i = 0; i < this.played().length; i++) {\n const start = this.played().start(i);\n const end = this.played().end(i);\n\n ranges.push({ start, end });\n }\n\n return ranges;\n }\n\n /**\n * Calculates an array of ranges based on the `seekable()` data.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/seekable\n *\n * @returns {Array<{start: number, end: number}>} An array of objects representing start and end points of seekable ranges.\n */\n seekableRanges() {\n const ranges = [];\n\n for (let i = 0; i < this.seekable().length; i++) {\n const start = this.seekable().start(i);\n const end = this.seekable().end(i);\n\n ranges.push({ start, end });\n }\n\n return ranges;\n }\n\n /**\n * A getter/setter for the media's text track.\n * Activates the text track according to the language and kind properties.\n * Falls back on the first text track found if the kind property is not satisfied.\n * Disables all subtitle tracks that are `showing` if the `trackSelector` is truthy but does not satisfy any condition.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/TextTrack/kind\n * @see https://developer.mozilla.org/en-US/docs/Web/API/textTrack/language\n *\n * @param {import('./typedef').TrackSelector} [trackSelector]\n *\n * @example\n * // Get the current text track\n * player.textTrack();\n *\n * @example\n * // Disable all text tracks has a side effect\n * player.textTrack('off');\n * player.textTrack({});\n *\n * @example\n * // Activate an text track based on language and kind properties\n * player.textTrack({language:'en', kind:'captions'});\n *\n * @example\n * // Activate first text track found corresponding to language\n * player.textTrack({language:'fr'});\n *\n * @return {import('video.js/dist/types/tracks/text-track').default | undefined} The\n * currently enabled text track. See {@link https://docs.videojs.com/texttrack}.\n */\n textTrack(trackSelector) {\n const textTracks = Array.from(this.player().textTracks()).filter(\n (textTrack) => !['chapters', 'metadata'].includes(textTrack.kind)\n );\n\n if (!trackSelector) {\n return textTracks.find((textTrack) => textTrack.mode === 'showing');\n }\n\n textTracks.forEach((textTrack) => (textTrack.mode = 'disabled'));\n\n const { kind, language } = trackSelector;\n const textTrack =\n textTracks.find((textTrack) => {\n if (textTrack.language === language && textTrack.kind === kind) {\n textTrack.mode = 'showing';\n }\n\n return textTrack.mode === 'showing';\n }) ||\n textTracks.find((textTrack) => {\n if (textTrack.language === language) {\n textTrack.mode = 'showing';\n }\n\n return textTrack.mode === 'showing';\n });\n\n return textTrack;\n }\n}\n\nvideojs.registerComponent('player', Player);\n\nexport default Player;\n","import { version } from '../package.json';\nimport videojs from 'video.js';\nimport './components/player.js';\n\n/**\n * Pillarbox is an alias for the video.js namespace with additional options.\n *\n * @namespace\n * @see https://docs.videojs.com/module-videojs-videojs\n * @type {videojs}\n */\nconst pillarbox = videojs;\n\npillarbox.VERSION = {\n pillarbox: version,\n videojs: videojs.VERSION,\n [videojs.VhsSourceHandler.name]: videojs.VhsSourceHandler.VERSION,\n eme: videojs.getPlugin('eme').VERSION,\n};\n\n/**\n * Enable smooth seeking for Pillarbox.\n *\n * @see [Video.js enableSmoothSeeking Option]{@link https://videojs.com/guides/options/#enablesmoothseeking}\n * @type {boolean}\n * @default true\n */\npillarbox.options.enableSmoothSeeking = true;\n/**\n * Enable fill mode for the video player, allowing it to expand to fill the container.\n *\n * @see [Video.js Fill Option]{@link https://videojs.com/guides/layout/#fill-mode}\n * @type {boolean}\n * @default true\n */\npillarbox.options.fill = true;\n/**\n * Configuration options for HTML5 settings in Pillarbox.\n *\n * @see [VHS useForcedSubtitles Option]{@link https://github.com/videojs/http-streaming/blob/main/README.md#useforcedsubtitles}\n * @type {Object}\n * @property {Object} vhs - Configuration for the Video.js HTTP Streaming.\n * @property {boolean} useForcedSubtitles - Enables the player to display forced subtitles by default.\n * Forced subtitles are pieces of information intended for display when no other text representation\n * is selected. They are used to clarify dialogue, provide alternate languages, display texted graphics,\n * or present location/person IDs that are not otherwise covered in the dubbed/localized audio.\n */\npillarbox.options.html5 = {\n vhs: { useForcedSubtitles: true }\n};\n/**\n * Configuration for the live tracker.\n *\n * @see [Video.js liveTracker Option]{@link https://videojs.com/guides/options/#livetrackertrackingthreshold}\n * @type {Object}\n * @property {number} trackingThreshold - A threshold that controls when the liveui should be shown.\n * @property {number} liveTolerance - An option that controls how far from the seekable end should be considered live playback.\n */\npillarbox.options.liveTracker = {\n trackingThreshold: 120,\n liveTolerance: 15,\n};\n/**\n * Allows the player to use the live ui that includes:\n *\n * - A progress bar for seeking within the live window\n * - A button that can be clicked to seek to the live edge with a circle indicating if you are at the live edge or not.\n *\n * @see [Video.js liveui Option]{@link https://videojs.com/guides/options/#liveui}\n * @type {boolean}\n */\npillarbox.options.liveui = true;\n/**\n * Indicates that the video is to be played \"inline\", that is within the element's playback area.\n *\n * @see [Video element playsinline attribute]{@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#playsinline}\n * @type {boolean}\n */\npillarbox.options.playsinline = true;\n/**\n * Enable responsive mode, this will cause the player to customize itself based on responsive breakpoints.\n *\n * @see [Video.js Responsive Option]{@link https://videojs.com/guides/options/#responsive}\n * @type {boolean}\n */\npillarbox.options.responsive = true;\n/**\n * A placeholder for accessing trackers directly from the player.\n *\n * @type {Object}\n */\npillarbox.options.trackers = {};\n\nexport default pillarbox;\n"],"names":["vjsPlayer","videojs","getComponent","registerComponent","constructor","tag","options","ready","super","obj","merge","plugins","eme","audioTrack","trackSelector","audioTracks","Array","from","this","player","find","enabled","kind","language","bufferedRanges","ranges","i","buffered","length","start","end","push","playedPercent","Number","isFinite","duration","NaN","timePlayed","played","playedRanges","seekableRanges","seekable","textTrack","textTracks","filter","includes","mode","forEach","pillarbox","VERSION","VhsSourceHandler","name","getPlugin","enableSmoothSeeking","fill","html5","vhs","useForcedSubtitles","liveTracker","trackingThreshold","liveTolerance","liveui","playsinline","responsive","trackers"],"mappings":"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"}
@@ -0,0 +1,305 @@
1
+ import videojs from 'video.js';
2
+ import 'videojs-contrib-eme';
3
+
4
+ var version = "1.12.1";
5
+
6
+ /**
7
+ * @ignore
8
+ * @type {typeof import('video.js/dist/types/player').default}
9
+ */
10
+ const vjsPlayer = videojs.getComponent('player');
11
+
12
+ /**
13
+ * This class extends the video.js Player.
14
+ *
15
+ * @class Player
16
+ * @see https://docs.videojs.com/player
17
+ */
18
+ class Player extends vjsPlayer {
19
+ constructor(tag, options, ready) {
20
+ /**
21
+ * Configuration for plugins.
22
+ *
23
+ * @see [Video.js Plugins Option]{@link https://videojs.com/guides/options/#plugins}
24
+ * @type {Object}
25
+ * @property {boolean} eme - Enable the EME (Encrypted Media Extensions) plugin.
26
+ */
27
+ options = videojs.obj.merge(options, {
28
+ plugins: {
29
+ eme: true
30
+ }
31
+ });
32
+ super(tag, options, ready);
33
+ }
34
+
35
+ /**
36
+ * A getter/setter for the media's audio track.
37
+ * Activates the audio track according to the language and kind properties.
38
+ * Falls back on the first audio track found if the kind property is not satisfied.
39
+ *
40
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/AudioTrack/kind
41
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/AudioTrack/language
42
+ *
43
+ * @param {import('./typedef').TrackSelector} [trackSelector]
44
+ *
45
+ * @example
46
+ * // Get the current audio track
47
+ * player.audioTrack();
48
+ *
49
+ * @example
50
+ * // Activate an audio track based on language and kind properties
51
+ * player.audioTrack({language:'en', kind:'description'});
52
+ *
53
+ * @example
54
+ * // Activate first audio track found corresponding to language
55
+ * player.audioTrack({language:'fr'});
56
+ *
57
+ * @return {import('video.js/dist/types/tracks/audio-track').default | undefined} The
58
+ * currently enabled audio track. See {@link https://docs.videojs.com/audiotrack}.
59
+ */
60
+ audioTrack(trackSelector) {
61
+ const audioTracks = Array.from(this.player().audioTracks());
62
+ if (!trackSelector) {
63
+ return audioTracks.find(audioTrack => audioTrack.enabled);
64
+ }
65
+ const {
66
+ kind,
67
+ language
68
+ } = trackSelector;
69
+ const audioTrack = audioTracks.find(audioTrack => audioTrack.language === language && audioTrack.kind === kind) || audioTracks.find(audioTrack => audioTrack.language === language);
70
+ if (audioTrack) {
71
+ audioTrack.enabled = true;
72
+ }
73
+ return audioTrack;
74
+ }
75
+
76
+ /**
77
+ * Calculates an array of ranges based on the `buffered()` data.
78
+ *
79
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/buffered
80
+ *
81
+ * @returns {Array<{start: number, end: number}>} An array of objects representing start and end points of buffered ranges.
82
+ */
83
+ bufferedRanges() {
84
+ const ranges = [];
85
+ for (let i = 0; i < this.buffered().length; i++) {
86
+ const start = this.buffered().start(i);
87
+ const end = this.buffered().end(i);
88
+ ranges.push({
89
+ start,
90
+ end
91
+ });
92
+ }
93
+ return ranges;
94
+ }
95
+
96
+ /**
97
+ * Get the percent (as a decimal) of the media that's been played.
98
+ * This method is not a part of the native HTML video API.
99
+ *
100
+ * Live streams with DVR are not currently supported.
101
+ *
102
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement#htmlmediaelement.played
103
+ *
104
+ * @return {number}
105
+ * A decimal between 0 and 1 representing the percent
106
+ * that is played 0 being 0% and 1 being 100%
107
+ */
108
+ playedPercent() {
109
+ if (!Number.isFinite(this.duration())) return NaN;
110
+ let timePlayed = 0;
111
+ for (let i = 0; i != this.played().length; i++) {
112
+ timePlayed += this.played().end(i) - this.played().start(i);
113
+ }
114
+ const percentPlayed = timePlayed / this.duration();
115
+ return percentPlayed;
116
+ }
117
+
118
+ /**
119
+ * Get an array of ranges based on the `played` data.
120
+ *
121
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement#htmlmediaelement.played
122
+ *
123
+ * @returns {Array<{start: number, end: number}>} An array of objects representing start and end points of played ranges.
124
+ */
125
+ playedRanges() {
126
+ const ranges = [];
127
+ for (let i = 0; i < this.played().length; i++) {
128
+ const start = this.played().start(i);
129
+ const end = this.played().end(i);
130
+ ranges.push({
131
+ start,
132
+ end
133
+ });
134
+ }
135
+ return ranges;
136
+ }
137
+
138
+ /**
139
+ * Calculates an array of ranges based on the `seekable()` data.
140
+ *
141
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/seekable
142
+ *
143
+ * @returns {Array<{start: number, end: number}>} An array of objects representing start and end points of seekable ranges.
144
+ */
145
+ seekableRanges() {
146
+ const ranges = [];
147
+ for (let i = 0; i < this.seekable().length; i++) {
148
+ const start = this.seekable().start(i);
149
+ const end = this.seekable().end(i);
150
+ ranges.push({
151
+ start,
152
+ end
153
+ });
154
+ }
155
+ return ranges;
156
+ }
157
+
158
+ /**
159
+ * A getter/setter for the media's text track.
160
+ * Activates the text track according to the language and kind properties.
161
+ * Falls back on the first text track found if the kind property is not satisfied.
162
+ * Disables all subtitle tracks that are `showing` if the `trackSelector` is truthy but does not satisfy any condition.
163
+ *
164
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/TextTrack/kind
165
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/textTrack/language
166
+ *
167
+ * @param {import('./typedef').TrackSelector} [trackSelector]
168
+ *
169
+ * @example
170
+ * // Get the current text track
171
+ * player.textTrack();
172
+ *
173
+ * @example
174
+ * // Disable all text tracks has a side effect
175
+ * player.textTrack('off');
176
+ * player.textTrack({});
177
+ *
178
+ * @example
179
+ * // Activate an text track based on language and kind properties
180
+ * player.textTrack({language:'en', kind:'captions'});
181
+ *
182
+ * @example
183
+ * // Activate first text track found corresponding to language
184
+ * player.textTrack({language:'fr'});
185
+ *
186
+ * @return {import('video.js/dist/types/tracks/text-track').default | undefined} The
187
+ * currently enabled text track. See {@link https://docs.videojs.com/texttrack}.
188
+ */
189
+ textTrack(trackSelector) {
190
+ const textTracks = Array.from(this.player().textTracks()).filter(textTrack => !['chapters', 'metadata'].includes(textTrack.kind));
191
+ if (!trackSelector) {
192
+ return textTracks.find(textTrack => textTrack.mode === 'showing');
193
+ }
194
+ textTracks.forEach(textTrack => textTrack.mode = 'disabled');
195
+ const {
196
+ kind,
197
+ language
198
+ } = trackSelector;
199
+ const textTrack = textTracks.find(textTrack => {
200
+ if (textTrack.language === language && textTrack.kind === kind) {
201
+ textTrack.mode = 'showing';
202
+ }
203
+ return textTrack.mode === 'showing';
204
+ }) || textTracks.find(textTrack => {
205
+ if (textTrack.language === language) {
206
+ textTrack.mode = 'showing';
207
+ }
208
+ return textTrack.mode === 'showing';
209
+ });
210
+ return textTrack;
211
+ }
212
+ }
213
+ videojs.registerComponent('player', Player);
214
+
215
+ /**
216
+ * Pillarbox is an alias for the video.js namespace with additional options.
217
+ *
218
+ * @namespace
219
+ * @see https://docs.videojs.com/module-videojs-videojs
220
+ * @type {videojs}
221
+ */
222
+ const pillarbox = videojs;
223
+ pillarbox.VERSION = {
224
+ pillarbox: version,
225
+ videojs: videojs.VERSION,
226
+ [videojs.VhsSourceHandler.name]: videojs.VhsSourceHandler.VERSION,
227
+ eme: videojs.getPlugin('eme').VERSION
228
+ };
229
+
230
+ /**
231
+ * Enable smooth seeking for Pillarbox.
232
+ *
233
+ * @see [Video.js enableSmoothSeeking Option]{@link https://videojs.com/guides/options/#enablesmoothseeking}
234
+ * @type {boolean}
235
+ * @default true
236
+ */
237
+ pillarbox.options.enableSmoothSeeking = true;
238
+ /**
239
+ * Enable fill mode for the video player, allowing it to expand to fill the container.
240
+ *
241
+ * @see [Video.js Fill Option]{@link https://videojs.com/guides/layout/#fill-mode}
242
+ * @type {boolean}
243
+ * @default true
244
+ */
245
+ pillarbox.options.fill = true;
246
+ /**
247
+ * Configuration options for HTML5 settings in Pillarbox.
248
+ *
249
+ * @see [VHS useForcedSubtitles Option]{@link https://github.com/videojs/http-streaming/blob/main/README.md#useforcedsubtitles}
250
+ * @type {Object}
251
+ * @property {Object} vhs - Configuration for the Video.js HTTP Streaming.
252
+ * @property {boolean} useForcedSubtitles - Enables the player to display forced subtitles by default.
253
+ * Forced subtitles are pieces of information intended for display when no other text representation
254
+ * is selected. They are used to clarify dialogue, provide alternate languages, display texted graphics,
255
+ * or present location/person IDs that are not otherwise covered in the dubbed/localized audio.
256
+ */
257
+ pillarbox.options.html5 = {
258
+ vhs: {
259
+ useForcedSubtitles: true
260
+ }
261
+ };
262
+ /**
263
+ * Configuration for the live tracker.
264
+ *
265
+ * @see [Video.js liveTracker Option]{@link https://videojs.com/guides/options/#livetrackertrackingthreshold}
266
+ * @type {Object}
267
+ * @property {number} trackingThreshold - A threshold that controls when the liveui should be shown.
268
+ * @property {number} liveTolerance - An option that controls how far from the seekable end should be considered live playback.
269
+ */
270
+ pillarbox.options.liveTracker = {
271
+ trackingThreshold: 120,
272
+ liveTolerance: 15
273
+ };
274
+ /**
275
+ * Allows the player to use the live ui that includes:
276
+ *
277
+ * - A progress bar for seeking within the live window
278
+ * - A button that can be clicked to seek to the live edge with a circle indicating if you are at the live edge or not.
279
+ *
280
+ * @see [Video.js liveui Option]{@link https://videojs.com/guides/options/#liveui}
281
+ * @type {boolean}
282
+ */
283
+ pillarbox.options.liveui = true;
284
+ /**
285
+ * Indicates that the video is to be played "inline", that is within the element's playback area.
286
+ *
287
+ * @see [Video element playsinline attribute]{@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#playsinline}
288
+ * @type {boolean}
289
+ */
290
+ pillarbox.options.playsinline = true;
291
+ /**
292
+ * Enable responsive mode, this will cause the player to customize itself based on responsive breakpoints.
293
+ *
294
+ * @see [Video.js Responsive Option]{@link https://videojs.com/guides/options/#responsive}
295
+ * @type {boolean}
296
+ */
297
+ pillarbox.options.responsive = true;
298
+ /**
299
+ * A placeholder for accessing trackers directly from the player.
300
+ *
301
+ * @type {Object}
302
+ */
303
+ pillarbox.options.trackers = {};
304
+
305
+ export { pillarbox as default };
@@ -0,0 +1,2 @@
1
+ import e from"video.js";import"videojs-contrib-eme";const t=e.getComponent("player");e.registerComponent("player",class extends t{constructor(t,n,s){super(t,n=e.obj.merge(n,{plugins:{eme:!0}}),s)}audioTrack(e){const t=Array.from(this.player().audioTracks());if(!e)return t.find((e=>e.enabled));const{kind:n,language:s}=e,r=t.find((e=>e.language===s&&e.kind===n))||t.find((e=>e.language===s));return r&&(r.enabled=!0),r}bufferedRanges(){const e=[];for(let t=0;t<this.buffered().length;t++){const n=this.buffered().start(t),s=this.buffered().end(t);e.push({start:n,end:s})}return e}playedPercent(){if(!Number.isFinite(this.duration()))return NaN;let e=0;for(let t=0;t!=this.played().length;t++)e+=this.played().end(t)-this.played().start(t);return e/this.duration()}playedRanges(){const e=[];for(let t=0;t<this.played().length;t++){const n=this.played().start(t),s=this.played().end(t);e.push({start:n,end:s})}return e}seekableRanges(){const e=[];for(let t=0;t<this.seekable().length;t++){const n=this.seekable().start(t),s=this.seekable().end(t);e.push({start:n,end:s})}return e}textTrack(e){const t=Array.from(this.player().textTracks()).filter((e=>!["chapters","metadata"].includes(e.kind)));if(!e)return t.find((e=>"showing"===e.mode));t.forEach((e=>e.mode="disabled"));const{kind:n,language:s}=e;return t.find((e=>(e.language===s&&e.kind===n&&(e.mode="showing"),"showing"===e.mode)))||t.find((e=>(e.language===s&&(e.mode="showing"),"showing"===e.mode)))}});const n=e;n.VERSION={pillarbox:"1.12.1",videojs:e.VERSION,[e.VhsSourceHandler.name]:e.VhsSourceHandler.VERSION,eme:e.getPlugin("eme").VERSION},n.options.enableSmoothSeeking=!0,n.options.fill=!0,n.options.html5={vhs:{useForcedSubtitles:!0}},n.options.liveTracker={trackingThreshold:120,liveTolerance:15},n.options.liveui=!0,n.options.playsinline=!0,n.options.responsive=!0,n.options.trackers={};export{n as default};
2
+ //# sourceMappingURL=pillarbox-core.es.min.js.map