@gcorevideo/player 2.26.2 → 2.26.5
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/dist/core.js +432 -432
- package/dist/index.css +1024 -1024
- package/dist/index.embed.js +442 -443
- package/dist/index.js +444 -445
- package/lib/plugins/source-controller/SourceController.d.ts.map +1 -1
- package/lib/plugins/source-controller/SourceController.js +5 -8
- package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.d.ts.map +1 -1
- package/lib/plugins/spinner-three-bounce/SpinnerThreeBounce.js +4 -2
- package/package.json +1 -1
- package/src/plugins/source-controller/SourceController.ts +8 -11
- package/src/plugins/source-controller/__tests__/SourceController.test.ts +31 -18
- package/src/plugins/spinner-three-bounce/SpinnerThreeBounce.ts +4 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceController.d.ts","sourceRoot":"","sources":["../../../src/plugins/source-controller/SourceController.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,KAAK,IAAI,IAAI,UAAU,EACxB,MAAM,cAAc,CAAA;AAwBrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAwC9C,OAAO,CAAC,WAAW,CAA8B;IAEjD,OAAO,CAAC,kBAAkB,CAAI;IAE9B,OAAO,CAAC,YAAY,CAA6B;IAEjD,OAAO,CAAC,MAAM,CAAQ;IAEtB,OAAO,CAAC,QAAQ,CAAQ;IAExB,OAAO,CAAC,SAAS,CAAQ;IAEzB,OAAO,CAAC,IAAI,CAAiB;IAE7B;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;gBACS,IAAI,EAAE,UAAU;IAW5B;;OAEG;IACM,UAAU;IAWnB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,wBAAwB;IAgBhC,OAAO,CAAC,2BAA2B;
|
|
1
|
+
{"version":3,"file":"SourceController.d.ts","sourceRoot":"","sources":["../../../src/plugins/source-controller/SourceController.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,KAAK,IAAI,IAAI,UAAU,EACxB,MAAM,cAAc,CAAA;AAwBrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAwC9C,OAAO,CAAC,WAAW,CAA8B;IAEjD,OAAO,CAAC,kBAAkB,CAAI;IAE9B,OAAO,CAAC,YAAY,CAA6B;IAEjD,OAAO,CAAC,MAAM,CAAQ;IAEtB,OAAO,CAAC,QAAQ,CAAQ;IAExB,OAAO,CAAC,SAAS,CAAQ;IAEzB,OAAO,CAAC,IAAI,CAAiB;IAE7B;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;gBACS,IAAI,EAAE,UAAU;IAW5B;;OAEG;IACM,UAAU;IAWnB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,wBAAwB;IAgBhC,OAAO,CAAC,2BAA2B;IAiDnC,OAAO,CAAC,KAAK;IAKb,OAAO,CAAC,aAAa;IAgCrB,OAAO,CAAC,kBAAkB;IAe1B;;OAEG;IACH,MAAM,KAAK,OAAO,WAEjB;CACF"}
|
|
@@ -191,23 +191,19 @@ export class SourceController extends CorePlugin {
|
|
|
191
191
|
break;
|
|
192
192
|
}
|
|
193
193
|
});
|
|
194
|
-
this.core.
|
|
195
|
-
trace(`${T}
|
|
194
|
+
this.listenTo(this.core.activeContainer, Events.CONTAINER_PLAY, (_, { autoPlay }) => {
|
|
195
|
+
trace(`${T} onContainerPlay`, {
|
|
196
|
+
autoPlay,
|
|
196
197
|
currentSource: this.sourcesList[this.currentSourceIndex],
|
|
197
198
|
retrying: this.active,
|
|
198
199
|
});
|
|
200
|
+
this.autoPlay = !!autoPlay;
|
|
199
201
|
if (this.active) {
|
|
200
202
|
this.reset();
|
|
201
203
|
this.core.activeContainer?.getPlugin('poster')?.enable();
|
|
202
204
|
this.core.activeContainer?.getPlugin('spinner')?.hide();
|
|
203
205
|
}
|
|
204
206
|
});
|
|
205
|
-
this.listenTo(this.core.activeContainer, Events.CONTAINER_PLAY, (_, { autoPlay }) => {
|
|
206
|
-
trace(`${T} onContainerPlay`, {
|
|
207
|
-
autoPlay,
|
|
208
|
-
});
|
|
209
|
-
this.autoPlay = !!autoPlay;
|
|
210
|
-
});
|
|
211
207
|
}
|
|
212
208
|
reset() {
|
|
213
209
|
this.active = false;
|
|
@@ -235,6 +231,7 @@ export class SourceController extends CorePlugin {
|
|
|
235
231
|
setTimeout(() => {
|
|
236
232
|
trace(`${T} retryPlayback playing`, {
|
|
237
233
|
autoPlay: this.autoPlay,
|
|
234
|
+
nextSource,
|
|
238
235
|
});
|
|
239
236
|
this.core.activeContainer.play({
|
|
240
237
|
autoPlay: this.autoPlay,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpinnerThreeBounce.d.ts","sourceRoot":"","sources":["../../../src/plugins/spinner-three-bounce/SpinnerThreeBounce.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,SAAS,EAET,iBAAiB,EAElB,MAAM,cAAc,CAAA;AAKrB,OAAO,mDAAmD,CAAA;AAM1D;;;GAGG;AACH,oBAAY,aAAa;IACvB;;;OAGG;IACH,IAAI,yBAAyB;CAC9B;AAED;;;;;;;;GAQG;AACH,qBAAa,kBAAmB,SAAQ,iBAAiB;IACvD,OAAO,CAAC,SAAS,CAAQ;IAEzB;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;IACH,IAAa,UAAU;;;MAKtB;IAED,OAAO,CAAC,WAAW,CAAuB;IAE1C,OAAO,CAAC,QAAQ,CAAwB;IAExC,OAAO,CA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G;IACM,MAAM;CAgBhB"}
|
|
@@ -130,8 +130,10 @@ export class SpinnerThreeBounce extends UIContainerPlugin {
|
|
|
130
130
|
*/
|
|
131
131
|
render() {
|
|
132
132
|
this.$el.html(this.template());
|
|
133
|
-
this.el.firstElementChild?.addEventListener('animationiteration', () => {
|
|
134
|
-
this.trigger(SpinnerEvents.SYNC
|
|
133
|
+
this.el.firstElementChild?.addEventListener('animationiteration', (event) => {
|
|
134
|
+
this.trigger(SpinnerEvents.SYNC, {
|
|
135
|
+
elapsedTime: event.elapsedTime,
|
|
136
|
+
});
|
|
135
137
|
});
|
|
136
138
|
this.container.$el.append(this.$el[0]);
|
|
137
139
|
if (this.container.buffering) {
|
package/package.json
CHANGED
|
@@ -225,25 +225,21 @@ export class SourceController extends CorePlugin {
|
|
|
225
225
|
}
|
|
226
226
|
},
|
|
227
227
|
)
|
|
228
|
-
this.core.activePlayback.on(Events.PLAYBACK_PLAY, () => {
|
|
229
|
-
trace(`${T} on PLAYBACK_PLAY`, {
|
|
230
|
-
currentSource: this.sourcesList[this.currentSourceIndex],
|
|
231
|
-
retrying: this.active,
|
|
232
|
-
})
|
|
233
|
-
if (this.active) {
|
|
234
|
-
this.reset()
|
|
235
|
-
this.core.activeContainer?.getPlugin('poster')?.enable()
|
|
236
|
-
this.core.activeContainer?.getPlugin('spinner')?.hide()
|
|
237
|
-
}
|
|
238
|
-
})
|
|
239
228
|
this.listenTo(
|
|
240
229
|
this.core.activeContainer,
|
|
241
230
|
Events.CONTAINER_PLAY,
|
|
242
231
|
(_: string, { autoPlay }: { autoPlay?: boolean }) => {
|
|
243
232
|
trace(`${T} onContainerPlay`, {
|
|
244
233
|
autoPlay,
|
|
234
|
+
currentSource: this.sourcesList[this.currentSourceIndex],
|
|
235
|
+
retrying: this.active,
|
|
245
236
|
})
|
|
246
237
|
this.autoPlay = !!autoPlay
|
|
238
|
+
if (this.active) {
|
|
239
|
+
this.reset()
|
|
240
|
+
this.core.activeContainer?.getPlugin('poster')?.enable()
|
|
241
|
+
this.core.activeContainer?.getPlugin('spinner')?.hide()
|
|
242
|
+
}
|
|
247
243
|
},
|
|
248
244
|
)
|
|
249
245
|
}
|
|
@@ -275,6 +271,7 @@ export class SourceController extends CorePlugin {
|
|
|
275
271
|
setTimeout(() => {
|
|
276
272
|
trace(`${T} retryPlayback playing`, {
|
|
277
273
|
autoPlay: this.autoPlay,
|
|
274
|
+
nextSource,
|
|
278
275
|
})
|
|
279
276
|
this.core.activeContainer.play({
|
|
280
277
|
autoPlay: this.autoPlay,
|
|
@@ -4,11 +4,14 @@ import FakeTimers from '@sinonjs/fake-timers'
|
|
|
4
4
|
import { SourceController } from '../SourceController'
|
|
5
5
|
import { PlaybackErrorCode } from '../../../playback.types.js'
|
|
6
6
|
import {
|
|
7
|
+
createMockContainer,
|
|
7
8
|
createMockCore,
|
|
8
9
|
createMockPlayback,
|
|
9
10
|
createMockPlugin,
|
|
10
11
|
createSpinnerPlugin,
|
|
11
12
|
} from '../../../testUtils.js'
|
|
13
|
+
import { Events } from '@clappr/core'
|
|
14
|
+
import { SpinnerEvents } from '../../spinner-three-bounce/SpinnerThreeBounce.js'
|
|
12
15
|
|
|
13
16
|
// import { LogTracer, Logger, setTracer } from '@gcorevideo/utils'
|
|
14
17
|
|
|
@@ -77,19 +80,22 @@ describe('SourceController', () => {
|
|
|
77
80
|
describe('on fatal playback failure', () => {
|
|
78
81
|
let core: any
|
|
79
82
|
let nextPlayback: any
|
|
83
|
+
let nextContainer: any
|
|
80
84
|
describe('basically', () => {
|
|
81
85
|
beforeEach(() => {
|
|
82
86
|
core = createMockCore({
|
|
83
87
|
sources: MOCK_SOURCES,
|
|
84
88
|
})
|
|
85
89
|
const _ = new SourceController(core)
|
|
86
|
-
core.emit(
|
|
87
|
-
core.emit(
|
|
88
|
-
core.activePlayback.emit(
|
|
90
|
+
core.emit(Events.CORE_READY)
|
|
91
|
+
core.emit(Events.CORE_ACTIVE_CONTAINER_CHANGED)
|
|
92
|
+
core.activePlayback.emit(Events.PLAYBACK_ERROR, {
|
|
89
93
|
code: PlaybackErrorCode.MediaSourceUnavailable,
|
|
90
94
|
})
|
|
91
|
-
|
|
95
|
+
nextContainer = createMockContainer()
|
|
96
|
+
nextPlayback = nextContainer.playback
|
|
92
97
|
core.activePlayback = nextPlayback
|
|
98
|
+
core.activeContainer = nextContainer
|
|
93
99
|
})
|
|
94
100
|
it('should load the next source after a delay', async () => {
|
|
95
101
|
expect(core.load).not.toHaveBeenCalled()
|
|
@@ -124,7 +130,7 @@ describe('SourceController', () => {
|
|
|
124
130
|
return spinner
|
|
125
131
|
}
|
|
126
132
|
})
|
|
127
|
-
core.emit(
|
|
133
|
+
core.emit(Events.CORE_ACTIVE_CONTAINER_CHANGED)
|
|
128
134
|
})
|
|
129
135
|
it('should disable the poster', async () => {
|
|
130
136
|
expect(poster.disable).toHaveBeenCalled()
|
|
@@ -147,18 +153,22 @@ describe('SourceController', () => {
|
|
|
147
153
|
}
|
|
148
154
|
})
|
|
149
155
|
const _ = new SourceController(core)
|
|
150
|
-
core.emit(
|
|
151
|
-
core.emit(
|
|
152
|
-
core.activePlayback.emit(
|
|
156
|
+
core.emit(Events.CORE_READY)
|
|
157
|
+
core.emit(Events.CORE_ACTIVE_CONTAINER_CHANGED)
|
|
158
|
+
core.activePlayback.emit(Events.PLAYBACK_ERROR, {
|
|
153
159
|
code: PlaybackErrorCode.MediaSourceUnavailable,
|
|
154
160
|
})
|
|
155
|
-
|
|
161
|
+
nextContainer = createMockContainer()
|
|
162
|
+
nextPlayback = nextContainer.playback
|
|
156
163
|
core.activePlayback = nextPlayback
|
|
164
|
+
core.activeContainer = nextContainer
|
|
157
165
|
})
|
|
158
166
|
it('should sync with the spinner before reloading the source', async () => {
|
|
159
167
|
await clock.tickAsync(1000)
|
|
160
168
|
expect(core.load).not.toHaveBeenCalled()
|
|
161
|
-
spinner.emit(
|
|
169
|
+
spinner.emit(SpinnerEvents.SYNC, {
|
|
170
|
+
elapsedTime: 1000,
|
|
171
|
+
})
|
|
162
172
|
expect(core.load).toHaveBeenCalled()
|
|
163
173
|
})
|
|
164
174
|
})
|
|
@@ -171,14 +181,16 @@ describe('SourceController', () => {
|
|
|
171
181
|
sources: MOCK_SOURCES,
|
|
172
182
|
})
|
|
173
183
|
const _ = new SourceController(core)
|
|
174
|
-
core.emit(
|
|
175
|
-
core.emit(
|
|
176
|
-
core.activePlayback.emit(
|
|
184
|
+
core.emit(Events.CORE_READY)
|
|
185
|
+
core.emit(Events.CORE_ACTIVE_CONTAINER_CHANGED)
|
|
186
|
+
core.activePlayback.emit(Events.PLAYBACK_ERROR, {
|
|
177
187
|
code: PlaybackErrorCode.MediaSourceUnavailable,
|
|
178
188
|
})
|
|
179
189
|
await clock.tickAsync(1000)
|
|
180
|
-
|
|
190
|
+
nextContainer = createMockContainer()
|
|
191
|
+
nextPlayback = nextContainer.playback
|
|
181
192
|
core.activePlayback = nextPlayback
|
|
193
|
+
core.activeContainer = nextContainer
|
|
182
194
|
poster = createMockPlugin()
|
|
183
195
|
spinner = createSpinnerPlugin()
|
|
184
196
|
core.activeContainer.getPlugin.mockImplementation((name: string) => {
|
|
@@ -189,9 +201,10 @@ describe('SourceController', () => {
|
|
|
189
201
|
return spinner
|
|
190
202
|
}
|
|
191
203
|
})
|
|
192
|
-
core.emit(
|
|
193
|
-
core.emit(
|
|
194
|
-
nextPlayback.emit(
|
|
204
|
+
core.emit(Events.CORE_READY)
|
|
205
|
+
core.emit(Events.CORE_ACTIVE_CONTAINER_CHANGED)
|
|
206
|
+
nextPlayback.emit(Events.PLAYBACK_PLAY)
|
|
207
|
+
nextContainer.emit(Events.CONTAINER_PLAY, 'Container', {})
|
|
195
208
|
})
|
|
196
209
|
it('should enable the poster', async () => {
|
|
197
210
|
expect(poster.enable).toHaveBeenCalled()
|
|
@@ -206,7 +219,7 @@ describe('SourceController', () => {
|
|
|
206
219
|
it('should do nothing', async () => {
|
|
207
220
|
nextPlayback.emit(event)
|
|
208
221
|
await clock.tickAsync(1000)
|
|
209
|
-
nextPlayback.emit(
|
|
222
|
+
nextPlayback.emit(Events.PLAYBACK_PLAY)
|
|
210
223
|
await clock.tickAsync(1000)
|
|
211
224
|
expect(poster.enable).toHaveBeenCalledTimes(1)
|
|
212
225
|
expect(spinner.hide).toHaveBeenCalledTimes(1)
|
|
@@ -166,8 +166,10 @@ export class SpinnerThreeBounce extends UIContainerPlugin {
|
|
|
166
166
|
*/
|
|
167
167
|
override render() {
|
|
168
168
|
this.$el.html(this.template())
|
|
169
|
-
this.el.firstElementChild?.addEventListener('animationiteration', () => {
|
|
170
|
-
this.trigger(SpinnerEvents.SYNC
|
|
169
|
+
this.el.firstElementChild?.addEventListener('animationiteration', (event) => {
|
|
170
|
+
this.trigger(SpinnerEvents.SYNC, {
|
|
171
|
+
elapsedTime: (event as AnimationEvent).elapsedTime,
|
|
172
|
+
})
|
|
171
173
|
})
|
|
172
174
|
this.container.$el.append(this.$el[0])
|
|
173
175
|
if (this.container.buffering) {
|