Open ivanoikon opened 4 months ago
I'm guessing it is due to this line: https://github.com/pmndrs/drei/blob/bed21ea90e8de8a1bfc0dc8129dbf723dd634699/src/core/useVideoTexture.tsx#L46C3-L46C80
Perhaps we should add:
let baseUrl;
if (IS_BROWSER) {
// In a browser environment (React)
baseUrl = window.location.href;
} else {
// In a React Native environment
baseUrl = undefined
}
const url = new URL(typeof src === 'string' ? src : '', baseUrl)
according to MSDN undefined is the default option for base
option on the URL constructor
I'm guessing it is due to this line: https://github.com/pmndrs/drei/blob/bed21ea90e8de8a1bfc0dc8129dbf723dd634699/src/core/useVideoTexture.tsx#L46C3-L46C80
Perhaps we should add:
let baseUrl; if (IS_BROWSER) { // In a browser environment (React) baseUrl = window.location.href; } else { // In a React Native environment baseUrl = undefined } const url = new URL(typeof src === 'string' ? src : '', baseUrl)
according to MSDN undefined is the default option for
base
option on the URL constructor
Probably there's a problem with 'document' in line 54 too
If HTML Video element cannot be created then I guess useVideoTexture can't work in ReactNative at all
three
version: 0.164.1@react-three/fiber
version: 8.16.3@react-three/drei
version: 9.105.6node
version: 21.4.0npm
version: 10.2.4Problem description:
useVideoTexture throws an error: TypeError: Cannot read property 'href' of undefined This error is located at: in Unknown in FiberProvider in CanvasWrapper (created by App) in RCTView (created by View) in View (created by App) in App in RCTView (created by View) in View (created by AppContainer) in RCTView (created by View) in View (created by AppContainer) in AppContainer in RN3FDemo(RootComponent), js engine: hermes
Relevant code:
Any solution?