-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Modules] swf expects global Webcam object for hooks #63
Comments
I apologize, but I don't know anything about CommonJS, or how it works. Couldn't you just add a |
AMD modules will have the same issue. If I spent a while tracking down why the swf wasn't working for me. It kept saying that it wasn't loaded, even though I could see that it was working. I had to add some console.logs before I realized that the flash hooks weren't being called. It wasn't immediately apparent what the issue was. For now, I have just required webcamjs and assigned it to the window, but I'm sure other users will run into this issue. |
Okay, I think I see what you are saying. I'm so sorry this caused an issue for you. I have to admit, I know absolutely nothing about CommonJS, AMD, RequireJS, or any of those module loaders. The module support in this library was coded by someone else and sent to me as a pull request, and I blindly accepted it without understanding the ramifications: I guess I should remove that wrapper. Sorry! I really need to read up on JS modules and how they work. I am a total n00b at this. |
No worries! Thanks for being so responsive! |
Hi positlabs, |
I made a PR for this. It's WAY diverged from the main branch, but you can see my solution here: #66 Another option might be something involving iframes. I think that would work... |
The solution #66 seems challenging for me to digest yet. I'll give it a try. Thanks a lot. |
It's a lot of work, but it doesn't change any of the functionality other than being able to use multiple instances. I hope this gets you started. Good luck! |
Your guide above was very helpful. I was able to activate two webcams after trials. I appreciate your helps. |
@myongjailee How were you able to update the .as file and recompile the .swf? I'm struggling because positlab's forked repo is a year old, so doesn't have the latest .swf changes, but it has a change required to support multiple webcam instances. |
I was able to run two webcams working with a little modification of positlabs source(index.js file). No modification of .as file was made. This is the part to create two webcams.
And you need to set the "construct object/embed tag" part, too:
|
Using webcamjs with a module system (commonjs) is currently incompatible with the webcam.swf callback hooks. I'm guessing that it's expecting there to be a global
Webcam
object with aflashNotify
method.To solve this, we could define a unique method name on the window, and pass the name to the swf when it is created.
window.__webcamjs-flash-notify_{uuid} = function(type, msg){...}
This would allow easy(er) setup with module systems.
What do you think?
The text was updated successfully, but these errors were encountered: