beattv / react-native-screen-recorder

MIT License
3 stars 1 forks source link

Not working on IOS/Android #2

Open ahsanparacha02 opened 4 years ago

ahsanparacha02 commented 4 years ago

when i start recording on android it automatically stop after sec and video not save on phone memory, and on ios side i got exception when i start recoding "Recording not active". please help me to fixed this issue

voslartomas commented 4 years ago

Hi, can you provide some more details/logs ?

ahsanparacha02 commented 4 years ago

Hi, can you provide some more details/logs ? when i call start recording i m getting this error image

image

voslartomas commented 4 years ago

You need to add permissions

Please follow this docs https://developer.android.com/guide/topics/media/mediarecorder

ahsanparacha02 commented 4 years ago

You need to add permissions

Please follow this docs https://developer.android.com/guide/topics/media/mediarecorder

permission already added

 <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" `/>```
voslartomas commented 4 years ago

You need to ask for permissions before recording, its not part of the library

ahsanparacha02 commented 4 years ago

You need to ask for permissions before recording, its not part of the library

i give permission manually now i got this error image const _handleOnRecording = async () => { if (recording) { setRecording(false); const res = await RecordScreen.stopRecording().catch((error) => console.warn(error), ); console.log('res', res); if (res) { setUri(res.result.outputURL); } } else { setUri(''); setRecording(true); await RecordScreen.startRecording().catch((error) => { console.warn(error); setRecording(false); setUri(''); }); } };

voslartomas commented 4 years ago

You will have to run it from android studio to see native errors in the log, cant say much from this.

ahsanparacha02 commented 4 years ago

You will have to run it from android studio to see native errors in the log, cant say much from this.

image

voslartomas commented 4 years ago

Try to ask for audio permissions before

await PermissionsAndroid.request(
    PermissionsAndroid.PERMISSIONS.RECORD_AUDIO,
    {
      title: 'App audio Permission',
      message:
        'App needs access to your camera ',
      buttonNeutral: 'Ask Me Later',
      buttonNegative: 'Cancel',
      buttonPositive: 'OK'
    }
  )
ahsanparacha02 commented 4 years ago

Try to ask for audio permissions before

await PermissionsAndroid.request(
    PermissionsAndroid.PERMISSIONS.RECORD_AUDIO,
    {
      title: 'App audio Permission',
      message:
        'App needs access to your camera ',
      buttonNeutral: 'Ask Me Later',
      buttonNegative: 'Cancel',
      buttonPositive: 'OK'
    }
  )

still same error, i think the issue is with startRecording method

voslartomas commented 4 years ago

What version of Android do you have?

ahsanparacha02 commented 4 years ago

Try to ask for audio permissions before

await PermissionsAndroid.request(
    PermissionsAndroid.PERMISSIONS.RECORD_AUDIO,
    {
      title: 'App audio Permission',
      message:
        'App needs access to your camera ',
      buttonNeutral: 'Ask Me Later',
      buttonNegative: 'Cancel',
      buttonPositive: 'OK'
    }
  )

still same error

What version of Android do you have?

3.5.3

voslartomas commented 4 years ago

I mean operating system version

ahsanparacha02 commented 4 years ago

I mean operating system version

AVD Pixel_C_API_28

voslartomas commented 4 years ago

Are you testing this in emulator? I think you have to use real device for screen recording

ahsanparacha02 commented 4 years ago

Are you testing this in emulator? I think you have to use real device for screen recording

ok let me check on real device and also on ios i m getting error while install pod [!] CocoaPods could not find compatible versions for pod "react-native-screen-recorder":

voslartomas commented 4 years ago

No idea about ios, it should install from node modules, maybe try to update cocoa pods cache

ahsanparacha02 commented 4 years ago

aybe try to update cocoa pods cache

i m getting same error on real device as well

voslartomas commented 4 years ago

Running out of ideas, anything else in the logs which may be interesting?

voslartomas commented 3 years ago

@ahsanparacha02 It might have been related with Android 10. There is a new release with fix.