Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 12 Issue - MediaRecorder "prepare failed" #58

Open
panosx2 opened this issue Nov 27, 2021 · 6 comments
Open

Android 12 Issue - MediaRecorder "prepare failed" #58

panosx2 opened this issue Nov 27, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@panosx2
Copy link

panosx2 commented Nov 27, 2021

Bug
MediaRecorder crashes in Android 12 emulator on "prepare" call.

Logs

E/MediaRecorder: prepare failed: -2147483648
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: dev.bmcreations.scrcast.app, PID: 9916
    java.io.IOException: prepare failed.
        at android.media.MediaRecorder._prepare(Native Method)
        at android.media.MediaRecorder.prepare(MediaRecorder.java:1296)
        at dev.bmcreations.scrcast.internal.recorder.service.RecorderService.createRecorder(RecorderService.kt:159)
        at dev.bmcreations.scrcast.internal.recorder.service.RecorderService.access$createRecorder(RecorderService.kt:32)
        at dev.bmcreations.scrcast.internal.recorder.service.RecorderService$recordInternal$1.invokeSuspend(RecorderService.kt:227)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

Screenshot
image

@panosx2 panosx2 added the bug Something isn't working label Nov 27, 2021
@kolyneh
Copy link

kolyneh commented Aug 31, 2022

Maybe it's just because of the video resolution you set.

@OCCCAS
Copy link

OCCCAS commented Aug 4, 2023

hello, have you solved this problem?

@jdevp
Copy link

jdevp commented Aug 19, 2023

I'm having the same issue with Android 12. It works with Android 13 and Android 11 so it is not the parameter setting issues.

@jdevp
Copy link

jdevp commented Aug 19, 2023

Does anyone know if this issue is only with Android 12 on emulator? What about on Android 12 real device? It might have something to do with permissions.

@kolyneh
Copy link

kolyneh commented Aug 23, 2023

Hi, you should have handled with permissions before using recorder.

I've had this problem on an Android 12 real device where I set odd number of resolution.
Switching to even number of resolution solved it.

See my comment here for more info : Cap-go/capacitor-screen-recorder#3 (comment)

@jdevp
Copy link

jdevp commented Aug 23, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants