diff --git a/images/chromium-headful/client/src/components/video.vue b/images/chromium-headful/client/src/components/video.vue
index ff26ee83..e10188af 100644
--- a/images/chromium-headful/client/src/components/video.vue
+++ b/images/chromium-headful/client/src/components/video.vue
@@ -123,7 +123,7 @@
@touchend.stop.prevent="resumeVideo"
@click.stop.prevent="resumeVideo"
>
- Tap to resume video
+ Resume video
} } = {}
+const noDecorator = () => () => undefined
+runInNewContext(compiled, {
+ exports,
+ require: (name: string) => name === 'vue-property-decorator' ? {
+ Vue: class {},
+ Component: () => (type: unknown) => type,
+ Ref: noDecorator,
+ Watch: noDecorator,
+ Prop: noDecorator,
+ } : {},
+})
+const methods = exports.default!.prototype
+
+for (const initiallyMuted of [false, true]) {
+ test(`desktop autoplay refusal exposes a working resume control (muted=${initiallyMuted})`, async () => {
+ let activated = false
+ const video = {
+ paused: true,
+ muted: initiallyMuted,
+ currentTime: 0,
+ srcObject: {},
+ async play() {
+ if (!activated) throw new Error('NotAllowedError')
+ this.paused = false
+ },
+ }
+ const component = {
+ _video: video,
+ isVideoSyncing: false,
+ is_touch_device: false,
+ playable: true,
+ videoBlocked: false,
+ $accessor: { video: { setMuted: () => {}, pause: () => {} } },
+ videoResume: new VideoResume(video, () => 0, () => {}, (blocked) => { component.videoBlocked = blocked }),
+ }
+ await methods.onPlayingChanged.call(component, true)
+ expect(video.paused).toBe(true)
+ expect(component.videoBlocked).toBe(true)
+ activated = true
+ methods.resumeVideo.call(component)
+ await Promise.resolve()
+ expect(video.paused).toBe(false)
+ expect(component.videoBlocked).toBe(false)
+ })
+}
diff --git a/images/chromium-headful/client/tests/video-input.test.ts b/images/chromium-headful/client/tests/video-input.test.ts
index 86433842..510d2ebc 100644
--- a/images/chromium-headful/client/tests/video-input.test.ts
+++ b/images/chromium-headful/client/tests/video-input.test.ts
@@ -317,11 +317,11 @@ describe('resuming the video', () => {
expect(calls).toEqual(['resume'])
})
- test('leaves desktop alone', () => {
+ test('desktop can resume from the recovery control or when the tab is shown', () => {
const { methods, ctx, calls } = player(false)
methods.resumeVideo.call(ctx)
methods.resumeVideoWhenVisible.call(ctx)
- expect(calls).toEqual([])
+ expect(calls).toEqual(['resume', 'resume'])
})
test('waits for the stream to be playable', () => {