bombbomb / BBCore

A Javascript API to use BombBomb services
4 stars 12 forks source link

What is the proper way to clean up a BBCore instance? #12

Closed DubHunt closed 7 years ago

DubHunt commented 7 years ago

So, I'm creating an instance of BBCore and providing a div as the target to startVideRecorder which is contained in a modal. When that modal closes, the div is removed from the DOM. As noted in #6 , there is a handler attached to message events on window that never seems to get cleaned up. I tried calling invalidateSession, but that results in an error, which I reported in #11. I've also tried calling destroyVideoRecorder, but the listener does not get cleaned-up there either.

Additionally, I'd like to be able to relinquish controls of the mic/camera so that the browse does not keep indicators on the tab and in the location bar regarding their use. It's confusing to the user who no longer sees the modal with the recorder.

I don't see anything in the docs or example code regarding this. Any help is greatly appreciated.

perl5punk commented 7 years ago

These issues were largely related to the recorder an should no longer be occurring.

tedg commented 7 years ago

Hi, sorry to revive this but I'm still very much getting JS errors about the handler attached to message events on window as noted above. I have been in and out of the library and trying out some dom trickery trying to get around this so I can do multiple videos on the same page load but nothing really works out. I know this is closed, am I missing something for solving this?

BBCore can almost re-use the existing iFrame if you remove it using jQuery's detach(), but the call to store the thumbnail always uses the original videoId, so no luck there.

It would be great if we could at the very least get a reference to the callback that the event listener uses so that we may use removeEventListener on it.