Invalid view returned from registry, expecting EXVideo, got: (null)
jamesbechet opened this issue · comments
This issue persists on standalone non-detached iOS app.
Environment
Production.
Steps to Reproduce
Since it's a production issue, I am not sure how to reproduce it and the sentry logs don't help.
Expected Behavior
This seems to be where the error is being triggered: https://github.com/expo/expo/blob/master/ios/Exponent/Versioned/Core/Api/AV/EXAV.m#L399
Any idea how this could happen?
Actual Behavior
No error being triggered.
Reproducible Demo
N/A
Hi @jamesbechet - it's very hard for us to figure out what's going on without a repro case. Could you please post a minimal, complete, and verifiable example that demonstrates this issue? That will help us help you out a lot more quickly and efficiently. Thanks!
Hi @esamelson, unfortunately I can't reproduce the issue locally. Do you have a general idea what could cause reaching this line: https://github.com/expo/expo/blob/master/ios/Exponent/Versioned/Core/Api/AV/EXAV.m#L399
@sjchmiela - any idea what could be going wrong here?
No, unfortunately. 😕
All good, thanks for your help.
We have the same error in production on a subset of our users. We are looking into it.
@coulix interesting, please let me know if you get new information on that.
Hello
We are having the same error in production but since SDK 32, Sentry is reporting more of these errors.
We had not managed to reproduce it in development so far.
However, I have just had the same popping in Devtools while running the app on the iOS simulator.
I was working on a Flatlist component where the items are videos.
It's pretty random because I refreshed my app multiple times and it only appeared once.
Hi all -- could someone who is experiencing this issue provide a small example that illustrates this issue (ideally an mcve)? It sounds like there might be some sort of race condition here, and having some way to reproduce the error (even if it doesn't happen reliably every reload) would be really helpful in getting to the bottom of it. Thanks!
@esamelson Our app has a flatlist of images and everytime the user focus on an image for ~300ms it loads and starts playing a video (HLS streaming) hosted on our CDN. When the image is out of focus we unmount the video component.
So we do a lot of start / stop on those videos Although the stop is maybe not instant as the network connection stays open after umounting the video component.
@coulix if you could provide a small toy snack or github repo that demonstrates this issue (ideally with a minimal amount of code), that would go a long way in helping us narrow down the root cause. Thanks 🙂
I made a tiny repro repo!
https://github.com/vpontis/expo-camera-bug
I am getting this error with EXCamera
on a bare app.
UPDATE: I forgot to mention that this is with the bare template on Expo 33. The changes I made were to add expo-camera
and to set up the App.js
to try and takePictureAsync
.
@vpontis, your repository contains one issue that leads to presented problem line 29 in App.js. You're loosing this
context by retrieving function reference from cameraRef
object. In next lines you're calling this function with this
that comes from takePhotoAsync
scope and that is causing the problem, because takePhotoAsync
requires this
that comes from camereRef
object scope.
Solution for this issue is to invoke takePictureAsync
directly as a property of cameraRef
object - that would preserve correct this
context for this method invocation.
That snippet would do the trick:
const capturedPicture = await this.cameraRef.takePictureAsync({
...
});
@bbarthec that works! I'm impressed :)
Thanks so much for the help.
I pushed the fix here and updated the sample repo: https://github.com/vpontis/expo-camera-bug
Hopefully this helps people in the future...
For me, I had this issue with loading videos similar to @coulix and it turned out to be due to trying to call the unloadAsync method on video slide components in componentWillUnmount. My guess is that my Feed component was trying to re-render video components where the video had been unloaded from memory. Once I commented it out it started to work again. I wasn't able to recreate the issue on a simulator however but here is a link to a snack that basically shows my use case: https://snack.expo.io/@aldrinc/optimized-video-flatlist.
My use case is a feed of videos (1 per full screen slide) that a user can swipe up to view. Each time I swiped I would receive the aforementioned error.
Possible Unhandled Promise Rejection (id: 3):
Error: Invalid view returned from registry, expecting EXVideo, got: (null)
Error: Invalid view returned from registry, expecting EXVideo, got: (null)
componentWillUnmount() {
if (this.video) {
this.video.unloadAsync(); // This guy was the culprit
}
}
It's been a while since we've had any activity on this issue, and seeing as it needs more info before we can properly address it, we will be closing it in one month. If you've found a fix, please share it! Otherwise, please provide the info we asked for, especially a reproducible example. Thanks!
This issue has been automatically closed since there has not been any recent activity after it was marked as stale. Please open a new issue for any related bugs.
The issue still actual.
react-native-video has the same problem.
Anyone have a solution to this?
I'm also using a flatlist of videos and having this issue. My problem is that in production builds, sometimes the videos have a bug where after it is unmounted the video sound continues playing even though it has been completely removed from the React tree.
I tried to work around this by accessing the ref
on unmount and calling unloadAsync
but it always gives the Invalid view returned from registry, expecting EXVideo, got: (null)
error, which presumably is because it was unmounted before my unmount call?
I have managed to get rid of this error just by adding the then catch blocks to unloadAsync function.
this.videoRef?.unloadAsync().then().catch((e)=> {})
I'm getting this error after upgrading my packages and i opened a new issue #18402. @esamelson I have an example in a snack but it's not showing the error because I think the versions aren't the same. I couldnt set the SDK to 46 on the snack and expo-av to 12.0.2 which is the versions my package is set to.
had this error when scrolling flatlist down to carousel with video inside of it:
I had pauseAsync() on carousel swipe, which showed this error, so I changed this:
useEffect(() => {
video?.current?.pauseAsync();
}, [index]);
to
useEffect(() => {
if (index !== 0) {
video?.current?.pauseAsync();
}
}, [index]);
also my Video component had shouldPlay={false} prop