samples-server
samples-server copied to clipboard
Is there a way for this video stream to work on iOS?
This example -
https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Taking_still_photos https://mdn-samples.mozilla.org/s/webrtc-capturestill/
On iOS Safari, you open the example, it prompts for webcam use, you allow, then it takes a single frame and stays that way, doesn't open a video stream
Do you have more information on this and whether there's potential for this same webpage to work on iOS somehow?
Thank you! :)
Hi,
I had the same problem and stumpled upon this. A solution that worked for me was:
- Make sure your website is called via HTTPS. (else you need to activate the options in the safari developer tools that WebRTC is allowed on 'unsafe' websites)
- Set the "playsinline"-attribute of the video object to true:
navigator.mediaDevices.getUserMedia({video: true, audio: false})
.then(function(stream) {
video.srcObject = stream;
video.setAttribute("playsinline", true); // <-- this is the important line
video.play();
})
Hope it helps!
This worked! Thanks so much @Nako11 💯
Should you make a Pull Request for this to be added to the example in this repo? Unsure what the etiquette is to close this Issue or leave it open so others can find it easily.
Thanks so cool!!! 🎉
Glad it helped :)
I don't know the etiquette either but I created a pull request and maybe @a2sheppy will see it.
I think you should leave this Issue open until the fix is merged.