headtrackr icon indicating copy to clipboard operation
headtrackr copied to clipboard

htracker.stop() does not work from an eventlistener

Open auduno opened this issue 10 years ago • 12 comments

when calling stop() on a headtracker instance from an eventlistener, an InvalidStateError is raised in Chrome:

Uncaught InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable.

auduno avatar Nov 05 '13 17:11 auduno

May you provide a jsFiddle? I couldn't reproduce that error.

DanielMSchmidt avatar Jan 13 '14 18:01 DanielMSchmidt

This is happening to me as well (trying to use headtrackr in the main Controller of an AngularJS App), but i can't find the cause of the problem...if it helps they were talking about the same error here as well: http://auduno.tumblr.com/post/25125149521/head-tracking-with-webrtc

UPDATE: i just realized that the tumbler it's from @auduno :) Any updates on this? (i'm not using htracker.stop())

ricricucit avatar Feb 27 '14 15:02 ricricucit

I haven't really had time to look at it, unfortunately. Do you have the possibility to create an example of the bug in a dropbox or jsfiddle page?

auduno avatar Feb 27 '14 16:02 auduno

Well i actually solved MY problem (which was something quite stupid).

To explain it, to those who might get the same problem:

Inside document.addEventListener("facetrackingEvent", function( event ) { i was doing: overlayContext.drawImage(stickImage,some,other,stuf,etc); Where stickImage didn't actually contain an image.

I'm sure that is not a bug of headtrackr tho.

ricricucit avatar Feb 27 '14 16:02 ricricucit

Haha, great to hear it's not my fault :)

auduno avatar Feb 27 '14 16:02 auduno

Sorry, if it's not a good place to ask, but is there way to stop getUserMedia at all from headtrackr?

havenchyk avatar Apr 11 '14 06:04 havenchyk

If you mean stopping webcam stream, no. headtrackr.stop() merely stops the tracking, not the video. The correct way to stop a getusermedia stream is to call stop() on the mediastream, but I guess you also can call stop() or pause() on the video element.

auduno avatar Apr 11 '14 07:04 auduno

@auduno, thanks for quick response. As I see, mediastream is placed deep into headtrackr.js, can I get mediastream outside headtrackr.js src to stop it? Sorry for this type of questions, headtrackr.js is too complicated for me, haven't success with it for several days.

havenchyk avatar Apr 11 '14 07:04 havenchyk

Hmm, it seems I should have added functionality for this. As far as I can tell, it's not possible to stop the mediastream without the mediastream object, which I discard after I set it up. I'll try to add functionality for that within the next couple of days.

auduno avatar Apr 11 '14 08:04 auduno

@auduno oh, thanks, it would be great! Should I create new issue for this? If you give me a tips, what need to do, I can try to male a pr

havenchyk avatar Apr 11 '14 08:04 havenchyk

I created a new issue for it now here : https://github.com/auduno/headtrackr/issues/24

auduno avatar Apr 11 '14 12:04 auduno

cool, thanks

havenchyk avatar Apr 11 '14 12:04 havenchyk