Friday 29 September 2023

How to make navigator.mediaDevices.getUserMedia({ video: true }) work on mobile

I am trying to record video with my phone and use it as a background on the site I am building. The goal is to do stuff with the video stream, but first I need to just be able to render it at all. I have the code below:

https://codepen.io/jasperkennis/pen/yLGjOrw

That I am also testing as a simple html page exposed via python -m http.server over ngrok to make sure it is sitting on https. On my laptop it happily takes the webcam, but on phone (iphone 12 and 15 tested) I can see that it gets access to the camera (the permission modal shows correctly) and I can place an alert to see how far it gets, but it never seems to try to render anything.

I'm not sure where to go from here, maybe it should not work, any help would be appreciated.



from How to make navigator.mediaDevices.getUserMedia({ video: true }) work on mobile

No comments:

Post a Comment