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:
parent
a9ab13e5a9
commit
856f80fc6d
5 changed files with 71 additions and 23 deletions
|
@ -1,4 +1,5 @@
|
|||
import {Dimensions, Platform} from 'react-native'
|
||||
import {Dimensions} from 'react-native'
|
||||
import {isWeb} from 'platform/detection'
|
||||
const {height: SCREEN_HEIGHT} = Dimensions.get('window')
|
||||
|
||||
export const embedPlayerSources = [
|
||||
|
@ -73,7 +74,7 @@ export function parseEmbedPlayerFromUrl(
|
|||
return {
|
||||
type: 'youtube_video',
|
||||
source: 'youtube',
|
||||
playerUri: `https://www.youtube.com/embed/${videoId}?autoplay=1&playsinline=1&start=${seek}`,
|
||||
playerUri: `https://bsky.app/iframe/youtube.html?videoId=${videoId}&start=${seek}`,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +93,7 @@ export function parseEmbedPlayerFromUrl(
|
|||
type: page === 'shorts' ? 'youtube_short' : 'youtube_video',
|
||||
source: page === 'shorts' ? 'youtubeShorts' : 'youtube',
|
||||
hideDetails: page === 'shorts' ? true : undefined,
|
||||
playerUri: `https://www.youtube.com/embed/${videoId}?autoplay=1&playsinline=1&start=${seek}`,
|
||||
playerUri: `https://bsky.app/iframe/youtube.html?videoId=${videoId}&start=${seek}`,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,8 +104,10 @@ export function parseEmbedPlayerFromUrl(
|
|||
urlp.hostname === 'www.twitch.tv' ||
|
||||
urlp.hostname === 'm.twitch.tv'
|
||||
) {
|
||||
const parent =
|
||||
Platform.OS === 'web' ? window.location.hostname : 'localhost'
|
||||
const parent = isWeb
|
||||
? // @ts-ignore only for web
|
||||
window.location.hostname
|
||||
: 'localhost'
|
||||
|
||||
const [_, channelOrVideo, clipOrId, id] = urlp.pathname.split('/')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue