@gcorevideo/player 2.24.0 → 2.24.1

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.
@@ -1,5 +1,7 @@
1
- import { CorePlugin, Events, } from '@clappr/core';
2
- import { generateContentId, generateSessionId } from './utils';
1
+ import { $, CorePlugin, Events } from '@clappr/core';
2
+ // import { trace } from '@gcorevideo/utils'
3
+ import { generateSessionId } from './utils';
4
+ import { CLAPPR_VERSION } from '../../build.js';
3
5
  const CMCD_KEYS = [
4
6
  'br',
5
7
  'd',
@@ -20,6 +22,7 @@ const CMCD_KEYS = [
20
22
  'st',
21
23
  'v',
22
24
  ];
25
+ // const T = 'plugins.cmcd'
23
26
  /**
24
27
  * A `PLUGIN` that configures CMCD for playback
25
28
  * @beta
@@ -36,56 +39,62 @@ export class CmcdConfig extends CorePlugin {
36
39
  get name() {
37
40
  return 'cmcd';
38
41
  }
42
+ get version() {
43
+ return '0.1.0';
44
+ }
45
+ get supportedVersion() {
46
+ return CLAPPR_VERSION;
47
+ }
39
48
  constructor(core) {
40
49
  super(core);
41
50
  this.sid = this.options.cmcd?.sessionId ?? generateSessionId();
51
+ this.cid = this.options.cmcd?.contentId ?? this.generateContentId();
42
52
  }
43
53
  /**
44
54
  * @inheritdocs
45
55
  */
46
56
  bindEvents() {
47
- this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, () => this.updateSettings());
57
+ this.listenTo(this.core, Events.CORE_CONTAINERS_CREATED, () => this.updateSettings(this.core.containers[0]));
48
58
  }
49
- async getIds() {
59
+ exportIds() {
50
60
  return {
51
61
  sid: this.sid,
52
- cid: await this.ensureContentId(),
62
+ cid: this.cid,
53
63
  };
54
64
  }
55
- updateSettings() {
56
- switch (this.core.activeContainer.playback.name) {
65
+ async updateSettings(container) {
66
+ switch (container.playback.name) {
57
67
  case 'dash':
58
- this.updateDashjsSettings();
68
+ $.extend(true, container.playback.options, {
69
+ dash: {
70
+ cmcd: {
71
+ enabled: true,
72
+ enabledKeys: CMCD_KEYS,
73
+ sid: this.sid,
74
+ cid: this.cid,
75
+ },
76
+ },
77
+ });
59
78
  break;
60
79
  case 'hls':
61
- this.updateHlsjsSettings();
80
+ $.extend(true, container.playback.options, {
81
+ playback: {
82
+ hlsjsConfig: {
83
+ cmcd: {
84
+ includeKeys: CMCD_KEYS,
85
+ sessionId: this.sid,
86
+ contentId: this.cid,
87
+ },
88
+ },
89
+ },
90
+ });
62
91
  break;
63
92
  }
64
93
  }
65
- async updateDashjsSettings() {
66
- const { cid, sid } = await this.getIds();
67
- const options = this.core.activePlayback.options;
68
- this.core.activePlayback.options = {
69
- ...options,
70
- dash: {
71
- ...(options.dash ?? {}),
72
- cmcd: {
73
- enabled: true,
74
- enabledKeys: CMCD_KEYS,
75
- sid,
76
- cid,
77
- },
78
- },
79
- };
80
- }
81
- async updateHlsjsSettings() {
82
- const { cid, sid } = await this.getIds();
83
- const options = this.core.activePlayback.options;
84
- this.core.activePlayback.options = {
85
- ...options,
94
+ updateHlsjsSettings(options, { cid, sid }) {
95
+ $.extend(true, options, {
86
96
  playback: {
87
97
  hlsjsConfig: {
88
- ...(options.playback?.hlsjsConfig ?? {}),
89
98
  cmcd: {
90
99
  includeKeys: CMCD_KEYS,
91
100
  sessionId: sid,
@@ -93,22 +102,9 @@ export class CmcdConfig extends CorePlugin {
93
102
  },
94
103
  },
95
104
  },
96
- };
97
- }
98
- async ensureContentId() {
99
- if (!this.cid) {
100
- this.cid = await this.evalContentId();
101
- }
102
- return this.cid;
105
+ });
103
106
  }
104
- async evalContentId() {
105
- if (!this.core.activeContainer.options.cmcd?.contentId) {
106
- return generateContentId(this.core.activePlayback.options.src);
107
- }
108
- const contentId = this.core.activeContainer.options.cmcd.contentId;
109
- if (typeof contentId === 'string') {
110
- return contentId;
111
- }
112
- return Promise.resolve(contentId(this.core.activePlayback.options.src));
107
+ generateContentId() {
108
+ return new URL(this.core.options.source ?? this.core.options.sources[0].source).pathname.slice(0, 64);
113
109
  }
114
110
  }
@@ -1,3 +1,2 @@
1
1
  export declare function generateSessionId(): string;
2
- export declare function generateContentId(sourceUrl: string): Promise<string>;
3
2
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/plugins/cmcd-config/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQpE"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/plugins/cmcd-config/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C"}
@@ -1,12 +1,3 @@
1
1
  export function generateSessionId() {
2
2
  return window.crypto.randomUUID();
3
3
  }
4
- export function generateContentId(sourceUrl) {
5
- return window.crypto.subtle.digest('SHA-1', new TextEncoder().encode(sourceUrl))
6
- .then(buffer => {
7
- const hex = Array.from(new Uint8Array(buffer))
8
- .map(b => b.toString(16).padStart(2, '0'))
9
- .join('');
10
- return hex;
11
- });
12
- }
@@ -5,6 +5,7 @@ export declare function createMockCore(options?: Record<string, unknown>, contai
5
5
  $el: any;
6
6
  activePlayback: any;
7
7
  activeContainer: any;
8
+ containers: any[];
8
9
  i18n: {
9
10
  t: import("vitest").Mock<(...args: any[]) => any>;
10
11
  };
@@ -1 +1 @@
1
- {"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,YAAY,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,MAAM,MAAM,eAAe,CAAA;AAGlC,wBAAgB,cAAc,CAC5B,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,SAAS,GAAE,GAAkC;;;;;;;;;;;;;;;;EAqB9C;AAED,wBAAgB,gBAAgB;;;EAK/B;AAED,wBAAgB,mBAAmB;;;;;;EAKlC;AAED,wBAAgB,kBAAkB,CAAC,IAAI,SAAS,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCtF;AAED,wBAAgB,mBAAmB,CACjC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,QAAQ,GAAE,GAAgD;;;;;;;;;;;;;;;;;;;;;;;;EA6B3D;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,GAAG,gBAiB/C;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,GAAG,OAe7C"}
1
+ {"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,YAAY,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,MAAM,MAAM,eAAe,CAAA;AAGlC,wBAAgB,cAAc,CAC5B,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,SAAS,GAAE,GAAkC;;;;;;;;;;;;;;;;;EAsB9C;AAED,wBAAgB,gBAAgB;;;EAK/B;AAED,wBAAgB,mBAAmB;;;;;;EAKlC;AAED,wBAAgB,kBAAkB,CAAC,IAAI,SAAS,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCtF;AAED,wBAAgB,mBAAmB,CACjC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,QAAQ,GAAE,GAAgD;;;;;;;;;;;;;;;;;;;;;;;;EA6B3D;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,GAAG,gBAiB/C;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,GAAG,OAe7C"}
package/lib/testUtils.js CHANGED
@@ -9,6 +9,7 @@ export function createMockCore(options = {}, container = createMockContainer(opt
9
9
  $el: $(el),
10
10
  activePlayback: container.playback,
11
11
  activeContainer: container,
12
+ containers: [container],
12
13
  i18n: {
13
14
  t: vi.fn().mockImplementation((key) => key),
14
15
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gcorevideo/player",
3
- "version": "2.24.0",
3
+ "version": "2.24.1",
4
4
  "description": "Gcore JavaScript video player",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -1,10 +1,10 @@
1
- import {
2
- Core,
3
- CorePlugin,
4
- Events,
5
- } from '@clappr/core'
1
+ import { $, Container, Core, CorePlugin, Events } from '@clappr/core'
6
2
 
7
- import { generateContentId, generateSessionId } from './utils'
3
+ // import { trace } from '@gcorevideo/utils'
4
+
5
+ import { generateSessionId } from './utils'
6
+ import { CLAPPR_VERSION } from '../../build.js'
7
+ import { CoreOptions } from 'src/internal.types'
8
8
 
9
9
  const CMCD_KEYS = [
10
10
  'br',
@@ -36,12 +36,14 @@ export type CmcdConfigPluginSettings = {
36
36
  */
37
37
  sessionId: string
38
38
  /**
39
- * Content ID, either constant or derived from current source.
40
- * If ommitted, a SHA-1 hash of current source URL will be used
39
+ * Content ID,
40
+ * If ommitted, the pathname part of the first source URL will be used
41
41
  */
42
- contentId?: string | ((sourceUrl: string, mimeType?: string) => (string | Promise<string>))
42
+ contentId?: string
43
43
  }
44
44
 
45
+ // const T = 'plugins.cmcd'
46
+
45
47
  /**
46
48
  * A `PLUGIN` that configures CMCD for playback
47
49
  * @beta
@@ -61,63 +63,73 @@ export class CmcdConfig extends CorePlugin {
61
63
  return 'cmcd'
62
64
  }
63
65
 
66
+ get version() {
67
+ return '0.1.0'
68
+ }
69
+
70
+ get supportedVersion() {
71
+ return CLAPPR_VERSION
72
+ }
73
+
64
74
  constructor(core: Core) {
65
75
  super(core)
66
76
  this.sid = this.options.cmcd?.sessionId ?? generateSessionId()
77
+ this.cid = this.options.cmcd?.contentId ?? this.generateContentId()
67
78
  }
68
79
 
69
80
  /**
70
81
  * @inheritdocs
71
82
  */
72
83
  override bindEvents() {
73
- this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, () =>
74
- this.updateSettings(),
84
+ this.listenTo(this.core, Events.CORE_CONTAINERS_CREATED, () =>
85
+ this.updateSettings(this.core.containers[0]),
75
86
  )
76
87
  }
77
88
 
78
- async getIds(): Promise<{ sid: string; cid: string }> {
89
+ exportIds(): { sid: string; cid: string } {
79
90
  return {
80
91
  sid: this.sid,
81
- cid: await this.ensureContentId(),
92
+ cid: this.cid,
82
93
  }
83
94
  }
84
95
 
85
- private updateSettings() {
86
- switch (this.core.activeContainer.playback.name) {
96
+ private async updateSettings(container: Container) {
97
+ switch (container.playback.name) {
87
98
  case 'dash':
88
- this.updateDashjsSettings()
99
+ $.extend(true, container.playback.options, {
100
+ dash: {
101
+ cmcd: {
102
+ enabled: true,
103
+ enabledKeys: CMCD_KEYS,
104
+ sid: this.sid,
105
+ cid: this.cid,
106
+ },
107
+ },
108
+ })
89
109
  break
90
110
  case 'hls':
91
- this.updateHlsjsSettings()
111
+ $.extend(true, container.playback.options, {
112
+ playback: {
113
+ hlsjsConfig: {
114
+ cmcd: {
115
+ includeKeys: CMCD_KEYS,
116
+ sessionId: this.sid,
117
+ contentId: this.cid,
118
+ },
119
+ },
120
+ },
121
+ })
92
122
  break
93
123
  }
94
124
  }
95
125
 
96
- private async updateDashjsSettings() {
97
- const {cid, sid} = await this.getIds()
98
- const options = this.core.activePlayback.options
99
- this.core.activePlayback.options = {
100
- ...options,
101
- dash: {
102
- ...(options.dash ?? {}),
103
- cmcd: {
104
- enabled: true,
105
- enabledKeys: CMCD_KEYS,
106
- sid,
107
- cid,
108
- },
109
- },
110
- }
111
- }
112
-
113
- private async updateHlsjsSettings() {
114
- const { cid, sid } = await this.getIds()
115
- const options = this.core.activePlayback.options
116
- this.core.activePlayback.options = {
117
- ...options,
126
+ private updateHlsjsSettings(
127
+ options: CoreOptions,
128
+ { cid, sid }: { cid: string; sid: string },
129
+ ) {
130
+ $.extend(true, options, {
118
131
  playback: {
119
132
  hlsjsConfig: {
120
- ...(options.playback?.hlsjsConfig ?? {}),
121
133
  cmcd: {
122
134
  includeKeys: CMCD_KEYS,
123
135
  sessionId: sid,
@@ -125,24 +137,12 @@ export class CmcdConfig extends CorePlugin {
125
137
  },
126
138
  },
127
139
  },
128
- }
140
+ })
129
141
  }
130
142
 
131
- private async ensureContentId(): Promise<string> {
132
- if (!this.cid) {
133
- this.cid = await this.evalContentId()
134
- }
135
- return this.cid
136
- }
137
-
138
- private async evalContentId(): Promise<string> {
139
- if (!this.core.activeContainer.options.cmcd?.contentId) {
140
- return generateContentId(this.core.activePlayback.options.src)
141
- }
142
- const contentId = this.core.activeContainer.options.cmcd.contentId
143
- if (typeof contentId === 'string') {
144
- return contentId
145
- }
146
- return Promise.resolve(contentId(this.core.activePlayback.options.src))
143
+ private generateContentId() {
144
+ return new URL(
145
+ this.core.options.source ?? this.core.options.sources[0].source,
146
+ ).pathname.slice(0, 64)
147
147
  }
148
148
  }
@@ -3,13 +3,9 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'
3
3
  import { CmcdConfig } from '../CmcdConfig'
4
4
  import { createMockCore } from '../../../testUtils'
5
5
  import { Events } from '@clappr/core'
6
- import { generateContentId } from '../utils'
7
-
8
- import { createHash } from 'node:crypto'
9
6
 
10
7
  vi.mock('../utils', () => ({
11
8
  generateSessionId: vi.fn().mockReturnValue('123'),
12
- generateContentId: vi.fn().mockResolvedValue('deadbeef'),
13
9
  }))
14
10
 
15
11
  const CMCD_KEYS = [
@@ -38,69 +34,78 @@ describe('CmcdConfig', () => {
38
34
  let plugin: CmcdConfig
39
35
  describe('basically', () => {
40
36
  beforeEach(() => {
41
- core = createMockCore({})
37
+ core = createMockCore({
38
+ sources: [
39
+ {
40
+ source: 'https://zulu.com/123.mpd',
41
+ mimeType: 'application/dash+xml',
42
+ },
43
+ ],
44
+ })
42
45
  })
43
- describe('when active container is changed', () => {
46
+ describe('when container is created', () => {
44
47
  describe('dash.js', () => {
45
48
  beforeEach(async () => {
46
- core.activeContainer.playback.name = 'dash'
47
- core.activeContainer.playback.options.src = 'https://123.mpd'
49
+ core.containers[0].playback.name = 'dash'
48
50
  plugin = new CmcdConfig(core)
49
- core.trigger(Events.CORE_ACTIVE_CONTAINER_CHANGED)
50
- await new Promise(resolve => setTimeout(resolve, 0))
51
+ core.trigger(Events.CORE_CONTAINERS_CREATED)
52
+ await new Promise((resolve) => setTimeout(resolve, 0))
51
53
  })
52
54
  it('should update DASH.js CMCD settings', () => {
53
- expect(core.activePlayback.options).toEqual(expect.objectContaining({
54
- dash: expect.objectContaining({
55
- cmcd: expect.objectContaining({
56
- enabled: true,
57
- enabledKeys: CMCD_KEYS,
58
- })
59
- })
60
- }))
55
+ expect(core.containers[0].playback.options).toEqual(
56
+ expect.objectContaining({
57
+ dash: expect.objectContaining({
58
+ cmcd: expect.objectContaining({
59
+ enabled: true,
60
+ enabledKeys: CMCD_KEYS,
61
+ }),
62
+ }),
63
+ }),
64
+ )
61
65
  })
62
66
  it('should generate unique session ID', () => {
63
- expect(core.activePlayback.options).toEqual(expect.objectContaining({
64
- dash: expect.objectContaining({
65
- cmcd: expect.objectContaining({
66
- sid: '123',
67
- })
68
- })
69
- }))
67
+ expect(core.containers[0].playback.options).toEqual(
68
+ expect.objectContaining({
69
+ dash: expect.objectContaining({
70
+ cmcd: expect.objectContaining({
71
+ sid: '123',
72
+ }),
73
+ }),
74
+ }),
75
+ )
70
76
  })
71
77
  it('should compute content ID from source URL', () => {
72
- expect(generateContentId).toHaveBeenCalledWith('https://123.mpd')
73
- expect(core.activePlayback.options).toEqual(expect.objectContaining({
74
- dash: expect.objectContaining({
75
- cmcd: expect.objectContaining({
76
- cid: 'deadbeef',
77
- })
78
- })
79
- }))
78
+ expect(core.containers[0].playback.options).toEqual(
79
+ expect.objectContaining({
80
+ dash: expect.objectContaining({
81
+ cmcd: expect.objectContaining({
82
+ cid: '/123.mpd',
83
+ }),
84
+ }),
85
+ }),
86
+ )
80
87
  })
81
88
  })
82
89
  describe('hls.js', () => {
83
90
  beforeEach(async () => {
84
- core.activeContainer.playback.name = 'hls'
85
- core.activeContainer.playback.options.src = 'https://123.m3u8'
91
+ core.containers[0].playback.name = 'hls'
86
92
  plugin = new CmcdConfig(core)
87
- await new Promise(resolve => setTimeout(resolve, 0))
88
- core.trigger(Events.CORE_ACTIVE_CONTAINER_CHANGED)
89
- await new Promise(resolve => setTimeout(resolve, 0))
93
+ core.trigger(Events.CORE_CONTAINERS_CREATED)
90
94
  })
91
95
  it('should update HLS.js CMCD settings', () => {
92
- expect(core.activePlayback.options).toEqual(expect.objectContaining({
93
- playback: expect.objectContaining({
94
- hlsjsConfig: expect.objectContaining({
95
- cmcd: expect.objectContaining({
96
- includeKeys: CMCD_KEYS,
97
- contentId: 'deadbeef',
98
- sessionId: '123',
99
- })
100
- })
101
- })
102
- }))
103
- expect(generateContentId).toHaveBeenCalledWith('https://123.m3u8')
96
+ expect(core.containers[0].playback.options).toEqual(
97
+ expect.objectContaining({
98
+ playback: expect.objectContaining({
99
+ hlsjsConfig: expect.objectContaining({
100
+ cmcd: expect.objectContaining({
101
+ includeKeys: CMCD_KEYS,
102
+ contentId: '/123.mpd',
103
+ sessionId: '123',
104
+ }),
105
+ }),
106
+ }),
107
+ }),
108
+ )
104
109
  })
105
110
  })
106
111
  })
@@ -109,54 +114,61 @@ describe('CmcdConfig', () => {
109
114
  beforeEach(async () => {
110
115
  core = createMockCore({
111
116
  cmcd: {
112
- contentId: (src: string) => new Promise(resolve => {
113
- const h = createHash('sha256')
114
- h.on('readable', () => {
115
- const data = h.read()
116
- if (data) {
117
- resolve(data.toString('hex'))
118
- }
119
- })
120
- h.update(Buffer.from('1$' + src))
121
- h.end()
122
- }),
123
- }
117
+ contentId:
118
+ 'e287ea99b57c09b7a185aaaf36e075f2c0b346ce90aeced72976b1732678a8c6',
119
+ },
120
+ sources: [
121
+ {
122
+ source: 'https://zulu.com/123.mpd',
123
+ mimeType: 'application/dash+xml',
124
+ },
125
+ ],
124
126
  })
125
- core.activePlayback.name = 'dash'
126
- core.activePlayback.options.src = 'https://123.mpd'
127
+ core.containers[0].playback.name = 'dash'
128
+ core.containers[0].playback.options.src = 'https://123.mpd'
127
129
  plugin = new CmcdConfig(core)
128
- core.trigger(Events.CORE_ACTIVE_CONTAINER_CHANGED)
129
- await new Promise(resolve => setTimeout(resolve, 0))
130
+ core.trigger(Events.CORE_CONTAINERS_CREATED)
131
+ await new Promise((resolve) => setTimeout(resolve, 0))
130
132
  })
131
133
  it('should use custom content ID', () => {
132
- expect(core.activePlayback.options).toEqual(expect.objectContaining({
133
- dash: expect.objectContaining({
134
- cmcd: expect.objectContaining({
135
- cid: 'e287ea99b57c09b7a185aaaf36e075f2c0b346ce90aeced72976b1732678a8c6',
136
- })
137
- })
138
- }))
134
+ expect(core.containers[0].playback.options).toEqual(
135
+ expect.objectContaining({
136
+ dash: expect.objectContaining({
137
+ cmcd: expect.objectContaining({
138
+ cid: 'e287ea99b57c09b7a185aaaf36e075f2c0b346ce90aeced72976b1732678a8c6',
139
+ }),
140
+ }),
141
+ }),
142
+ )
139
143
  })
140
144
  })
141
145
  describe('custom session ID', () => {
142
146
  beforeEach(async () => {
143
147
  core = createMockCore({
144
148
  cmcd: { sessionId: '456' },
149
+ sources: [
150
+ {
151
+ source: 'https://zulu.com/123.mpd',
152
+ mimeType: 'application/dash+xml',
153
+ },
154
+ ],
145
155
  })
146
- core.activePlayback.name = 'dash'
147
- core.activePlayback.options.src = 'https://123.mpd'
156
+ core.containers[0].playback.name = 'dash'
157
+ core.containers[0].playback.options.src = 'https://123.mpd'
148
158
  plugin = new CmcdConfig(core)
149
- core.trigger(Events.CORE_ACTIVE_CONTAINER_CHANGED)
150
- await new Promise(resolve => setTimeout(resolve, 0))
159
+ core.trigger(Events.CORE_CONTAINERS_CREATED)
160
+ await new Promise((resolve) => setTimeout(resolve, 0))
151
161
  })
152
162
  it('should use custom session ID', () => {
153
- expect(core.activePlayback.options).toEqual(expect.objectContaining({
154
- dash: expect.objectContaining({
155
- cmcd: expect.objectContaining({
156
- sid: '456',
157
- })
158
- })
159
- }))
163
+ expect(core.containers[0].playback.options).toEqual(
164
+ expect.objectContaining({
165
+ dash: expect.objectContaining({
166
+ cmcd: expect.objectContaining({
167
+ sid: '456',
168
+ }),
169
+ }),
170
+ }),
171
+ )
160
172
  })
161
173
  })
162
174
  })
@@ -1,13 +1,3 @@
1
1
  export function generateSessionId(): string {
2
2
  return window.crypto.randomUUID()
3
3
  }
4
-
5
- export function generateContentId(sourceUrl: string): Promise<string> {
6
- return window.crypto.subtle.digest('SHA-1', new TextEncoder().encode(sourceUrl))
7
- .then(buffer => {
8
- const hex = Array.from(new Uint8Array(buffer))
9
- .map(b => b.toString(16).padStart(2, '0'))
10
- .join('')
11
- return hex
12
- })
13
- }
package/src/testUtils.ts CHANGED
@@ -13,6 +13,7 @@ export function createMockCore(
13
13
  $el: $(el),
14
14
  activePlayback: container.playback,
15
15
  activeContainer: container,
16
+ containers: [container],
16
17
  i18n: {
17
18
  t: vi.fn().mockImplementation((key: string) => key),
18
19
  },