Add timestamp field to video report dialog (#11339)

This commit is contained in:
DS Boyce
2026-08-06 12:11:05 -07:00
committed by GitHub
parent 724013df1b
commit 1c349ad7da
27 changed files with 402 additions and 119 deletions
@@ -22,8 +22,8 @@ import {scheduleOnRN, scheduleOnUI} from 'react-native-worklets'
import {useEventListener} from 'expo'
import {type VideoPlayer} from 'expo-video'
import {formatTime} from '#/lib/media/video/formatTime'
import {atoms as a, tokens} from '#/alf'
import {formatTime} from '#/components/Post/Embed/VideoEmbed/VideoEmbedInner/web-controls/utils'
import {Text} from '#/components/Typography'
// magic number that is roughly the min height of the write reply button
+24 -2
View File
@@ -97,6 +97,7 @@ import * as Layout from '#/components/Layout'
import {Link} from '#/components/Link'
import {ListFooter} from '#/components/Lists'
import * as Hider from '#/components/moderation/Hider'
import * as ReportDialogMetadataContext from '#/components/moderation/ReportDialog/ReportDialogMetadataContext'
import {PostControls} from '#/components/PostControls'
import {RichText} from '#/components/RichText'
import {Text} from '#/components/Typography'
@@ -112,7 +113,7 @@ function createThreeVideoPlayers(
const eventInterval = platform({
ios: 0.2,
android: 0.5,
default: 0,
default: 0.2,
})
const p1 = createVideoPlayer(sources?.[0] ?? '')
p1.loop = true
@@ -528,7 +529,7 @@ let VideoItem = ({
// we can't distinguish between them
const shouldRenderVideo = active || ios(adjacent)
return (
const content = (
<View style={[a.relative, {height, width}]}>
{postShadow === POST_TOMBSTONE ? (
<View
@@ -573,6 +574,12 @@ let VideoItem = ({
)}
</View>
)
return (
<ReportDialogMetadataContext.Provider key={post.uri}>
{content}
</ReportDialogMetadataContext.Provider>
)
}
VideoItem = memo(VideoItem)
@@ -587,6 +594,8 @@ function VideoItemInner({
}) {
const {bottom} = useSafeAreaInsets()
const [isReady, setIsReady] = useState(!IS_ANDROID)
const reportDialogMetadata =
ReportDialogMetadataContext.useReportDialogMetadataContext()
usePlaybackTelemetry({player, active, playlist: embed.playlist})
@@ -594,6 +603,19 @@ function VideoItemInner({
if (IS_ANDROID && !isReady && evt.currentTime >= 0.05) {
setIsReady(true)
}
/*
* Players are pooled and reassigned as the user swipes. Only trust the item
* that's actually on screen.
*/
if (
active &&
embed.presentation !== 'gif' &&
reportDialogMetadata &&
Number.isFinite(evt.currentTime) &&
evt.currentTime >= 0
) {
reportDialogMetadata.current.videoTimestampSeconds = evt.currentTime
}
})
return (