0

I am working on a React Three Fiber (R3F) project where I want to display a video texture on an iPhone model. The scene is using @react-three/fiber, @react-three/drei, and GSAP for animations. However, the video is not rendering on the iPhone screen

I am passing a videoPath to the Iphone component, where it should be applied as a THREE.VideoTexture on the iPhone screen mesh. The video file is valid, but it's not being displayed.

import React, { useRef, useEffect } from 'react'
 import { useGLTF, useVideoTexture } from '@react-three/drei'
import * as THREE from 'three'

const Iphone = ({ videoPath = "/textures/project/project2.mp4", ...props }) => {
 const { nodes, materials } = useGLTF('/models/iphone_16_pro_max.glb')

 // Simple video texture setup - exactly like DemoComputer
const txt = useVideoTexture(videoPath);

 // Simple texture flip - exactly like DemoComputer
 useEffect(() => {
     if (txt) {
    txt.flipY = false;
   }
 }, [txt]);

 return (
   <group {...props} dispose={null}>
    <group 
    scale={0.6}
    position={[0, 2, 0]}
    rotation={[0, -Math.PI / 4, 0]}
  >
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.tsgyTKhpolCmwxx.geometry}
      material={materials.zwnVxbhBDHZGbPo}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.hrZaEjXDmCILobU.geometry}
      material={materials.oOhSzasUKHWsREs}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.FQKfFqYNHmEzeuY.geometry}
      material={materials.QJGVimEibrVPDgl}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.pdMvCmwpeAkoCeW.geometry}
      material={materials.NGOEZCWBESexLKh}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.vrzjTiKmYLopiPd.geometry}
      material={materials.MEVjMzJTEhaZcvs}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.CvkOWHzrmzebcZJ.geometry}
      material={materials.wfnrEKgaVfvfqWK}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.yOTKiDjiYXuWNiO.geometry}
      material={materials.YhUwbOowNtzQZLe}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.SxLfbtOduXylABk.geometry}
      material={materials.QBlENhkjcaLJepA}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.EnNAOSEIVaSuWpJ.geometry}
      material={materials.OFXHprQRYzLWhkt}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.ADonefYsvcXtKpH.geometry}
      material={materials.DLNsJhTsXOXyRyv}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.UspOjqRKFOpussq.geometry}
      material={materials.QuZEQXUCMTTVBxj}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.aDyEHhQqdNXAeLZ.geometry}
      material={materials.ZNHJVGKIjNrOzRW}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.LECZwtQBUgZPmjO.geometry}
      material={materials.lWXWjvFkxQFrEJb}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.rXCYEDOsegyAmTC.geometry}
      material={materials.QBlENhkjcaLJepA}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.lVTCqEXnpZgSitt.geometry}
      material={materials.ZNHJVGKIjNrOzRW}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.ddADWAcmaIWGMJg.geometry}
      material={materials.rxSuxQqIANGRHiz}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.TqpalCjrkLgzLpV.geometry}
      material={materials.vWGShIUIFDWIHYr}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.ZSqPKeYlKPxNEWB.geometry}
      material={materials.QBlENhkjcaLJepA}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.IdYmieSpbujhCxc.geometry}
      material={materials.IBHMPqMUMTOtrsI}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.TUsusthksXuZbdf.geometry}
      material={materials.IBHMPqMUMTOtrsI}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.PKOrlrAAsMwBNrS.geometry}
      material={materials.vXjtXBPImOlMFxP}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.EcAdhMVXbAtIiex.geometry}
      material={materials.dFvoMIRCoaDUnbM}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.YweGVzDlCDdQbSP.geometry}
      material={materials.UkyZxgsBKiwdZzy}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.ZRtlLQRpMvpEADx.geometry}
      material={materials.QBlENhkjcaLJepA}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.wDBHeqowZtDZGth.geometry}
      material={materials.qIXaGTQgppLzNuS}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.OHcIOEYzhYtjZfD.geometry}
      material={materials.qnEUnGQjuQXNKxN}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.vQAdhEOTkzywBVs.geometry}
      material={materials.ZNHJVGKIjNrOzRW}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.geXCrkUTdpsOETR.geometry}
      material={materials.ijukKFNnAiQVUgK}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.dpTdOHwevMCzFCc.geometry}
      material={materials.vWGShIUIFDWIHYr}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.yzVrQWTbOqmJlir.geometry}
      material={materials.vWGShIUIFDWIHYr}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.EhaagtpNhMohbPJ.geometry}
      material={materials.vWGShIUIFDWIHYr}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.EVXmPvIzEklwlrA.geometry}
      material={materials.CQUuMVcFqmaZHvO}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.ctvWVgnrlOtlGZG.geometry}
      material={materials.UuNCqMhYjxSulgC}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.chNeXxuoZrzIryy.geometry}
      material={materials.QBlENhkjcaLJepA}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.pFTrDqfkYaVRCGU.geometry}
      material={materials.DLNsJhTsXOXyRyv}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.bVbdLUyDrkGwXtx.geometry}
      material={materials.lWXWjvFkxQFrEJb}
    />
    <mesh
      name="iphone-screen"
      geometry={nodes.vMoesygglprJqFc.geometry}
      position={[0, 0, 0.001]}>
      <meshBasicMaterial 
        map={txt} 
        toneMapped={false}
      />
    </mesh>
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.DYVTLtqMHTsYIjj.geometry}
      material={materials.iHjXNCbUYNhbbsZ}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.isWRMwSjKGqbTVD.geometry}
      material={materials.kBKcxpwXdiSGtcj}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.PTNFFQQRBkFUtRF.geometry}
      material={materials.awGbShLpHNnWFsk}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.uIYCqblZmuXPYYI.geometry}
      material={materials.MEVjMzJTEhaZcvs}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.MdAxmZRZiXvBTSO.geometry}
      material={materials.QBlENhkjcaLJepA}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.TfdHbcSiQvZFjbF.geometry}
      material={materials.gjhXpiTpQEgCxGd}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.mNqQyZjhwWciNUh.geometry}
      material={materials.ZNHJVGKIjNrOzRW}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.ylWRHNdlCRPqtsy.geometry}
      material={materials.qIXaGTQgppLzNuS}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.tJNZWjOtMfbyhUT.geometry}
      material={materials.vWGShIUIFDWIHYr}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.kIZQXPmeDWRVqtz.geometry}
      material={materials.nbOnQEWaQWgFLwI}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.vaipIEiiaMhzzbv.geometry}
      material={materials.YhUwbOowNtzQZLe}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.YonvKvLHVPxiPhx.geometry}
      material={materials.qnEUnGQjuQXNKxN}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.AahIxhydztcJZuH.geometry}
      material={materials.awGbShLpHNnWFsk}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.EdYbTyFeZQnIeQC.geometry}
      material={materials.MEVjMzJTEhaZcvs}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.YZBECLUDGvviBZT.geometry}
      material={materials.QBlENhkjcaLJepA}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.iyxIOoaWPPUHmJl.geometry}
      material={materials.gjhXpiTpQEgCxGd}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.fevtYqSltnPKyZr.geometry}
      material={materials.ZNHJVGKIjNrOzRW}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.aeMcXvvBPXEDaTv.geometry}
      material={materials.qIXaGTQgppLzNuS}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.yLDQEQsvcAPyhgS.geometry}
      material={materials.vWGShIUIFDWIHYr}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.fosjWHinlvDIxtE.geometry}
      material={materials.nbOnQEWaQWgFLwI}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.NUhDlFXZPjCanRE.geometry}
      material={materials.YhUwbOowNtzQZLe}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.LDqFywaUpScBDDA.geometry}
      material={materials.PqWcJHzUvFhVflS}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.rXKKjlYsSVqMAUK.geometry}
      material={materials.qnEUnGQjuQXNKxN}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.uhddvjVCxhzvtwR.geometry}
      material={materials.awGbShLpHNnWFsk}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.fFmXVXqSRBWQVTj.geometry}
      material={materials.MEVjMzJTEhaZcvs}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.cfEKqTzNqGyraVw.geometry}
      material={materials.QBlENhkjcaLJepA}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.OygdxdbWLzGYnuM.geometry}
      material={materials.gjhXpiTpQEgCxGd}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.KrJOUieSuKotJJa.geometry}
      material={materials.ZNHJVGKIjNrOzRW}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.CgYEYEEkhDTpxZQ.geometry}
      material={materials.qIXaGTQgppLzNuS}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.ulyoGeNTOIAWLTN.geometry}
      material={materials.vWGShIUIFDWIHYr}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.nhhtQijpvnjtShG.geometry}
      material={materials.nbOnQEWaQWgFLwI}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.xFqjNekJnblRPew.geometry}
      material={materials.YhUwbOowNtzQZLe}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.yHbaUiTFREbQPQg.geometry}
      material={materials.qnEUnGQjuQXNKxN}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.uRBXhKNBBqOjQFP.geometry}
      material={materials.YoSpklWOdWUJsej}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.vfYbiNrpnUCSaOM.geometry}
      material={materials.qGllEwRHParppQH}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.KqTqIZqDmnQdXvh.geometry}
      material={materials.vWGShIUIFDWIHYr}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.UbWNRcuQqVxCOmc.geometry}
      material={materials.vWGShIUIFDWIHYr}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.fmzdNzuJtyiMbFm.geometry}
      material={materials.YhUwbOowNtzQZLe}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.XbslRiSRaHJtuKi.geometry}
      material={materials.rxSuxQqIANGRHiz}
    />
    <mesh
      castShadow
      receiveShadow
      geometry={nodes.hzKXTKhgVdRyxai.geometry}
      material={materials.QuZEQXUCMTTVBxj}
     />
    </group>
  </group>
  )
 }

  useGLTF.preload('/models/iphone_16_pro_max.glb')
  export default Iphone;
1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.