Skip to content

Commit

Permalink
YT embed tweak (#6789)
Browse files Browse the repository at this point in the history
* tweak css

* fix typo

* More tweak

---------

Co-authored-by: Dan Abramov <[email protected]>
  • Loading branch information
mozzius and gaearon authored Nov 27, 2024
1 parent 47cbdfe commit 29b3b3d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions bskyweb/static/iframe/youtube.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,21 @@

let player
function onYouTubeIframeAPIReady() {
let videoId = url.searchParams.get('videoId')
videoId = decodeURIComponent(videoId)
videoId = videoId.replace(/[^a-zA-Z0-9_-]/g, "")
if (videoId.length !== 11) throw new Error("Invalid video ID")

let start = url.searchParams.get('start')
start = start.replace(/[^0-9]/g, "")

player = new YT.Player('player', {
width: "1000",
height: "1000",
videoId: url.searchParams.get('videoId'),
videoId,
playerVars: {
autoplay: 1,
start: url.searchParams.get('start'),
start,
rel: 0,
loop: 0,
playsinline: 1,
Expand Down

0 comments on commit 29b3b3d

Please sign in to comment.