Reputation: 1
I have a web application that uses the mediarecorder API to record and show video. For short videos, it works fine.
For videos of 1 minute or more on IOS, the web page reloads (with a generic error message flashing right before it loads). There are no errors in the console.
Long videos work fine in Mac Safari, but also fail on IOS Chrome.
It's clearly some sort of IOS resource issue.
Has anyone successfully used the mediarecorder API to record and then play longer videos on IOS?
Note that the crash happens shortly after this line of code which I've seen in countless mediarecorder examples:
video.src = URL.createObjectURL(new Blob(blobs, { type: mediaRecorder.mimeType }));
Upvotes: 0
Views: 1029
Reputation: 75
I had a similar issue, the only workaround I found was reducing the video quality to something acceptable by modifying the video and audio BitsPerSecond, this reduces the video size significantly.
here is what I used:
const options = {
videoBitsPerSecond: 1048576,
audioBitsPerSecond: 131072,
mimeType: mimeType
}
media_recorder = new MediaRecorder(camera, options);
Upvotes: 0
Reputation: 108796
Object URLs for longer MediaRecorder recordings are text strings, really enormous text strings. Your createObjectURL is probably blowing out RAM on your device's browser process. You might be wise to consider a different design involving a server.
It might also be a bug in iOS Safari. I suggest putting a demo of the problem on glitch.com and reporting it.
Upvotes: 1