jhuckaby / webcamjs

HTML5 Webcam Image Capture Library with Flash Fallback
MIT License
2.5k stars 1.11k forks source link

iOS 11 fallback from userMedia #247

Closed zsalab closed 7 years ago

zsalab commented 7 years ago

Currently iOS 11 looks support userMedia but I could not manage to get work (please let me know if you have a solution), in a meantime it would be nice to have the old style iOS support

245

jhuckaby commented 7 years ago

Thank you very much for doing this! I agree, this the best solution for now, until we can figure out what is going on with iOS 11.

positlabs commented 7 years ago

@zsalab I threw together a quick test and it is working as expected on my ipad running ios 11 beta. Please have a look.

https://github.com/positlabs/ios11-gum

zsalab commented 7 years ago

Thank you, I think PR is welcome. I am not an iOS developer and I am not willing to upgrade my phone before the 2nd/3rd minor version coming... unfortunately it does not work in the simulator.

None of these works with the simulator: https://webrtc.github.io/samples/src/content/getusermedia/gum/ https://mozilla.github.io/webrtc-landing/gum_test.html

zsalab commented 7 years ago

I found the error thanks to @positlabs working example. You can check out the change in my fork, but the taken image will has deformed (this is the reason I have not sent a pull request yet). You can try: http://zettasystem.com/webcamjs/demos/basic.html I hope I will have some time to figure out the problem with the deformation.

ScottDellinger commented 7 years ago

I made pretty much the exact same changes as you, then saw your post.

I get a similar distortion (except it's vertical instead of horizontal) in MS Edge. I haven't figured a way around it yet, but haven't put much time into it.

poliander commented 7 years ago

Not a good idea. Safari on iOS 11 supports getUserMedia() and this patch totally disables it for all iOS versions. I suggest to discard this change and to improve the getUserMedia() polyfill instead.

sadevio commented 6 years ago

I added

if (this.iOS || Webcam.isSafari ) { video.srcObject = stream; }else{ video.src = window.URL.createObjectURL( stream ) || stream; }

to the if (this.userMedia) section in the attach function.

defined isSafari under iOS, isSafari: /Safari/.test(navigator.userAgent) && !window.MSStream,