codekraft-studio / vue-record

VueJs components for MediaRecorder API
https://codekraft-studio.github.io/vue-record/
MIT License
94 stars 57 forks source link

feat(safari) support safari for audio recording #5

Closed lidio601 closed 4 years ago

lidio601 commented 4 years ago

I ported a standalone example I had that uses a polyfill + tone.js to record audio as it wasn't working on Safari.

This still doesn't support video recording (on Safari) but you could look into this.

For now I just duplicated the existing mixin and renamed it to be used by the video-recorder component, and added the code to check if MediaRecorder is defined to disable it (otherwise it will raise an error after the recording starts).

b4dnewz commented 4 years ago

thanks for the very detailed code and PR!

unfortunately I never used safari and I wasn't aware that the plugin wasn't working. I need to download it and test your code

in order to merge this feature the master we could detect the browser using this code and then using an alternative mixin for safari and maybe turn the actual recordermixin in a more generic code that can be used for all browsers and shared with the safari one.

I'll check it as soon as possible and I let you know

lidio601 commented 4 years ago

Good point.

Should be all done: now it loads the "Safari mixin" only if MediaRecorder is missing and I reverted to a single RecorderMixin for clarity.

lidio601 commented 4 years ago

sorry I just realized I had a bug with the audio context, it needs to be started only once.

also I changed the base of my pull request to beta.

b4dnewz commented 4 years ago

ok, after thinking a little bit I've decided to change back the base to master and merge it. initially I thought to merge it into the beta branch since I've updated the mixins in that branch, but to keep the things separate and simple both in code and in project history it's better to merge this new feature you have done into the master and bump the project version.

eventually when I continue working on the beta branch I adapt it to use the new safary mixin.

b4dnewz commented 4 years ago

just for the records, your feature is now available in version 0.0.3 commit 886f8018ee861f5443ca62133630cd8a53230ed1