render adjacent players on ios (#7525)

This commit is contained in:
Samuel Newman
2025-01-21 18:59:13 +00:00
committed by GitHub
parent bdda3020f6
commit 45b5af604a
+12 -2
View File
@@ -76,7 +76,7 @@ import {List} from '#/view/com/util/List'
import {PostCtrls} from '#/view/com/util/post-ctrls/PostCtrls' import {PostCtrls} from '#/view/com/util/post-ctrls/PostCtrls'
import {UserAvatar} from '#/view/com/util/UserAvatar' import {UserAvatar} from '#/view/com/util/UserAvatar'
import {Header} from '#/screens/VideoFeed/components/Header' import {Header} from '#/screens/VideoFeed/components/Header'
import {atoms as a, platform, ThemeProvider, useTheme} from '#/alf' import {atoms as a, ios, platform, ThemeProvider, useTheme} from '#/alf'
import {setNavigationBar} from '#/alf/util/navigationBar' import {setNavigationBar} from '#/alf/util/navigationBar'
import {Button, ButtonIcon, ButtonText} from '#/components/Button' import {Button, ButtonIcon, ButtonText} from '#/components/Button'
import {Divider} from '#/components/Divider' import {Divider} from '#/components/Divider'
@@ -261,6 +261,7 @@ function Feed() {
index === currentIndex && index === currentIndex &&
currentSource?.source === post.embed.playlist currentSource?.source === post.embed.playlist
} }
adjacent={index === currentIndex - 1 || index === currentIndex + 1}
moderation={item.moderation} moderation={item.moderation}
scrollGesture={scrollGesture} scrollGesture={scrollGesture}
feedContext={item.feedContext} feedContext={item.feedContext}
@@ -460,6 +461,7 @@ let VideoItem = ({
post, post,
embed, embed,
active, active,
adjacent,
scrollGesture, scrollGesture,
moderation, moderation,
feedContext, feedContext,
@@ -468,6 +470,7 @@ let VideoItem = ({
post: AppBskyFeedDefs.PostView post: AppBskyFeedDefs.PostView
embed: AppBskyEmbedVideo.View embed: AppBskyEmbedVideo.View
active: boolean active: boolean
adjacent: boolean
scrollGesture: NativeGesture scrollGesture: NativeGesture
moderation?: ModerationDecision moderation?: ModerationDecision
feedContext: string | undefined feedContext: string | undefined
@@ -486,6 +489,11 @@ let VideoItem = ({
} }
}, [active, post.uri, feedContext, sendInteraction]) }, [active, post.uri, feedContext, sendInteraction])
// TODO: high-performance android phones should also
// be capable of rendering 3 video players, but currently
// we can't distinguish between them
const shouldRenderVideo = active || ios(adjacent)
return ( return (
<View style={[a.relative, {height, width}]}> <View style={[a.relative, {height, width}]}>
{postShadow === POST_TOMBSTONE ? ( {postShadow === POST_TOMBSTONE ? (
@@ -512,7 +520,9 @@ let VideoItem = ({
) : ( ) : (
<> <>
<VideoItemPlaceholder embed={embed} /> <VideoItemPlaceholder embed={embed} />
{active && player && <VideoItemInner player={player} embed={embed} />} {shouldRenderVideo && player && (
<VideoItemInner player={player} embed={embed} />
)}
{moderation && ( {moderation && (
<Overlay <Overlay
player={player} player={player}