Skip to content

Commit

Permalink
fix: youtube video id and mute param
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Jun 5, 2024
1 parent 0b8dd87 commit 7a60e61
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/renderer/src/lib/url-to-iframe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ export const urlToIframe = (url?: string | null) => {
highQuality: "true",
bvid: url.match(/\/\/www.bilibili.com\/video\/(BV\w+)/)?.[1] || "",
}).toString()}`
} else if (url?.match(/\/\/www.youtube.com\/watch\?v=\w+/)) {
return `https://www.youtube-nocookie.com/embed/${url.match(/\/\/www.youtube.com\/watch\?v=(\w+)/)?.[1]}?${new URLSearchParams({
} else if (url?.match(/\/\/www.youtube.com\/watch\?v=[-\w]+/)) {
return `https://www.youtube-nocookie.com/embed/${url.match(/\/\/www.youtube.com\/watch\?v=([-\w]+)/)?.[1]}?${new URLSearchParams({
controls: "0",
autoplay: "1",
muted: "1",
mute: "1",
}).toString()}`
} else {
return null
Expand Down

0 comments on commit 7a60e61

Please sign in to comment.