Nilsantos / react-native-screen-audio-recorder

MIT License
0 stars 1 forks source link

Tried the example code from repo but no sound accepted from mic and PLAY button is greyed out #3

Open VincentLu91 opened 2 years ago

VincentLu91 commented 2 years ago

This is related to the previous issue "Tried the library but no device audio gets recorded".

I am trying another angle. I used the same code from https://github.com/Nilsantos/react-native-screen-audio-recorder/blob/master/example/src/App.tsx

but in Javascript rather than Typescript. I hit record but several things happen:

  1. it seems to capture the device audio but not the mic. Is it only meant to capture only device audio? I'm getting base64 encoded string that looks like q347fzK+533kvcL/OEB6AWOBjQFdQSmB0QMBhAgD04N4wxdDvUPIRHnEH0O6gu9CjwLnAp9CLIFmAIc/wH8avgG9fPyRvVj90nzB+xX6wfxd/V39bPybfBE8Av06vme/MX5F/bb95r9SwOMBdUEqAOmBAwJkg1cD1oNJAwxDZYP4xAREXsPKg29CyIMFAxFCowHRQXFAsf/hvw3+L70/fNn97f3U/Hs6g3tX/P29fXzn/AZ7/Tw6vV5+qL60fbe9FT5hf+AA+kD2wLYAuEF/go0DggOoAvRC2MOuBArEWYQSw6iDNoMGw7rDP0JXwetBTIDcgAh/Rb5B/Vd9An4bfdD8A3r0e5Z9P30+/Gc72PvyfGa9pD5JviY9Eb18frD/xMCHgLmAdoCHQe7C9UNOgyUClAMsw9SEZQQIg9QDd0M+g3MDiwM4gg6B8cGRAQjATL97Pgm9f/1ZPlP9zPvE+sl8C71nfQh8fDuI++P8hL3Efmd9unzEfYT/AQATQEZAY0BWwMvCHcM5Az5Cq0Kkg2VEEERAxCmDpYN6Q3jDqcOpAsjCWAIyAf8BOcBIP4O+sj2QPfn+Vn3N+/Z6zXxdfXQ803wfu4d78Hy+/YN+CT1PPNS9hv8Sf/9/9r/kABQ...
  2. The "PLAY" button has always been greyed out. So far, I could only start and stop recording but the PLAY button remains unavailable. Why is this? I don't see anywhere else that tell me whether a recording is paused or not (I'm reading the logic between lines 88 and 99 in the example)

Could someone please advise on the two points I brought up above?

Thanks

dusanspasojevic commented 2 years ago

@VincentLu91 did you set fromMic and saveFile to true? Because probably your filePath is null because it doesn't save file that you recorded so you can never play it back.

niembro64 commented 1 year ago

I'm testing the example code with the following and it is working.

I have youtube producing sound in the background and i am able to replay the sound with the play button.

ScreenAudioRecorder.init({
  sampleRate: 16000,
  channels: 1,
  bitsPerSample: 16,
  fileName: "novo.wav",
  fromMic: false,
  saveFile: true,
  audioEmitInterval: 1000,
});
dusanspasojevic commented 1 year ago

As I know this doesn't work on iOS, or rather iOS part is not implemented, only android.

On Fri, 27 Jan 2023, 01:00 Eric Niemeyer, @.***> wrote:

I'm testing the example code with the following and it is working.

I have youtube producing sound in the background and i am able to replay the sound with the play button.

ScreenAudioRecorder.init({ sampleRate: 16000, channels: 1, bitsPerSample: 16, fileName: "novo.wav", fromMic: false, saveFile: true, audioEmitInterval: 1000, });

— Reply to this email directly, view it on GitHub https://github.com/Nilsantos/react-native-screen-audio-recorder/issues/3#issuecomment-1405831661, or unsubscribe https://github.com/notifications/unsubscribe-auth/AND4LCQOCP6AXNCFCH3INBDWUMFYVANCNFSM5IK6UO6A . You are receiving this because you commented.Message ID: @.*** com>

Nilsantos commented 1 year ago

Exactly, the IOS part is not implemented, I couldn't capture the audio played by the device in IOS. If anyone knows how to do it, please help me.

Another interesting point to share is that some applications do not allow audio capture, so when we try to play it nothing is played

dusanspasojevic commented 1 year ago

I was researching it, as I know you can't access a module specifically for devices audio record, but you can devices screen record(by opening recording modal from ios system with code) witch also records audio.

On Fri, 27 Jan 2023, 01:38 Danilo Santos, @.***> wrote:

Exactly, the IOS part is not implemented, I couldn't capture the audio played by the device in IOS. If anyone knows how to do it, please help me.

— Reply to this email directly, view it on GitHub https://github.com/Nilsantos/react-native-screen-audio-recorder/issues/3#issuecomment-1405863270, or unsubscribe https://github.com/notifications/unsubscribe-auth/AND4LCSMFY2KSW4AV7A3BVLWUMKIRANCNFSM5IK6UO6A . You are receiving this because you commented.Message ID: @.*** com>