diff options
author | Hailey <me@haileyok.com> | 2024-09-06 09:31:01 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-06 09:31:01 -0700 |
commit | 60182cd874654ce925f2bfe48955d6b7499577ed (patch) | |
tree | 0812697ecbcf1e98272b63d4343f8d2de5c6bfd5 /src/view/com/util/post-embeds/ActiveVideoNativeContext.tsx | |
parent | bdff8752fbae6f3c5e485e39178793c1e14a3982 (diff) | |
download | voidsky-60182cd874654ce925f2bfe48955d6b7499577ed.tar.zst |
[Video] Add disable autoplay for native, more tweaking (#5178)
Diffstat (limited to 'src/view/com/util/post-embeds/ActiveVideoNativeContext.tsx')
-rw-r--r-- | src/view/com/util/post-embeds/ActiveVideoNativeContext.tsx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/view/com/util/post-embeds/ActiveVideoNativeContext.tsx b/src/view/com/util/post-embeds/ActiveVideoNativeContext.tsx index bdc7967cb..da8c7a98c 100644 --- a/src/view/com/util/post-embeds/ActiveVideoNativeContext.tsx +++ b/src/view/com/util/post-embeds/ActiveVideoNativeContext.tsx @@ -6,7 +6,7 @@ import {isNative} from '#/platform/detection' const Context = React.createContext<{ activeSource: string activeViewId: string | undefined - setActiveSource: (src: string, viewId: string) => void + setActiveSource: (src: string | null, viewId: string | null) => void player: VideoPlayer } | null>(null) @@ -21,12 +21,13 @@ export function Provider({children}: {children: React.ReactNode}) { const player = useVideoPlayer(activeSource, p => { p.muted = true p.loop = true + // We want to immediately call `play` so we get the loading state p.play() }) - const setActiveSourceOuter = (src: string, viewId: string) => { - setActiveSource(src) - setActiveViewId(viewId) + const setActiveSourceOuter = (src: string | null, viewId: string | null) => { + setActiveSource(src ? src : '') + setActiveViewId(viewId ? viewId : '') } return ( |