Fix start value in youtube embed by removing "s" from url param (#6113)

This commit is contained in:
Lars Kappert
2024-11-05 13:43:20 +01:00
committed by GitHub
parent ab4e36115b
commit f8fb6cb9b3
2 changed files with 17 additions and 2 deletions
+5 -2
View File
@@ -88,7 +88,9 @@ export function parseEmbedPlayerFromUrl(
// youtube
if (urlp.hostname === 'youtu.be') {
const videoId = urlp.pathname.split('/')[1]
const seek = encodeURIComponent(urlp.searchParams.get('t') ?? 0)
const t = urlp.searchParams.get('t') ?? '0'
const seek = encodeURIComponent(t.replace(/s$/, ''))
if (videoId) {
return {
type: 'youtube_video',
@@ -111,7 +113,8 @@ export function parseEmbedPlayerFromUrl(
isShorts || isLive
? shortOrLiveVideoId
: (urlp.searchParams.get('v') as string)
const seek = encodeURIComponent(urlp.searchParams.get('t') ?? 0)
const t = urlp.searchParams.get('t') ?? '0'
const seek = encodeURIComponent(t.replace(/s$/, ''))
if (videoId) {
return {