Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load resource error #29

Open
djipco opened this issue Jan 10, 2020 · 2 comments
Open

Failed to load resource error #29

djipco opened this issue Jan 10, 2020 · 2 comments
Assignees
Labels

Comments

@djipco
Copy link

djipco commented Jan 10, 2020

I have a project that uses the CanvasCameraPlugin. With a vast majority of frames, it works fine. But, I keep getting this error randomly in the console:

[Error] Failed to load resource: The requested URL was not found on this server. (f2-canvascamera.jpg, line 0)

In fact, it's not so random. It happens shortly after I start the camera (after 1 or 2 frames), then it happens randomly and then one last time when I stop the camera (each time). But, as I said, most frames are loaded normally (I can see them in the Resources tab of the Safari Inspector):

image

These are my options:

{fps: 2, use: "file", cameraFacing: "front"}

I'm not using onCapture, onBeforeDraw or onAfterDraw.

It's as though the images are being prematurely deleted from the device. Perhaps it's something else but I'm running out of ideas. Do you think this can be a bug with the library? Or maybe you would know what I could check to try and solve this?

Thanks a lot!

@Sami-Radi
Copy link
Collaborator

Hello,

The plugin keeps as many images as the fps in cache. So I guess that with 2 fps, there might be a lag between the time when the app renders the frame and the currently processed frames by the native part which could explain that some frames are missing after being rendered.

I'll check that out. However, with 2 fps you could use the use: "data" option to use the image base64 data, it's more cpu/ram consuming but you shouldn't feel any différence with 2 fps and you shouldn't have any rendering problems.

Best Regards

@Sami-Radi Sami-Radi self-assigned this Jan 14, 2020
@Sami-Radi Sami-Radi added the bug label Jan 14, 2020
@djipco
Copy link
Author

djipco commented Jan 14, 2020

The plugin keeps as many images as the fps in cache. So I guess that with 2 fps, there might be a lag between the time when the app renders the frame and the currently processed frames by the native part which could explain that some frames are missing after being rendered.

This is very insightful. I didn't know this is how it worked. Knowing that, I'm pretty sure this is the source of the issue. I'm running this code on old iPhone 5s devices which are not particularly fast...

However, with 2 fps you could use the use: "data" option to use the image base64 data

This is actually what I started with. The problem is that the application crashes after an hour or so when I use this option. It's not clear if the problem is from CanvasCamera or my own code, though. The use: "file" option has been very stable for me and I'd rather stick with it.

Would it be possible for CanvasCamera to keep a minimum number of files (e.g. 10) even if the frame rate is lower than that? It would probably be safer this way... This is just a suggestion. I'm out of my league here. Anyway, thank for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants