@playkit-js/playkit-js-dual-screen 3.1.5 → 3.1.6-canary.2-b0a1d2f
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.
- package/CHANGELOG.md +4 -0
- package/cypress/e2e/dual-screen.cy.ts +353 -0
- package/cypress/e2e/env.ts +74 -0
- package/cypress/fixtures/100.jpeg +0 -0
- package/cypress/fixtures/640.jpeg +0 -0
- package/cypress/fixtures/base_entry.json +251 -0
- package/cypress/fixtures/cue-points-empty.json +13 -0
- package/cypress/fixtures/cue-points.json +34 -0
- package/cypress/fixtures/dual-screen-0-media.json +9 -0
- package/cypress/fixtures/dual-screen-1-media.json +13 -0
- package/cypress/fixtures/dual-screen-2-media.json +16 -0
- package/cypress/fixtures/thumb-asset.jpeg +0 -0
- package/cypress/fixtures/thumb-url.json +9 -0
- package/cypress/public/index.html +41 -0
- package/cypress/public/media/index.m3u8 +25 -0
- package/cypress/public/media/index_1.m3u8 +25 -0
- package/cypress/public/media/seg-1-a1.ts +0 -0
- package/cypress/public/media/seg-1-v1-a1.ts +0 -0
- package/cypress/public/media/seg-2-a1.ts +0 -0
- package/cypress/public/media/seg-2-v1-a1.ts +0 -0
- package/cypress/public/media/seg-3-a1.ts +0 -0
- package/cypress/public/media/seg-3-v1-a1.ts +0 -0
- package/cypress/public/media/seg-4-a1.ts +0 -0
- package/cypress/public/media/seg-4-v1-a1.ts +0 -0
- package/cypress/public/media/seg-5-a1.ts +0 -0
- package/cypress/public/media/seg-5-v1-a1.ts +0 -0
- package/cypress/public/media/seg-6-a1.ts +0 -0
- package/cypress/public/media/seg-6-v1-a1.ts +0 -0
- package/cypress/public/media/seg-7-a1.ts +0 -0
- package/cypress/public/media/seg-7-v1-a1.ts +0 -0
- package/cypress/public/media/seg-8-a1.ts +0 -0
- package/cypress/public/media/seg-8-v1-a1.ts +0 -0
- package/cypress/public/media/seg-9-a1.ts +0 -0
- package/cypress/public/media/seg-9-v1-a1.ts +0 -0
- package/cypress/public/ui-conf.js +87 -0
- package/cypress.config.ts +10 -0
- package/dist/playkit-dual-screen.js +2 -1
- package/dist/playkit-dual-screen.js.LICENSE.txt +5 -0
- package/dist/playkit-dual-screen.js.map +1 -1
- package/package.json +23 -40
- package/translations/en.i18n.json +2 -1
- package/tsconfig.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [3.1.6-canary.2-b0a1d2f](https://github.com/kaltura/playkit-js-dual-screen/compare/v3.1.5...v3.1.6-canary.2-b0a1d2f) (2023-05-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
5
9
|
### [3.1.5](https://github.com/kaltura/playkit-js-dual-screen/compare/v3.1.4...v3.1.5) (2023-05-15)
|
|
6
10
|
|
|
7
11
|
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import {core} from '@playkit-js/kaltura-player-js';
|
|
3
|
+
import {mockKalturaBe, loadPlayer, MANIFEST, MANIFEST_SAFARI, getPlayer} from './env';
|
|
4
|
+
|
|
5
|
+
const {EventType, FakeEvent, Error} = core;
|
|
6
|
+
|
|
7
|
+
describe('Dual-Screen plugin', () => {
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
// manifest
|
|
10
|
+
cy.intercept('GET', '**/a.m3u8*', Cypress.browser.name === 'webkit' ? MANIFEST_SAFARI : MANIFEST);
|
|
11
|
+
// thumbnails
|
|
12
|
+
cy.intercept('GET', '**/width/164/vid_slices/100', {fixture: '100.jpeg'});
|
|
13
|
+
cy.intercept('GET', '**/height/360/width/640', {fixture: '640.jpeg'});
|
|
14
|
+
// kava
|
|
15
|
+
cy.intercept('GET', '**/index.php?service=analytics*', {});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
describe('dual-screen layouts', () => {
|
|
19
|
+
it("should not render dual-screen layout if main entry doesn't have child entries", () => {
|
|
20
|
+
mockKalturaBe('dual-screen-0-media.json', 'cue-points-empty.json');
|
|
21
|
+
loadPlayer().then(() => {
|
|
22
|
+
cy.get('[data-testid="dualscreen_pipChildren"]', {timeout: 1000}).should('not.exist');
|
|
23
|
+
cy.get('[data-testid="dualscreen_pipParent"]', {timeout: 1000}).should('not.exist');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
it('should render PiP dual-screen layout', () => {
|
|
27
|
+
mockKalturaBe('dual-screen-1-media.json', 'cue-points-empty.json');
|
|
28
|
+
loadPlayer({layout: 'PIP'}).then(() => {
|
|
29
|
+
cy.get('[data-testid="dualscreen_pipChildren"]').should('exist');
|
|
30
|
+
cy.get('[data-testid="dualscreen_pipParent"]').should('exist');
|
|
31
|
+
cy.get('[data-testid="dualscreen_multiscreenWrapper"]').should('not.exist');
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
it('should render SbS dual-screen layout', () => {
|
|
35
|
+
mockKalturaBe('dual-screen-1-media.json', 'cue-points-empty.json');
|
|
36
|
+
loadPlayer({layout: 'SideBySide'}).then(() => {
|
|
37
|
+
cy.get('[data-testid="dualscreen_sideBySideWrapper"]').should('exist');
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
it('should render SingleMedia dual-screen layout if main entry has child entry', () => {
|
|
41
|
+
mockKalturaBe('dual-screen-1-media.json', 'cue-points-empty.json');
|
|
42
|
+
loadPlayer({layout: 'SingleMedia'}).then(() => {
|
|
43
|
+
cy.get('[data-testid="dualscreen_pipMinimized"]').should('exist');
|
|
44
|
+
cy.get('[data-testid="dualscreen_pipParent"]').should('exist');
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
it('should render dual-screen layout with multiscreen', () => {
|
|
48
|
+
mockKalturaBe('dual-screen-2-media.json', 'cue-points-empty.json');
|
|
49
|
+
loadPlayer().then(() => {
|
|
50
|
+
cy.get('[data-testid="dualscreen_multiscreenWrapper"]').should('exist');
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe('PIP layout', () => {
|
|
56
|
+
it('should change layout to SideBySide', () => {
|
|
57
|
+
mockKalturaBe('dual-screen-1-media.json', 'cue-points-empty.json');
|
|
58
|
+
loadPlayer({layout: 'PIP'}).then(() => {
|
|
59
|
+
cy.get('[data-testid="dualscreen_sideBySideWrapper"]').should('not.exist');
|
|
60
|
+
cy.get('[data-testid="dualscreen_pipChildren"]').within(() => {
|
|
61
|
+
cy.get('[data-testid="dualscreen_switchToSideBySide"]').click({force: true});
|
|
62
|
+
});
|
|
63
|
+
cy.get('[data-testid="dualscreen_sideBySideWrapper"]').should('exist');
|
|
64
|
+
cy.get('[data-testid="dualscreen_pipChildren"]').should('not.exist');
|
|
65
|
+
cy.get('[data-testid="dualscreen_pipParent"]').should('not.exist');
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
it('should change layout to PIP inverse', () => {
|
|
69
|
+
mockKalturaBe('dual-screen-1-media.json', 'cue-points-empty.json');
|
|
70
|
+
loadPlayer({layout: 'PIP'}).then(() => {
|
|
71
|
+
cy.get('[data-testid="dualscreen_pipChildren"]').within(() => {
|
|
72
|
+
cy.get('[data-testid="dualscreen_inversePIP"]').click({force: true});
|
|
73
|
+
});
|
|
74
|
+
cy.get('[data-testid="dualscreen_pipChildren"]').should('exist');
|
|
75
|
+
cy.get('[data-testid="dualscreen_pipParent"]').should('exist');
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
it('should change layout to SingleMedia', () => {
|
|
79
|
+
mockKalturaBe('dual-screen-1-media.json', 'cue-points-empty.json');
|
|
80
|
+
loadPlayer({layout: 'PIP'}).then(() => {
|
|
81
|
+
cy.get('[data-testid="dualscreen_pipMinimized"]').should('not.exist');
|
|
82
|
+
cy.get('[data-testid="dualscreen_pipChildren"]').within(() => {
|
|
83
|
+
cy.get('[data-testid="dualscreen_switchToSingleMedia"]').click({force: true});
|
|
84
|
+
});
|
|
85
|
+
cy.get('[data-testid="dualscreen_pipParent"]').should('exist');
|
|
86
|
+
cy.get('[data-testid="dualscreen_pipMinimized"]').should('exist');
|
|
87
|
+
cy.get('[data-testid="dualscreen_pipChildren"]').should('not.exist');
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
describe('SingleMedia layout', () => {
|
|
93
|
+
it('should change layout to PIP', () => {
|
|
94
|
+
mockKalturaBe('dual-screen-1-media.json', 'cue-points-empty.json');
|
|
95
|
+
loadPlayer({layout: 'SingleMedia'}).then(() => {
|
|
96
|
+
cy.get('[data-testid="dualscreen_pipMinimized"]').within(() => {
|
|
97
|
+
cy.get('[data-testid="dualscreen_switchToPIP"]').click({force: true});
|
|
98
|
+
});
|
|
99
|
+
cy.get('[data-testid="dualscreen_pipChildren"]').should('exist');
|
|
100
|
+
cy.get('[data-testid="dualscreen_pipParent"]').should('exist');
|
|
101
|
+
cy.get('[data-testid="dualscreen_pipMinimized"]').should('not.exist');
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
it('should change layout to SingleMedia inverse', () => {
|
|
105
|
+
mockKalturaBe('dual-screen-1-media.json', 'cue-points-empty.json');
|
|
106
|
+
loadPlayer({layout: 'SingleMedia'}).then(() => {
|
|
107
|
+
cy.get('[data-testid="dualscreen_pipMinimized"]').within(() => {
|
|
108
|
+
cy.get('[data-testid="dualscreen_switchToPrimary"]').click({force: true});
|
|
109
|
+
});
|
|
110
|
+
cy.get('[data-testid="dualscreen_pipParent"]').should('exist');
|
|
111
|
+
cy.get('[data-testid="dualscreen_pipMinimized"]').should('exist');
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
describe('SideBySide layout', () => {
|
|
117
|
+
it('should change layout to PIP', () => {
|
|
118
|
+
mockKalturaBe('dual-screen-1-media.json', 'cue-points-empty.json');
|
|
119
|
+
loadPlayer({layout: 'SideBySide'}).then(() => {
|
|
120
|
+
cy.get('[data-testid="dualscreen_sideBySideWrapper"]').within(() => {
|
|
121
|
+
cy.get('[data-testid="dualscreen_switchToPIP"]').should('have.length', 2);
|
|
122
|
+
cy.get('[data-testid="dualscreen_switchToPIP"]').eq(1).click({force: true});
|
|
123
|
+
});
|
|
124
|
+
cy.get('[data-testid="dualscreen_sideBySideWrapper"]').should('not.exist');
|
|
125
|
+
cy.get('[data-testid="dualscreen_pipChildren"]').should('exist');
|
|
126
|
+
cy.get('[data-testid="dualscreen_pipParent"]').should('exist');
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
describe('Image player', () => {
|
|
132
|
+
it('should render image player', () => {
|
|
133
|
+
mockKalturaBe('dual-screen-0-media.json', 'cue-points.json');
|
|
134
|
+
loadPlayer({}, {startTime: 15}).then(() => {
|
|
135
|
+
cy.get('[data-testid="dualscreen_imagePlayer"]').should('exist');
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
it('should render image player when playback reached slide start-time', () => {
|
|
139
|
+
mockKalturaBe('dual-screen-0-media.json', 'cue-points.json');
|
|
140
|
+
loadPlayer().then(player => {
|
|
141
|
+
cy.get('[data-testid="dualscreen_imagePlayer"]')
|
|
142
|
+
.should('not.exist')
|
|
143
|
+
.then(() => {
|
|
144
|
+
player.currentTime = 15;
|
|
145
|
+
cy.get('[data-testid="dualscreen_imagePlayer"]').should('exist');
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
it("should hide image player if playback haven't reached slide start-time", () => {
|
|
150
|
+
mockKalturaBe('dual-screen-0-media.json', 'cue-points.json');
|
|
151
|
+
loadPlayer({}, {startTime: 15}).then(player => {
|
|
152
|
+
cy.get('[data-testid="dualscreen_imagePlayer"]')
|
|
153
|
+
.should('exist')
|
|
154
|
+
.then(() => {
|
|
155
|
+
player.currentTime = 0;
|
|
156
|
+
cy.get('[data-testid="dualscreen_imagePlayer"]').should('not.exist');
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
describe('Multiscreen', () => {
|
|
163
|
+
it('should render one multiscreen wrapper with multiscreen player', () => {
|
|
164
|
+
mockKalturaBe('dual-screen-2-media.json', 'cue-points-empty.json');
|
|
165
|
+
loadPlayer({layout: 'PIP'}).then(() => {
|
|
166
|
+
cy.get('[data-testid="dualscreen_multiscreen"]').should('have.length', 1);
|
|
167
|
+
cy.get('[data-testid="dualscreen_multiscreen"]').within(() => {
|
|
168
|
+
cy.get('[data-testid="dualscreen_multiscreenPlayer"]').should('have.length', 1);
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
it.skip('should render multiscreen wrapper with 2 players', () => {
|
|
173
|
+
// TODO: enable test after fix done for image player in multiscreen
|
|
174
|
+
mockKalturaBe('dual-screen-2-media.json', 'cue-points.json');
|
|
175
|
+
loadPlayer({}, {startTime: 15}).then(() => {
|
|
176
|
+
cy.get('[data-testid="dualscreen_multiscreen"]').within(() => {
|
|
177
|
+
cy.get('[data-testid="dualscreen_multiscreenPlayer"]').should('have.length', 2);
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
it('should toggle multiscreen menu', () => {
|
|
182
|
+
mockKalturaBe('dual-screen-2-media.json', 'cue-points-empty.json');
|
|
183
|
+
loadPlayer().then(() => {
|
|
184
|
+
cy.get('[data-testid="dualscreen_multiscreen"]').should('have.css', 'visibility', 'hidden');
|
|
185
|
+
cy.get('[data-testid="dualscreen_multiscreenButton"]').click({force: true});
|
|
186
|
+
cy.get('[data-testid="dualscreen_multiscreen"]').should('have.css', 'visibility', 'visible');
|
|
187
|
+
cy.get('[data-testid="dualscreen_multiscreenButton"]').click({force: true});
|
|
188
|
+
cy.get('[data-testid="dualscreen_multiscreen"]').should('have.css', 'visibility', 'hidden');
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
it('should close multiscreen menu on document click', () => {
|
|
192
|
+
mockKalturaBe('dual-screen-2-media.json', 'cue-points-empty.json');
|
|
193
|
+
loadPlayer().then(() => {
|
|
194
|
+
cy.get('[data-testid="dualscreen_multiscreenButton"]').click({force: true});
|
|
195
|
+
cy.get('[data-testid="dualscreen_multiscreen"]').should('have.css', 'visibility', 'visible');
|
|
196
|
+
cy.get('[data-testid="dualscreen_pipChildren"]').click({force: true});
|
|
197
|
+
cy.get('[data-testid="dualscreen_multiscreen"]').should('have.css', 'visibility', 'hidden');
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
it('should render 2 multiscreen wrappers', () => {
|
|
201
|
+
mockKalturaBe('dual-screen-2-media.json', 'cue-points-empty.json');
|
|
202
|
+
loadPlayer({layout: 'SideBySide'}).then(() => {
|
|
203
|
+
cy.get('[data-testid="dualscreen_multiscreen"]').should('have.length', 2);
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
it('should render 2 minimized players', () => {
|
|
207
|
+
mockKalturaBe('dual-screen-2-media.json', 'cue-points-empty.json');
|
|
208
|
+
loadPlayer({layout: 'SingleMedia'}).then(() => {
|
|
209
|
+
cy.get('[data-testid="dualscreen_multiscreen"]').should('not.exist');
|
|
210
|
+
cy.get('[data-testid="dualscreen_pipMinimized"]').should('have.length', 1);
|
|
211
|
+
cy.get('[data-testid="dualscreen_pipMinimizedPlayer"]').should('have.length', 2);
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
describe('Video sync manager', () => {
|
|
217
|
+
it('should sync play & pause events', done => {
|
|
218
|
+
mockKalturaBe('dual-screen-1-media.json', 'cue-points-empty.json');
|
|
219
|
+
loadPlayer({layout: 'PIP'}).then(playerMain => {
|
|
220
|
+
cy.get('[data-testid="dualscreen_pipChildren"]').then(() => {
|
|
221
|
+
getPlayer('secondaryPlaceholder-1_3vus9bhe').then(playerSecondary => {
|
|
222
|
+
playerSecondary.addEventListener(EventType.PAUSE, () => {
|
|
223
|
+
playerMain.play();
|
|
224
|
+
playerSecondary.addEventListener(EventType.PLAY, () => {
|
|
225
|
+
done();
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
playerMain.pause();
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
it('should sync seek event', done => {
|
|
235
|
+
mockKalturaBe('dual-screen-1-media.json', 'cue-points-empty.json');
|
|
236
|
+
loadPlayer({layout: 'PIP'}).then(playerMain => {
|
|
237
|
+
playerMain.pause();
|
|
238
|
+
cy.get('[data-testid="dualscreen_pipChildren"]').then(() => {
|
|
239
|
+
getPlayer('secondaryPlaceholder-1_3vus9bhe').then(playerSecondary => {
|
|
240
|
+
const listener = () => {
|
|
241
|
+
playerSecondary.removeEventListener(EventType.SEEKED, listener);
|
|
242
|
+
done();
|
|
243
|
+
};
|
|
244
|
+
playerSecondary.addEventListener(EventType.SEEKED, listener);
|
|
245
|
+
playerMain.currentTime = 5;
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
it('should sync ended event', done => {
|
|
252
|
+
mockKalturaBe('dual-screen-1-media.json', 'cue-points-empty.json');
|
|
253
|
+
loadPlayer({layout: 'PIP'}).then(playerMain => {
|
|
254
|
+
cy.get('[data-testid="dualscreen_pipChildren"]').then(() => {
|
|
255
|
+
getPlayer('secondaryPlaceholder-1_3vus9bhe').then(playerSecondary => {
|
|
256
|
+
playerMain.addEventListener(EventType.ENDED, () => {
|
|
257
|
+
try {
|
|
258
|
+
expect(playerSecondary.paused).to.be.true;
|
|
259
|
+
done();
|
|
260
|
+
} catch (e) {
|
|
261
|
+
done(e);
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
playerMain.dispatchEvent(new FakeEvent(EventType.ENDED));
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
it('should handle error', done => {
|
|
271
|
+
mockKalturaBe('dual-screen-1-media.json', 'cue-points-empty.json');
|
|
272
|
+
loadPlayer({layout: 'PIP'}).then(playerMain => {
|
|
273
|
+
cy.get('[data-testid="dualscreen_pipChildren"]').then(() => {
|
|
274
|
+
getPlayer('secondaryPlaceholder-1_3vus9bhe').then(playerSecondary => {
|
|
275
|
+
playerMain.addEventListener(EventType.ERROR, () => {
|
|
276
|
+
done();
|
|
277
|
+
});
|
|
278
|
+
playerSecondary.dispatchEvent(
|
|
279
|
+
new FakeEvent(
|
|
280
|
+
EventType.ERROR,
|
|
281
|
+
new Error(Error.Severity.CRITICAL, Error.Category.PLAYER, Error.Code.VIDEO_ERROR, {message: 'fake error'})
|
|
282
|
+
)
|
|
283
|
+
);
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
it('should sync primary and secondary players on seek', done => {
|
|
290
|
+
mockKalturaBe('dual-screen-1-media.json', 'cue-points-empty.json');
|
|
291
|
+
loadPlayer({layout: 'PIP'}).then(playerMain => {
|
|
292
|
+
cy.get('[data-testid="dualscreen_pipChildren"]').then(() => {
|
|
293
|
+
getPlayer('secondaryPlaceholder-1_3vus9bhe').then(playerSecondary => {
|
|
294
|
+
const listener = () => {
|
|
295
|
+
if (expect(playerSecondary.currentTime).to.be.closeTo(playerMain.currentTime, 0.5)) {
|
|
296
|
+
playerSecondary.removeEventListener(EventType.SEEKED, listener);
|
|
297
|
+
done();
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
playerSecondary.addEventListener(EventType.SEEKED, listener);
|
|
301
|
+
playerMain.currentTime = 5;
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
it('should test high accurate sync', done => {
|
|
308
|
+
mockKalturaBe('dual-screen-1-media.json', 'cue-points-empty.json');
|
|
309
|
+
loadPlayer({layout: 'PIP'}).then(playerMain => {
|
|
310
|
+
cy.get('[data-testid="dualscreen_pipChildren"]').then(() => {
|
|
311
|
+
getPlayer('secondaryPlaceholder-1_3vus9bhe').then(playerSecondary => {
|
|
312
|
+
const listener = () => {
|
|
313
|
+
if (expect(playerSecondary.currentTime).to.be.closeTo(playerMain.currentTime, 0.1)) {
|
|
314
|
+
playerSecondary.removeEventListener(EventType.TIME_UPDATE, listener);
|
|
315
|
+
done();
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
playerSecondary.addEventListener(EventType.TIME_UPDATE, listener);
|
|
319
|
+
playerMain.currentTime = 10;
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
});
|
|
323
|
+
});
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
describe('Image sync manager', () => {
|
|
327
|
+
it('should handle TIMED_METADATA_ADDED event', done => {
|
|
328
|
+
mockKalturaBe('dual-screen-0-media.json', 'cue-points.json');
|
|
329
|
+
loadPlayer().then(player => {
|
|
330
|
+
player.addEventListener(EventType.TIMED_METADATA_ADDED, ({payload}: any) => {
|
|
331
|
+
expect(payload.cues.length).to.eql(2);
|
|
332
|
+
expect(payload.cues[0].id).to.eql('1_0h1uf07a');
|
|
333
|
+
expect(payload.cues[0].startTime).to.eql(10);
|
|
334
|
+
expect(payload.cues[0].endTime).to.eql(15);
|
|
335
|
+
done();
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
it('should handle TIMED_METADATA event', done => {
|
|
340
|
+
mockKalturaBe('dual-screen-0-media.json', 'cue-points.json');
|
|
341
|
+
loadPlayer().then(player => {
|
|
342
|
+
player.addEventListener(EventType.TIMED_METADATA, ({payload}: any) => {
|
|
343
|
+
expect(payload.cues.length).to.eql(1);
|
|
344
|
+
expect(payload.cues[0].id).to.eql('1_0h1uf07a');
|
|
345
|
+
expect(payload.cues[0].startTime).to.eql(10);
|
|
346
|
+
expect(payload.cues[0].endTime).to.eql(15);
|
|
347
|
+
done();
|
|
348
|
+
});
|
|
349
|
+
player.currentTime = 10;
|
|
350
|
+
});
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export const MANIFEST = `#EXTM3U
|
|
2
|
+
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",LANGUAGE="en",NAME="English",AUTOSELECT=YES,DEFAULT=YES,URI="${location.origin}/media/index_1.m3u8",SUBTITLES="subs"
|
|
3
|
+
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=509496,RESOLUTION=480x272,AUDIO="audio",SUBTITLES="subs"
|
|
4
|
+
${location.origin}/media/index.m3u8`;
|
|
5
|
+
|
|
6
|
+
export const MANIFEST_SAFARI = `#EXTM3U
|
|
7
|
+
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English",DEFAULT=NO,AUTOSELECT=YES,FORCED=NO,LANGUAGE="en",URI="${location.origin}/media/index_1.m3u8"
|
|
8
|
+
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=504265,RESOLUTION=480x272,AUDIO="audio",SUBTITLES="subs"
|
|
9
|
+
${location.origin}/media/index.m3u8`;
|
|
10
|
+
|
|
11
|
+
export const getPlayer = (id = 'player-placeholder') => {
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
return cy.window().then($win => $win.KalturaPlayer.getPlayers()[id]);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const preparePage = (puginConf = {}, playbackConf = {}) => {
|
|
17
|
+
cy.visit('index.html');
|
|
18
|
+
return cy.window().then(win => {
|
|
19
|
+
try {
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
var kalturaPlayer = win.KalturaPlayer.setup({
|
|
22
|
+
targetId: 'player-placeholder',
|
|
23
|
+
provider: {
|
|
24
|
+
partnerId: -1,
|
|
25
|
+
env: {
|
|
26
|
+
cdnUrl: 'http://mock-cdn',
|
|
27
|
+
serviceUrl: 'http://mock-api'
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
plugins: {
|
|
31
|
+
dualscreen: puginConf,
|
|
32
|
+
kalturaCuepoints: {}
|
|
33
|
+
},
|
|
34
|
+
playback: {muted: true, autoplay: true, ...playbackConf}
|
|
35
|
+
});
|
|
36
|
+
return kalturaPlayer.loadMedia({entryId: '0_wifqaipd'});
|
|
37
|
+
} catch (e: any) {
|
|
38
|
+
return Promise.reject(e.message);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const checkRequest = (reqBody: any, service: string, action: string) => {
|
|
44
|
+
return reqBody?.service === service && reqBody?.action === action;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const loadPlayer = (puginConf = {}, playbackConf: Record<string, any> = {}) => {
|
|
48
|
+
return preparePage(puginConf, playbackConf).then(() =>
|
|
49
|
+
getPlayer().then(kalturaPlayer => {
|
|
50
|
+
if (playbackConf.autoplay) {
|
|
51
|
+
return kalturaPlayer.ready().then(() => kalturaPlayer);
|
|
52
|
+
}
|
|
53
|
+
return kalturaPlayer;
|
|
54
|
+
})
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const mockKalturaBe = (dualScreenFixture: string, cuesFixture: string) => {
|
|
59
|
+
cy.intercept('http://mock-api/service/multirequest', req => {
|
|
60
|
+
if (checkRequest(req.body[2], 'baseEntry', 'list')) {
|
|
61
|
+
if (req.body[2].filter.parentEntryIdEqual) {
|
|
62
|
+
return req.reply({fixture: dualScreenFixture});
|
|
63
|
+
}
|
|
64
|
+
return req.reply({fixture: 'base_entry.json'});
|
|
65
|
+
}
|
|
66
|
+
if (checkRequest(req.body[2], 'cuepoint_cuepoint', 'list')) {
|
|
67
|
+
return req.reply({fixture: cuesFixture});
|
|
68
|
+
}
|
|
69
|
+
if (checkRequest(req.body[2], 'thumbAsset', 'getUrl')) {
|
|
70
|
+
return req.reply({fixture: 'thumb-url.json'});
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
cy.intercept('GET', '**/ks/123', {fixture: 'thumb-asset.jpeg'}).as('getSlides');
|
|
74
|
+
};
|
|
Binary file
|
|
Binary file
|