addyosmani / getUserMedia.js

Shim for getUserMedia(). Uses native implementation for modern browsers and a Flash fallback for everyone else.
MIT License
903 stars 158 forks source link

Flash callback for allow button? #47

Open binarykitchen opened 9 years ago

binarykitchen commented 9 years ago

When the Flash fallback is activated, how can I know when the user has pressed the "Allow" button under the Adobe Flash Player Settings dialogue that pops in every time?

Because I cannot save a webcam image unless the user has allowed so. Hence I wonder if there is a fallback to listen to that allow button?

binarykitchen commented 9 years ago

Hello? @addyosmani @franzenzenhofer @pablocubico @phuu @rodfersou

rodfersou commented 9 years ago

@binarykitchen I think this button is managed by flash

binarykitchen commented 9 years ago

@rodfersou you think or are you sure? i really need a callback for when the allow button is pressed. otherwise my app will never know when the webcam is ready for recording. this is really important i must say. otherwise it's totally unusable for us.

binarykitchen commented 9 years ago

@rodfersou I think I found an example where you can see that there is a callback for when the user has pressed the allowed button in the Flash dialogue, see this line https://github.com/jhuckaby/webcamjs/blob/master/webcam.js#L583

So why not investigate this deeper and add this here too?

binarykitchen commented 9 years ago

And this link confirms that it's possible: http://help.adobe.com/en_US/as3/dev/WSfffb011ac560372f3fa68e8912e3ab6b8cb-8000.html#WS5b3ccc516d4fbf351e63e3d118a9b90204-7d37

rodfersou commented 9 years ago

@binarykitchen nice!

binarykitchen commented 9 years ago

https://github.com/jhuckaby/webcamjs/issues/96#issuecomment-125720227 confirms. Do you think you could add it please?

rodfersou commented 9 years ago

@binarykitchen how can I see this problem happen? could you plese provide me the steps? can I reproduce it with a linux machine?

rodfersou commented 9 years ago

@binarykitchen I'll try to look at it on my free time if you help me to see the problem happen

binarykitchen commented 9 years ago

how to reproduce? i recommend to begin with the face-detection-demo code. in the options at https://github.com/addyosmani/getUserMedia.js/blob/gh-pages/face-detection-demo/js/demo.js#L88

add a new event, for example onAllow: function() { ... } and have it fired when the user has clicked the Allow button.

the flash dialogue to ask whether to allow/disallow flash execution always shows. regardless whether you are on linux/mac/windows i think.

rodfersou commented 9 years ago

@binarykitchen did you test with what browser and what OS?

binarykitchen commented 9 years ago

Latest Firefox v39.0 on Ubuntu v15.04

binarykitchen commented 9 years ago

Any luck?

binarykitchen commented 9 years ago

@rodfersou ping???

rodfersou commented 9 years ago

I'm using firefox v39.0 in my Ubuntu, and it is not using flash when enable the camera.

Anyway, why don't you just look for the success callback to know that the camera is working?

It would be the same with or without flash.

binarykitchen commented 9 years ago

no, you don't understand - i am working on another library (https://www.npmjs.com/package/videomail-client) where i want to make it work for IE9+ too. i am looking for a library to encapsulate all the webcam communication plus all their events behind it.

this one library is almost a perfect match. all i need is an event to be triggered for when the user has granted the permission to access webcam. this regardless whether it's done via the getusermedia or via the flash path.

i need such a 'granted' event so that i can trigger someting else in the videomail-client for a very good reason.

i've seen other flash frameworks being able to catch and forward that event. so can you please add it?

hope this explains ...

rodfersou commented 9 years ago

@binarykitchen what I mean is that if don't grant access it will not trigger the success callback..

rodfersou commented 9 years ago

you can work with this

binarykitchen commented 9 years ago

i think we do not understand each other.

tell me, what callback is triggered then access is granted? there is no such callback at the moment.

rodfersou commented 9 years ago

success callback do it.

simple test: open the demo page and with chrome dev tools put a callback into success callback.

you will see that it will be triggered just when you allow to use the webcam

binarykitchen commented 9 years ago

i doubt this will do but i tried to run the demo and forced the flash with noFallback = false in google chrome. but it doesn't work there, the flash container never gets loaded and i am seeing the error Uncaught TypeError: Cannot read property 'code' of undefined.

cam.capture is always undefined. looks broken to me.

shannon-fluellen-aurea commented 5 years ago

@rodfersou @binarykitchen I'm running into the same problem with the flash execution path. The success function is never called and reading through the code, I'm having trouble seeing how it would be. I'm guessing somehow this https://github.com/addyosmani/getUserMedia.js/blob/a0f839a214f1143a66b44410804fbb1c1e712158/lib/getUserMedia.js#L127 is what would do it but that event isn't triggering in Safari. Why would an options object like that have an onLoad event? Does it have anything to do with this? https://github.com/addyosmani/getUserMedia.js/blob/a0f839a214f1143a66b44410804fbb1c1e712158/lib/getUserMedia.js#L125 Any help would be greatly appreciated!

rodfersou commented 4 years ago

@shannon-fluellen-aurea sorry, this issue is from 4 years ago... I'm afraid I can't help anymore with it because I don't remember and don't need anymore this code... I used it just in a simple project.

also, I'm out of free time now... good luck hacking with it!

shannon-fluellen-aurea commented 4 years ago

Hey @rodfersou no worries, I ended up not needing this for the project anyway. Thanks for getting back to me though!