disable findAndActivateVideo on native
This commit is contained in:
@@ -8,6 +8,7 @@ import React, {
|
||||
} from 'react'
|
||||
import {useWindowDimensions} from 'react-native'
|
||||
|
||||
import {isNative} from '#/platform/detection'
|
||||
import {VideoPlayerProvider} from './VideoPlayerContext'
|
||||
|
||||
const ActiveVideoContext = React.createContext<{
|
||||
@@ -28,6 +29,8 @@ export function ActiveVideoProvider({children}: {children: React.ReactNode}) {
|
||||
const measurementCallbacks = useRef<Record<string, () => DOMRect | void>>({})
|
||||
|
||||
useEffect(() => {
|
||||
if (isNative) return
|
||||
|
||||
const findAndActivateVideo = () => {
|
||||
if (Object.keys(measurementCallbacks.current).length === 0) {
|
||||
return
|
||||
|
||||
@@ -22,7 +22,11 @@ export function VideoPlayerProvider({
|
||||
// make sure we're playing every time the viewId changes
|
||||
// this means the video is different
|
||||
useEffect(() => {
|
||||
player.play()
|
||||
if (viewId === null) {
|
||||
player.pause()
|
||||
} else {
|
||||
player.play()
|
||||
}
|
||||
}, [viewId, player])
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user