From 78792ccc89322e72d256c5abf251d8309719e98f Mon Sep 17 00:00:00 2001 From: mkljczk Date: Sat, 14 Dec 2024 22:47:23 +0100 Subject: [PATCH] pl-fe: remove rumble-specific autoplay handling Signed-off-by: mkljczk --- packages/pl-fe/src/utils/media.test.ts | 28 ++++++-------------------- packages/pl-fe/src/utils/media.ts | 16 +++------------ 2 files changed, 9 insertions(+), 35 deletions(-) diff --git a/packages/pl-fe/src/utils/media.test.ts b/packages/pl-fe/src/utils/media.test.ts index cbfdac026..c819f594c 100644 --- a/packages/pl-fe/src/utils/media.test.ts +++ b/packages/pl-fe/src/utils/media.test.ts @@ -1,31 +1,15 @@ import { addAutoPlay } from './media'; describe('addAutoPlay()', () => { - describe('when the provider is Rumble', () => { - it('adds the correct query parameters to the src', () => { - const html = ''; - expect(addAutoPlay(html)).toEqual(''); - }); - - describe('when the iframe src already has params', () => { - it('adds the correct query parameters to the src', () => { - const html = ''; - expect(addAutoPlay(html)).toEqual(''); - }); - }); + it('adds the correct query parameters to the src', () => { + const html = ''; + expect(addAutoPlay(html)).toEqual(''); }); - describe('when the provider is not Rumble', () => { + describe('when the iframe src already has params', () => { it('adds the correct query parameters to the src', () => { - const html = ''; - expect(addAutoPlay(html)).toEqual(''); - }); - - describe('when the iframe src already has params', () => { - it('adds the correct query parameters to the src', () => { - const html = ''; - expect(addAutoPlay(html)).toEqual(''); - }); + const html = ''; + expect(addAutoPlay(html)).toEqual(''); }); }); }); diff --git a/packages/pl-fe/src/utils/media.ts b/packages/pl-fe/src/utils/media.ts index 9143061ff..082a7aba5 100644 --- a/packages/pl-fe/src/utils/media.ts +++ b/packages/pl-fe/src/utils/media.ts @@ -53,10 +53,6 @@ const getVideoDuration = (file: File): Promise => { const domParser = new DOMParser(); -enum VideoProviders { - RUMBLE = 'rumble.com' -} - /** Try adding autoplay to an iframe embed for platforms such as YouTube. */ const addAutoPlay = (html: string): string => { try { @@ -65,16 +61,10 @@ const addAutoPlay = (html: string): string => { if (iframe) { const url = new URL(iframe.src); - const provider = new URL(iframe.src).host; - if (provider === VideoProviders.RUMBLE) { - url.searchParams.append('pub', '7a20'); - url.searchParams.append('autoplay', '2'); - } else { - url.searchParams.append('autoplay', '1'); - url.searchParams.append('auto_play', '1'); - iframe.allow = 'autoplay'; - } + url.searchParams.append('autoplay', '1'); + url.searchParams.append('auto_play', '1'); + iframe.allow = 'autoplay'; iframe.src = url.toString();