Reputation: 302
I want to send a video stream from an iOS device (version 11 and above) to a server (from a client using html5 on iOS).
For other browsers I get the stream from navigator.getUserMedia
, and pass it to the server using mediaRecorder and a WebSocket:
this.mediaRecorder = new MediaRecorder(this._stream);
this.mediaRecorder.start(50);
this.mediaRecorder.ondataavailable = function(e) {
app.socket.emit("frameRequest", e.data);
}
however, MediaRecorder is not supported on iOS. Is there an alternative to sending the stream from iOS devices?
Upvotes: 7
Views: 4526
Reputation: 1951
There are a handful of polyfills that add MediaRecorder API support to browsers that don't support it natively, including iOS Safari. My current favorite is Opus Media Recorder.
One problem I'm running into is that it only supports recording in Ogg or Wav formats, however iOS doesn't support playback of Ogg - only Wav, AAC, or MP3. Unfortunately, Wav and AAC files are too big. So, I am taking the approach of recording in Wav and transcoding to MP3 in the browser using lamejs.
Upvotes: 2