Search code examples
iphonemeteorvideo-streamingcordova-plugins

Best Recommendation for Capturing Video in a Meteor App on iOS devices


I ran into this problem in Safari where it appears that WebRTC is not fully supported. So when I call

navigator.webkitGetuserMedia()

I get an undefined error.

So my question to the community is what is the best way to write a Meteor app that captures Video on a mobile device and saves it on the said device.

If you have done this, I would appreciate it very much if you could share with me and the community how you went about this.


Solution

  • Specific Answer

    The modern API is: navigator.mediaDevices.getUserMedia(constraints). See the docs here.

    In the past, I've been unsuccessful with getUserMedia on iOS, but according to this post it can be done on iOS 11.

    As for saving it, you can write to the browser's file system, but that API is only supported in Chrome. If you want to write to the camera roll, you'd need native code in the mix.

    General Advice

    I've spent several years of my life dealing with recording, uploading, and processing video using meteor. If you are doing anything more than trivial web recording, these observations may save you some time:

    • Chrome (on everything but iOS) has the best API for web recording. If you can require chrome for recording, that's ideal. Firefox is a close second, only because it doesn't support the file system API.
    • If you need to record and upload long videos on iOS, build a native app. Don't consider any kind of hybrid - that's a serious trap. The number of corner cases and things you need to check is pretty astounding, and the only way to get over those hurdles is with native code.