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

Video recording not working on Android #23

Open
disbelief opened this issue Apr 10, 2020 · 10 comments
Open

Video recording not working on Android #23

disbelief opened this issue Apr 10, 2020 · 10 comments

Comments

@disbelief
Copy link

I'm posting this to hopefully save people's time, as I've been down a rabbit hole with this plugin for a while now.

The current version, as far as I can tell, does not work on Android. The video preview displays correctly, and all the functionality that can be tested in the Android emulator works. However the emulator does not actually record video or store it to the device.

On a real device, the startRecording call crashes. The crash appears to be originating in the fancycamera library this plugin uses. I have tested on two separate devices with different Android versions and the same error is present.

I have filed an issue in that library with further details about the crash: triniwiz/fancycamera#9

@rbenzing
Copy link

I am also having the same problem on Android 10 atleast it does not record and falls back to "some/file/path" as the result of any recording.

@disbelief
Copy link
Author

@rbenzing that sounds like you haven't enabled the plugin in your Android app so it's falling back to the web simulation.

In MainActivity.java:

// ...

import com.github.sbannigan.capacitor.VideoRecorder;

// ...

public class MainActivity extends BridgeActivity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
      // Additional plugins you've installed go here
      add(VideoRecorder.class);
    }});

    // ...

  }
}

@rbenzing
Copy link

@disbelief thanks for the quick response. I am actually using Ionic with Capacitor to build the android app. Do i include it at the app.module.ts? or in the component module.ts?

@disbelief
Copy link
Author

@rbenzing sorry I have no experience with the Ionic framework. I have only used Capacitor standalone.

@rbenzing
Copy link

So as you mentioned adding this directly to my Android project worked. I can record and return the video url successfully.

The file is located below for anyone else having this problem.

/android/app/src/main/java/MainActivity.java

Thanks Again!

@daveshirman
Copy link

@rbenzing I'm intending on using this plugin soon. Can you confirm whether it works now on Android and iOS please?

@rbenzing
Copy link

Please try and keep comments relevant to bug reports. Aside from that I cant say for iOS yet but I did get it working on Android.

@xamuel17
Copy link

Rb

Please try and keep comments relevant to bug reports. Aside from that I cant say for iOS yet but I did get it working on Android.

Please can you help me with a code snippet of you ionic HTML and Page.ts file. I can see the camera on my app but it doesn't record

@donmb1
Copy link

donmb1 commented Mar 3, 2022

I have the same issue. Its not working on Android, also after downgrading below V5
The Java code above does not work

@donmb1
Copy link

donmb1 commented Mar 4, 2022

I tried this more up to date approach to register the plugin:

package xxxxxxxx;
import com.github.sbannigan.capacitor.VideoRecorder;
import android.os.Bundle;
import com.getcapacitor.BridgeActivity;

public class MainActivity extends BridgeActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        registerPlugin(VideoRecorder.class);
    }
}

Also this does not seem to work. I do not receive a proper video URL after recordning.
Anyone out there who can help?
I really like this plugin but I cannot make it work on Android.
@disbelief disbelief
@rbenzing rbenzing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants