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

Why is AR.js waitin for domElement.videoWidth before adding video element to DOM? #670

Closed
smuddy opened this issue Dec 6, 2019 · 3 comments

Comments

@smuddy
Copy link
Contributor

smuddy commented Dec 6, 2019

Describe the bug
Because iOS does not allow getUserMedia in third party apps using the WkWebView (p.e. Cordova) there is a native mock that hooks the navigator.getUserMedia function and provides the camera stream.
Unfortunately the property element.videoWidth is not set.

So my questsion is: why does AR.js wait for the stream inisitialisation inside ARjs.Source.protoype._initSourceWebcam? If I directly show the video element after assigning the stream, is see no side effects. Imho there is no need to wait.

To Reproduce

  • setup cordova iOS project
  • install plugin cordova-plugin-iosrtc and register the golbal hooks
  • copy AR.js project into ww folder
  • run cordova app

Expected behavior
App should initialize AR.js and show the camera image.
But it waits with an interval for element.videoWidth as trigger for adding video element to the DOM.

Smartphone (please complete the following information):

  • Device: iPhone 7 & XR
  • OS: 13.2.2
  • Browser WkWebView
@nicolocarpignoli
Copy link
Collaborator

hi!
Please provide a PR for this, we will look into that, do tests, and if no problems are added but only enhancements, we will merge it

ongeo-dev pushed a commit to ongeo-dev/AR.js that referenced this issue Dec 10, 2019
It seems not to be necessary to wait for the stream, so it could be shown directly.
Also added some missing semicolons.
@ongeo-dev
Copy link

PR is on the way...

ongeo-dev pushed a commit to ongeo-dev/AR.js that referenced this issue Dec 10, 2019
It seems not to be necessary to wait for the stream, so it could be shown directly.
Also added some missing semicolons.
nicolocarpignoli added a commit that referenced this issue Dec 22, 2019
nicolocarpignoli pushed a commit that referenced this issue Feb 3, 2020
It seems not to be necessary to wait for the stream, so it could be shown directly.
Also added some missing semicolons.
nicolocarpignoli added a commit that referenced this issue Feb 3, 2020
@benallfree
Copy link
Contributor

@smuddy Do you have a demo repo? I'm working on iosrtc+AR.js too.

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

No branches or pull requests

4 participants