fix some youtube videos not properly loading (#2726)

* add player iframe to bskyweb

* iframe for youtube content

* update tests

* ts error
This commit is contained in:
Hailey 2024-02-06 11:05:17 -08:00 committed by GitHub
parent a9ab13e5a9
commit 856f80fc6d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 71 additions and 23 deletions

View file

@ -78,9 +78,13 @@ function Player({
onLoad: () => void
}) {
// ensures we only load what's requested
// when it's a youtube video, we need to allow both bsky.app and youtube.com
const onShouldStartLoadWithRequest = React.useCallback(
(event: ShouldStartLoadRequest) => event.url === params.playerUri,
[params.playerUri],
(event: ShouldStartLoadRequest) =>
event.url === params.playerUri ||
(params.source.startsWith('youtube') &&
event.url.includes('www.youtube.com')),
[params.playerUri, params.source],
)
// Don't show the player until it is active