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

Restart Camera if Camera freezes #46

Open
freeminders123 opened this issue Feb 25, 2020 · 3 comments
Open

Restart Camera if Camera freezes #46

freeminders123 opened this issue Feb 25, 2020 · 3 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@freeminders123
Copy link

freeminders123 commented Feb 25, 2020

Hi,

I have a question: Currently, we got a Problem on Chrome for Android: If we open a new Tab for a website (not every website, but e.g. on LinkedIn and Facebook) and return back to our AR-View the camera freezes. Is there a simple way to restart the camera feed only (without reloading everything)? And if so, which calls would I have to make?

To check if the camera freezes, I use the currentTime property of the video feed returned from ARController.getUserMediaThreeScene() and compare it to the previous values.

Thanks in advance :-)

@kalwalt kalwalt added help wanted Extra attention is needed question Further information is requested labels Feb 25, 2020
@kalwalt
Copy link
Owner

kalwalt commented Feb 25, 2020

I never faced this problem so i can't say so much at the moment, maybe @nicolocarpignoli has an idea?

@freeminders123
Copy link
Author

freeminders123 commented Feb 26, 2020

For giving an example: I have a Three.js scene with some images. When I click on them, I open a new Website using window.open(url, '_blank'). This works as expected. But when I switch the Tab back to my AR-website, the last image of the camera is still present and doesn't update anymore. But the slight flickering of the content displayed on the marker and the working render() method tell me, that the tracking seems to be working (just for that one camera image). So the Three-Scene itself does not freeze, it is just the camera feed, which doesn't update anymore. I also added the video element to the page to confirm its not just the rendering which freezes. But even this video element does not update.

This only happens on Android devices using Chrome, on iOS this seems to work, although, if I open a new page in Safari and do not close the new tab when switching back, the OS prevents the camera from working (black screen in AR), but I think this is some kind of weird security feature in iOS.

@innovaciones
Copy link

One solution to handle this issue is to pause the camera video using myVideo.pause() triggered from a document.addEventListener(visibilityChange, doSomething, false) when the user minimize their window and handle the event with a big play button to resume the video using myVideo.play() this is just a fancy way of telling the user that needs to press play to reactivate the camera feed to prevent the black screen on iOS or the freezed image on Android.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants