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