@gcorevideo/player 2.28.25 → 2.28.26

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 (143) hide show
  1. package/dist/core.js +38 -32
  2. package/dist/index.css +223 -223
  3. package/dist/index.embed.js +95 -38
  4. package/dist/index.js +227 -122
  5. package/lib/Player.d.ts.map +1 -1
  6. package/lib/index.core.d.ts +1 -1
  7. package/lib/index.core.d.ts.map +1 -1
  8. package/lib/index.core.js +1 -1
  9. package/lib/index.plugins.d.ts +34 -34
  10. package/lib/index.plugins.d.ts.map +1 -1
  11. package/lib/index.plugins.js +34 -34
  12. package/lib/playback/types.d.ts.map +1 -1
  13. package/lib/plugins/bottom-gear/BottomGear.d.ts.map +1 -1
  14. package/lib/plugins/bottom-gear/BottomGear.js +3 -1
  15. package/lib/plugins/clappr-nerd-stats/speedtest/index.d.ts.map +1 -1
  16. package/lib/plugins/clappr-nerd-stats/speedtest/index.js +9 -5
  17. package/lib/plugins/clappr-nerd-stats/speedtest/types.d.ts.map +1 -1
  18. package/lib/plugins/clappr-nerd-stats/utils.d.ts +2 -2
  19. package/lib/plugins/clips/utils.d.ts.map +1 -1
  20. package/lib/plugins/cmcd-config/CmcdConfig.js +1 -1
  21. package/lib/plugins/favicon/Favicon.d.ts.map +1 -1
  22. package/lib/plugins/google-analytics/GoogleAnalytics.d.ts.map +1 -1
  23. package/lib/plugins/google-analytics/GoogleAnalytics.js +10 -3
  24. package/lib/plugins/kibo/index.d.ts.map +1 -1
  25. package/lib/plugins/kibo/index.js +69 -20
  26. package/lib/plugins/level-selector/QualityLevels.js +2 -2
  27. package/lib/plugins/logo/Logo.d.ts.map +1 -1
  28. package/lib/plugins/logo/Logo.js +19 -15
  29. package/lib/plugins/logo/utils/index.d.ts.map +1 -1
  30. package/lib/plugins/logo/utils/index.js +11 -7
  31. package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
  32. package/lib/plugins/multi-camera/MultiCamera.d.ts.map +1 -1
  33. package/lib/plugins/multi-camera/MultiCamera.js +42 -20
  34. package/lib/plugins/picture-in-picture/PictureInPicture.d.ts.map +1 -1
  35. package/lib/plugins/picture-in-picture/PictureInPicture.js +3 -2
  36. package/lib/plugins/share/Share.d.ts.map +1 -1
  37. package/lib/plugins/share/Share.js +17 -12
  38. package/lib/plugins/skip-time/SkipTime.d.ts.map +1 -1
  39. package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.d.ts.map +1 -1
  40. package/lib/plugins/subtitles/ClosedCaptions.d.ts.map +1 -1
  41. package/lib/plugins/subtitles/ClosedCaptions.js +4 -3
  42. package/lib/plugins/thumbnails/Thumbnails.js +2 -3
  43. package/lib/plugins/thumbnails/utils.d.ts.map +1 -1
  44. package/lib/plugins/utils/fullscreen.d.ts.map +1 -1
  45. package/lib/plugins/utils.d.ts.map +1 -1
  46. package/lib/plugins/utils.js +1 -1
  47. package/lib/plugins/vast-ads/VastAds.d.ts.map +1 -1
  48. package/lib/plugins/vast-ads/VastAds.js +2 -1
  49. package/lib/plugins/vast-ads/loaderxml.d.ts.map +1 -1
  50. package/lib/plugins/vast-ads/loaderxml.js +8 -5
  51. package/lib/plugins/vast-ads/roll.d.ts +2 -2
  52. package/lib/plugins/vast-ads/roll.d.ts.map +1 -1
  53. package/lib/plugins/vast-ads/roll.js +16 -10
  54. package/lib/plugins/vast-ads/rollmanager.d.ts.map +1 -1
  55. package/lib/plugins/vast-ads/rollmanager.js +17 -7
  56. package/lib/plugins/vast-ads/sctemanager.d.ts +1 -1
  57. package/lib/plugins/vast-ads/sctemanager.d.ts.map +1 -1
  58. package/lib/plugins/vast-ads/sctemanager.js +6 -5
  59. package/lib/plugins/vast-ads/types.d.ts.map +1 -1
  60. package/lib/plugins/vast-ads/urlhandler.d.ts.map +1 -1
  61. package/lib/plugins/vast-ads/xmlhttprequest.d.ts.map +1 -1
  62. package/lib/plugins/vast-ads/xmlhttprequest.js +3 -2
  63. package/lib/plugins/vast-ads/xmlmerge.d.ts.map +1 -1
  64. package/lib/plugins/vast-ads/xmlmerge.js +4 -3
  65. package/lib/types.d.ts +1 -1
  66. package/lib/types.d.ts.map +1 -1
  67. package/lib/utils/clickaway.d.ts.map +1 -1
  68. package/lib/utils/mediaSources.d.ts.map +1 -1
  69. package/lib/utils/mediaSources.js +1 -3
  70. package/lib/utils/types.d.ts.map +1 -1
  71. package/lib/version.js +2 -2
  72. package/package.json +2 -2
  73. package/src/Player.ts +10 -10
  74. package/src/__tests__/Player.test.ts +33 -10
  75. package/src/index.core.ts +9 -1
  76. package/src/index.plugins.ts +35 -35
  77. package/src/playback/BasePlayback.ts +1 -1
  78. package/src/playback/__tests__/HTML5Video.test.ts +10 -4
  79. package/src/playback/dash-playback/__tests__/DashPlayback.test.ts +10 -38
  80. package/src/playback/hls-playback/__tests__/HlsPlayback.test.ts +12 -45
  81. package/src/playback/types.ts +0 -1
  82. package/src/playback.types.ts +1 -2
  83. package/src/plugins/audio-selector/AudioTracks.ts +1 -1
  84. package/src/plugins/audio-selector/__tests__/AudioTracks.test.ts +30 -11
  85. package/src/plugins/bottom-gear/BottomGear.ts +3 -2
  86. package/src/plugins/clappr-nerd-stats/NerdStats.ts +1 -1
  87. package/src/plugins/clappr-nerd-stats/speedtest/index.ts +104 -82
  88. package/src/plugins/clappr-nerd-stats/speedtest/types.ts +3 -3
  89. package/src/plugins/clappr-nerd-stats/utils.ts +2 -2
  90. package/src/plugins/clappr-stats/__tests__/ClapprStats.test.ts +30 -18
  91. package/src/plugins/clips/utils.ts +5 -1
  92. package/src/plugins/cmcd-config/CmcdConfig.ts +1 -1
  93. package/src/plugins/error-screen/__tests__/ErrorScreen.test.ts +21 -15
  94. package/src/plugins/favicon/Favicon.ts +73 -49
  95. package/src/plugins/google-analytics/GoogleAnalytics.ts +93 -58
  96. package/src/plugins/kibo/index.ts +183 -109
  97. package/src/plugins/level-selector/QualityLevels.ts +2 -2
  98. package/src/plugins/logo/Logo.ts +134 -105
  99. package/src/plugins/logo/utils/index.ts +27 -20
  100. package/src/plugins/media-control/MediaControl.ts +12 -6
  101. package/src/plugins/multi-camera/MultiCamera.ts +218 -157
  102. package/src/plugins/picture-in-picture/PictureInPicture.ts +41 -37
  103. package/src/plugins/playback-rate/__tests__/PlaybackRate.test.ts +25 -11
  104. package/src/plugins/poster/__tests__/Poster.test.ts +8 -9
  105. package/src/plugins/share/Share.ts +85 -60
  106. package/src/plugins/skip-time/SkipTime.ts +5 -1
  107. package/src/plugins/spinner-three-bounce/SpinnerThreeBounce.ts +8 -5
  108. package/src/plugins/subtitles/ClosedCaptions.ts +7 -5
  109. package/src/plugins/subtitles/__tests__/ClosedCaptions.test.ts +0 -1
  110. package/src/plugins/thumbnails/Thumbnails.ts +22 -21
  111. package/src/plugins/thumbnails/__tests__/Thumbnails.test.ts +14 -7
  112. package/src/plugins/thumbnails/utils.ts +3 -1
  113. package/src/plugins/typings/globals.d.ts +7 -7
  114. package/src/plugins/typings/workers.d.ts +3 -3
  115. package/src/plugins/utils/fullscreen.ts +2 -2
  116. package/src/plugins/utils.ts +17 -13
  117. package/src/plugins/vast-ads/VastAds.ts +4 -5
  118. package/src/plugins/vast-ads/loaderxml.ts +142 -101
  119. package/src/plugins/vast-ads/roll.ts +381 -284
  120. package/src/plugins/vast-ads/rollmanager.ts +214 -170
  121. package/src/plugins/vast-ads/sctemanager.ts +66 -48
  122. package/src/plugins/vast-ads/types.ts +15 -9
  123. package/src/plugins/vast-ads/urlhandler.ts +18 -13
  124. package/src/plugins/vast-ads/xmlhttprequest.ts +25 -20
  125. package/src/plugins/vast-ads/xmlmerge.ts +42 -32
  126. package/src/plugins/video360/VRControls.js +50 -42
  127. package/src/plugins/video360/VREffect.js +298 -206
  128. package/src/plugins/video360/Video360.js +553 -423
  129. package/src/plugins/video360/orbit-oriention-controls.js +526 -421
  130. package/src/plugins/video360/utils.js +18 -18
  131. package/src/types.ts +5 -3
  132. package/src/typings/@clappr/core/error_mixin.d.ts +9 -9
  133. package/src/typings/@clappr/core/index.d.ts +1 -3
  134. package/src/typings/@clappr/core/playback.d.ts +3 -3
  135. package/src/typings/@clappr/index.d.ts +1 -1
  136. package/src/typings/globals.d.ts +15 -15
  137. package/src/utils/__tests__/mediaSources.test.ts +42 -26
  138. package/src/utils/clickaway.ts +24 -24
  139. package/src/utils/errors.ts +2 -2
  140. package/src/utils/mediaSources.ts +5 -4
  141. package/src/utils/types.ts +1 -1
  142. package/src/version.ts +2 -2
  143. package/tsconfig.tsbuildinfo +1 -1
@@ -1,11 +1,11 @@
1
1
  // check if the browser supports cors
2
- export const corsSupport = (function() {
3
- const video = document.createElement('video');
2
+ export const corsSupport = (function () {
3
+ const video = document.createElement('video')
4
4
 
5
- video.crossOrigin = 'anonymous';
5
+ video.crossOrigin = 'anonymous'
6
6
 
7
- return video.hasAttribute('crossorigin');
8
- })();
7
+ return video.hasAttribute('crossorigin')
8
+ })()
9
9
 
10
10
  export const validProjections = [
11
11
  '360',
@@ -19,31 +19,31 @@ export const validProjections = [
19
19
  'Sphere',
20
20
  'Cube',
21
21
  'equirectangular',
22
- '180'
23
- ];
22
+ '180',
23
+ ]
24
24
 
25
- export const getInternalProjectionName = function(projection) {
25
+ export const getInternalProjectionName = function (projection) {
26
26
  if (!projection) {
27
- return;
27
+ return
28
28
  }
29
29
 
30
- projection = projection.toString().trim();
30
+ projection = projection.toString().trim()
31
31
 
32
- if ((/sphere/i).test(projection)) {
33
- return '360';
32
+ if (/sphere/i.test(projection)) {
33
+ return '360'
34
34
  }
35
35
 
36
- if ((/cube/i).test(projection)) {
37
- return '360_CUBE';
36
+ if (/cube/i.test(projection)) {
37
+ return '360_CUBE'
38
38
  }
39
39
 
40
- if ((/equirectangular/i).test(projection)) {
41
- return '360';
40
+ if (/equirectangular/i.test(projection)) {
41
+ return '360'
42
42
  }
43
43
 
44
44
  for (let i = 0; i < validProjections.length; i++) {
45
45
  if (new RegExp('^' + validProjections[i] + '$', 'i').test(projection)) {
46
- return validProjections[i];
46
+ return validProjections[i]
47
47
  }
48
48
  }
49
- };
49
+ }
package/src/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $, Container, Core } from "@clappr/core";
1
+ import { $, Container, Core } from '@clappr/core'
2
2
 
3
3
  /**
4
4
  * Describes a media source with its MIME type and URL.
@@ -63,7 +63,9 @@ export type PlayerPlugin = {
63
63
  /**
64
64
  * @public
65
65
  */
66
- export type PlayerPluginConstructor = CorePluginConstructor | ContainerPluginConstructor
66
+ export type PlayerPluginConstructor =
67
+ | CorePluginConstructor
68
+ | ContainerPluginConstructor
67
69
 
68
70
  /**
69
71
  * @public
@@ -302,4 +304,4 @@ export enum PlayerEvent {
302
304
  * {@link https://zeptojs.com/#$() | Zepto query result}
303
305
  * @public
304
306
  */
305
- export type ZeptoResult = ReturnType<typeof $>;
307
+ export type ZeptoResult = ReturnType<typeof $>
@@ -1,13 +1,13 @@
1
- import '@clappr/core';
1
+ import '@clappr/core'
2
2
 
3
- declare module "@clappr/core" {
4
- // export ErrorMixin;
3
+ declare module '@clappr/core' {
4
+ // export ErrorMixin;
5
5
 
6
- type ErrorOptions = {
7
- useCodePrefix: boolean;
8
- }
6
+ type ErrorOptions = {
7
+ useCodePrefix: boolean
8
+ }
9
9
 
10
- declare interface ErrorMixin {
11
- createError(error: Object, options?: ErrorOptions): Error;
12
- }
10
+ declare interface ErrorMixin {
11
+ createError(error: object, options?: ErrorOptions): Error
12
+ }
13
13
  }
@@ -1,5 +1,3 @@
1
1
  import '@clappr/core'
2
2
 
3
- declare module '@clappr/core' {
4
-
5
- }
3
+ declare module '@clappr/core' {}
@@ -1,5 +1,5 @@
1
- import '@clappr/core';
1
+ import '@clappr/core'
2
2
 
3
- declare module "@clappr/core" {
4
- declare interface Playback extends ErrorMixin { }
3
+ declare module '@clappr/core' {
4
+ declare interface Playback extends ErrorMixin {}
5
5
  }
@@ -1 +1 @@
1
- declare module '@clappr' {}
1
+ declare module '@clappr' {}
@@ -1,27 +1,27 @@
1
1
  declare interface HTMLVideoElement {
2
- webkitDisplayingFullscreen?: boolean;
2
+ webkitDisplayingFullscreen?: boolean
3
3
  }
4
4
 
5
5
  declare interface HTMLMediaElement {
6
- audioTracks?: AudioTrackList;
6
+ audioTracks?: AudioTrackList
7
7
  }
8
8
 
9
9
  declare interface AudioTrackW3C {
10
- readonly id: string;
11
- enabled: boolean;
12
- readonly kind: string;
13
- readonly label: string;
14
- readonly language: string;
15
- readonly sourceBuffer: SourceBuffer | null;
10
+ readonly id: string
11
+ enabled: boolean
12
+ readonly kind: string
13
+ readonly label: string
14
+ readonly language: string
15
+ readonly sourceBuffer: SourceBuffer | null
16
16
  }
17
17
 
18
18
  declare interface AudioTrackList {
19
- getTrackById(id: string): AudioTrackW3C | null;
20
- length: number;
21
- [index: number]: AudioTrackW3C;
19
+ getTrackById(id: string): AudioTrackW3C | null
20
+ length: number
21
+ [index: number]: AudioTrackW3C
22
22
  }
23
23
 
24
- declare module "*.css";
25
- declare module "*.scss";
26
- declare module "*.svg";
27
- declare module "*.ejs";
24
+ declare module '*.css'
25
+ declare module '*.scss'
26
+ declare module '*.svg'
27
+ declare module '*.ejs'
@@ -1,7 +1,11 @@
1
1
  import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
2
2
  import { Loader } from '@clappr/core'
3
3
 
4
- import { isDashSource, isHlsSource, buildMediaSourcesList } from '../mediaSources'
4
+ import {
5
+ isDashSource,
6
+ isHlsSource,
7
+ buildMediaSourcesList,
8
+ } from '../mediaSources'
5
9
  import { TransportPreference } from '../../types'
6
10
  import { canPlayDash, canPlayHls } from '../../playback/index'
7
11
 
@@ -11,10 +15,13 @@ vi.mock('@clappr/core', () => ({
11
15
  {
12
16
  _supported: true,
13
17
  prototype: {
14
- name: 'dash',
18
+ name: 'dash',
15
19
  },
16
20
  canPlay(source, mimeType) {
17
- return this._supported && (mimeType === 'application/dash+xml' || source.endsWith('.mpd'))
21
+ return (
22
+ this._supported &&
23
+ (mimeType === 'application/dash+xml' || source.endsWith('.mpd'))
24
+ )
18
25
  },
19
26
  },
20
27
  {
@@ -23,7 +30,14 @@ vi.mock('@clappr/core', () => ({
23
30
  name: 'hls',
24
31
  },
25
32
  canPlay(source, mimeType) {
26
- return this._supported && (['application/vnd.apple.mpegurl', 'application/x-mpegurl'].includes(mimeType) || source.endsWith('.m3u8'))
33
+ return (
34
+ this._supported &&
35
+ ([
36
+ 'application/vnd.apple.mpegurl',
37
+ 'application/x-mpegurl',
38
+ ].includes(mimeType) ||
39
+ source.endsWith('.m3u8'))
40
+ )
27
41
  },
28
42
  },
29
43
  {
@@ -199,28 +213,30 @@ describe('mediaSources', () => {
199
213
  mimeType: 'application/dash+xml',
200
214
  },
201
215
  ],
202
- ],
203
216
  ],
204
- )('prefer %s, dash=%s,hls=%s', (preference, dash, hls, sources, expected) => {
205
- beforeEach(() => {
206
- if (!dash) {
207
- Loader.registeredPlaybacks[0]._supported = false
208
- }
209
- if (!hls) {
210
- Loader.registeredPlaybacks[1]._supported = false
211
- }
212
- })
213
- afterEach(() => {
214
- Loader.registeredPlaybacks[0]._supported = true
215
- Loader.registeredPlaybacks[1]._supported = true
216
- })
217
- it('should build the ordered list of available sources', () => {
218
- const ordered = buildMediaSourcesList(
219
- sources,
220
- preference as TransportPreference,
221
- )
222
- expect(ordered).toEqual(expect.objectContaining(expected))
223
- })
224
- })
217
+ ])(
218
+ 'prefer %s, dash=%s,hls=%s',
219
+ (preference, dash, hls, sources, expected) => {
220
+ beforeEach(() => {
221
+ if (!dash) {
222
+ Loader.registeredPlaybacks[0]._supported = false
223
+ }
224
+ if (!hls) {
225
+ Loader.registeredPlaybacks[1]._supported = false
226
+ }
227
+ })
228
+ afterEach(() => {
229
+ Loader.registeredPlaybacks[0]._supported = true
230
+ Loader.registeredPlaybacks[1]._supported = true
231
+ })
232
+ it('should build the ordered list of available sources', () => {
233
+ const ordered = buildMediaSourcesList(
234
+ sources,
235
+ preference as TransportPreference,
236
+ )
237
+ expect(ordered).toEqual(expect.objectContaining(expected))
238
+ })
239
+ },
240
+ )
225
241
  })
226
242
  })
@@ -1,43 +1,43 @@
1
1
  import { Browser } from '@clappr/core'
2
2
 
3
3
  /**
4
- *
4
+ *
5
5
  * @param {() => void} callback - The callback to call when the user clicks away from the element
6
6
  * @returns {(HTMLElement | null) => void}
7
7
  */
8
8
  export function clickaway(callback: () => void) {
9
- let handler = (event: MouseEvent | TouchEvent) => { }
9
+ let handler = (event: MouseEvent | TouchEvent) => {}
10
10
 
11
- return (node: HTMLElement | null) => {
11
+ return (node: HTMLElement | null) => {
12
+ window.removeEventListener('click', handler)
13
+ if (!node) {
14
+ return
15
+ }
16
+ handler = (event: MouseEvent | TouchEvent) => {
17
+ if (!node.contains(event.target as Node)) {
12
18
  window.removeEventListener('click', handler)
13
- if (!node) {
14
- return
15
- }
16
- handler = (event: MouseEvent | TouchEvent) => {
17
- if (!node.contains(event.target as Node)) {
18
- window.removeEventListener('click', handler)
19
- callback()
20
- }
21
- }
22
- window.addEventListener('click', handler)
19
+ callback()
20
+ }
23
21
  }
22
+ window.addEventListener('click', handler)
23
+ }
24
24
  }
25
25
 
26
26
  /**
27
27
  * Sets up a clickaway handler for the media control on mobile devices.
28
28
  * The handler is deferred to ensure it is called after the next event loop tick.
29
- *
29
+ *
30
30
  * @param {() => void} callback - The callback to call when the user clicks away from the media control
31
31
  * @returns {(HTMLElement | null) => void}
32
32
  */
33
33
  export function mediaControlClickaway(callback: () => void) {
34
- if (!Browser.isMobile) {
35
- return () => { }
36
- }
37
- const cw = clickaway(callback)
38
- return (node: HTMLElement | null) => {
39
- setTimeout(() => {
40
- cw(node)
41
- }, 0)
42
- }
43
- }
34
+ if (!Browser.isMobile) {
35
+ return () => {}
36
+ }
37
+ const cw = clickaway(callback)
38
+ return (node: HTMLElement | null) => {
39
+ setTimeout(() => {
40
+ cw(node)
41
+ }, 0)
42
+ }
43
+ }
@@ -1,6 +1,6 @@
1
1
  export function wrapError(error: any): Error {
2
2
  if (error instanceof Error) {
3
- return error;
3
+ return error
4
4
  }
5
- return new Error(String(error));
5
+ return new Error(String(error))
6
6
  }
@@ -19,11 +19,12 @@ export function buildMediaSourcesList(
19
19
  })
20
20
  }
21
21
  const [preferred, rest] = sources.reduce(
22
- ([preferred, rest]: [PlayerMediaSourceDesc[], PlayerMediaSourceDesc[]], item: PlayerMediaSourceDesc): [PlayerMediaSourceDesc[], PlayerMediaSourceDesc[]] => {
22
+ (
23
+ [preferred, rest]: [PlayerMediaSourceDesc[], PlayerMediaSourceDesc[]],
24
+ item: PlayerMediaSourceDesc,
25
+ ): [PlayerMediaSourceDesc[], PlayerMediaSourceDesc[]] => {
23
26
  for (const p of playbacks) {
24
- if ([
25
- 'html5_audio', 'html_img', 'no_op'
26
- ].includes(p.prototype.name)) {
27
+ if (['html5_audio', 'html_img', 'no_op'].includes(p.prototype.name)) {
27
28
  continue
28
29
  }
29
30
  const canPlay = p.canPlay(item.source, item.mimeType)
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * @internal
3
3
  */
4
- export type TimerId = ReturnType<typeof setTimeout>;
4
+ export type TimerId = ReturnType<typeof setTimeout>
package/src/version.ts CHANGED
@@ -1,5 +1,5 @@
1
- import * as pkg from '../package.json' with { "type": "json" };
2
- import * as lock from '../package-lock.json' with { "type": "json" };
1
+ import * as pkg from '../package.json' with { type: 'json' }
2
+ import * as lock from '../package-lock.json' with { type: 'json' }
3
3
 
4
4
  /**
5
5
  * Version information about the gplayer and its main dependencies