-
Notifications
You must be signed in to change notification settings - Fork 503
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
No possibility to stop mediastream opened by headtrackr.init() #24
Comments
+1 for this. |
I don't think I'll add the shim in headtrackr, but I was thinking of creating an option for providing your own videoElement "as is", i.e. without setting up getUserMedia, so you could then set up video with the getUserMedia shim first and provide the videoelement to headtrackr. I'll have to look at the complications wrt the rest of the code of doing this, though. |
Fair enough. It might even be a better idea. |
Alright, I've now added a function to stop the mediastream, so you can now call
on your instance of headtrackr to stop streaming from the webcam. You can also get the mediastream object from the htracker.stream property. I've also added the boolean parameter setupVideo to init(), so you have the possibility to use the videoElement "as is" by calling:
In the case you try to use the getUserMedia shim mentioned, and it's falling back to flash, I think you have to copy the video from the flash element onto a canvas (every 1/24 second or so) and pass that on to init() as the video element instead. |
brilliant. thanks. |
Do you stop the headtracker (i.e. call htracker.stop() ) as well when you stop the stream? Or do you just call htracker.stopStream() ? |
huh, that's weird. It works for me. Do you see any error messages in console? |
I can't reproduce this. Could you share the code you're using or a mockup on dropbox or somewhere? |
@auduno this is working fine at our end now, the error in the previous message by Raees ("Cannot read property 'getTrackingObject' of undefined") was due to some issue in our code. Many thanks for adding this functionality. |
It is not possible to close the getUserMedia mediastream opened by headtrackr on init(), since the mediastream pointer is discarded after initialization. The solution is to not discard the pointer and possibly add a method to close/stop the stream.
The text was updated successfully, but these errors were encountered: