Skip to content

Commit

Permalink
Fix video ID extraction to handle optional chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
vtnorton committed Dec 9, 2024
1 parent 589d23c commit baca518
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/pages/portfolio/palestra/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,10 @@ export default function Palestra({ talk, nextTalk }: { talk: Talk, nextTalk: Tal

const videoId = (videoURL: string) => {
let embedLink = videoURL?.split('?v=')[1] || videoURL?.split('live/=')[1]
console.log('embedLink', embedLink)

if (embedLink.includes('t='))
if (embedLink?.includes('t='))
embedLink = embedLink.replace('&t=', '?&start=')

console.log('embedLink2', embedLink)

return embedLink
}

Expand Down

0 comments on commit baca518

Please sign in to comment.