augmentmy-world / arStudio

A innovative Web editor for Augmented Reality
https://webarstudio.tripod-digital.co.nz
MIT License
53 stars 34 forks source link

Errors while closing the simulation viewport #5

Closed kalwalt closed 4 years ago

kalwalt commented 4 years ago

When the simulation is stopped an error message is showed in the console:

 + FINISH 
arcontroller.compone…js?version=0.64:306 Stop AR
arcontroller.compone…js?version=0.64:311 Uncaught TypeError: Cannot read property 'getTracks' of null
    at ArControllerComponent.stopAR (arcontroller.compone…js?version=0.64:311)
    at Object.trigger (litegl.js?version=0.64:10617)
    at Scene.finish (litescene.js?version=0.64:14467)
    at Object.changeState (play.js?version=0.64:300)
    at Object.onPlay (play.js?version=0.64:128)
ThorstenBux commented 4 years ago

Yeah, I know. the UserMediaAPI has changed in the mean time. We need to fix that. Also the arCamera node is not removed after stoping the scene which leads to these nodes piling up

kalwalt commented 4 years ago

yes i saw them, and it make difficult to manage the nodes too.

ThorstenBux commented 4 years ago

I had that issue once so I think that is solvable

kalwalt commented 4 years ago

This issue was caused because the video was deleted by calling dispose() https://github.com/augmentmy-world/arStudio/blob/08583457e9969023168b86d0eefd24f37a151659/editor/js/components/arcontroller.component.js#L308 inside stopAr() as a consequence the video src was null and the the this._video.srcObject.getTracks()[0].stop(); found anything to remove. That commit solve also the other issue related to arCamera.

kalwalt commented 4 years ago

Solved with #6