Coder Social home page Coder Social logo

jeroenmols / landscapevideocamera Goto Github PK

View Code? Open in Web Editor NEW
1.2K 59.0 289.0 61.16 MB

Powerful custom Android Camera with granular control over the video quality and filesize, restricting recordings to landscape only.

License: Apache License 2.0

Java 99.73% Shell 0.27%

landscapevideocamera's Introduction

LandscapeVideoCamera

Build Status Codecov.io Release MethodCount License

Highly flexible Android Camera which offers granular control over the video quality and filesize, while restricting recordings to be landscape only.

Get it on Google Play

There are a number of issues with the default Android intent to capture videos (MediaStore.ACTION_VIDEO_CAPTURE) which led me to create this library project:

  1. The default intent only accepts integer quality parameters of 0 (MMS quality) or 1 (highest available quality), using the intent extra MediaStore.EXTRA_VIDEO_QUALITY.
  2. The default intent does not return the URI of the recorded file if it was specified when launching the intent.
  3. The default intent doesn't care whether users capture their video in portrait mode or landscape.

LandscapeVideoCamera in action

Features

This library provides a full and reusable custom camera, which:

  • Forces the users to rotate their device to landscape
  • Allows to specify the filename, or have the library generate one for you
  • Allows very granular control over the capture settings:
    • Resolution
    • Bitrate
    • Max filesize
    • Max video duration
    • audio/video codec
    • switch between front and rear facing camera
    • ...

How to use

  1. Add the Jitpack repository to your project:
          repositories {
              maven { url "https://jitpack.io" }
          }
  1. Add a dependency on the library:
          compile 'com.github.jeroenmols:LandscapeVideoCamera:1.3.0'
  1. Specify the VideoCaptureActivity in your manifest:
         <activity
             android:name="com.jmolsmobile.landscapevideocapture.VideoCaptureActivity"
             android:screenOrientation="sensor" >
         </activity>
  1. Request the following permissions in your manifest:
         <uses-permission android:name="android.permission.RECORD_AUDIO" />
         <uses-permission android:name="android.permission.CAMERA" />
         <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  1. Create a CaptureConfiguration using the Builder
         // Choose one of both
         CaptureConfiguration.Builder builder = new CaptureConfiguration.Builder(CaptureResolution resolution, CaptureQuality quality);
         CaptureConfiguration.Builder builder = new CaptureConfiguration.Builder(int videoWidth, int videoHeight, int bitrate);

         // Optional
         builder.maxDuration(maxDurationSec);
         builder.maxFileSize(maxFileSizeMb);
         builder.frameRate(framesPerSec);
         builder.showRecordingTime();         // Show the elapsed recording time
         builder.noCameraToggle();            // Remove button to toggle between front and back camera

         // Get the CaptureConfiguration
         CaptureConfiguration configuration = builder.build();

Note: When no CaptureConfiguration is specified, a default configuration will be used.

Note 2: Subclass the CaptureConfiguration class to set more advanced configurations. (codecs, audio bitrate,...)

  1. Launch the VideoCaptureActivity for result, add the CaptureConfiguration as an parcelable extra EXTRA_CAPTURE_CONFIGURATION and optionally add a String extra EXTRA_OUTPUT_FILENAME.
         final Intent intent = new Intent(getActivity(), VideoCaptureActivity.class);
         intent.putExtra(VideoCaptureActivity.EXTRA_CAPTURE_CONFIGURATION, config);
         intent.putExtra(VideoCaptureActivity.EXTRA_OUTPUT_FILENAME, filename);
         startActivityForResult(intent, RESULT_CODE);
  1. Check the resultcode (RESULT_OK, RESULT_CANCELLED or VideoCaptureActivity.RESULT_ERROR) and in case of success get the output filename in the intent extra EXTRA_OUTPUT_FILENAME.

Questions

@molsjeroen

Thanks

Android Arsenal

landscapevideocamera's People

Contributors

alexquinlivan avatar amomsen avatar danielgomezrico avatar fchauveau avatar jeroenmols avatar obj63mc avatar ravidsrk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

landscapevideocamera's Issues

Start again when limit is reached

i wanna keep recording in 15 minutes pieces because in g+ " videos longer than 15 minutes count toward your storage limit". i haven't found an app that does this

java.lang.IllegalArgumentException: Unsupported angle: -180

java.lang.IllegalArgumentException: Unsupported angle: -180
at android.media.MediaRecorder.setOrientationHint(MediaRecorder.java:419)
at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.configureMediaRecorder(VideoRecorder.java:148)
at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.initRecorder(VideoRecorder.java:122)
at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.startRecording(VideoRecorder.java:87)
at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.toggleRecording(VideoRecorder.java:80)

video camera in portrait mode

Hi JeorenMols,

How do I make this library work in portrait mode as well as with the feature of adjusting the resolution ?

Front camera?

Is there anyway to provide the ability for the user to choose the front camera or the rear camera?

No suitable constructor found on Version 1.2.2

int fileDuration = 10;
int filesize = CaptureConfiguration.NO_FILESIZE_LIMIT;
final CaptureConfiguration config = new CaptureConfiguration(800, 480, 1750000, fileDuration, filesize,true,true);

Trying to add the option to show the timer and to allow front camera.

Error:(250, 49) error: no suitable constructor found for CaptureConfiguration(int,int,int,int,int,boolean,boolean) constructor CaptureConfiguration.CaptureConfiguration() is not applicable (actual and formal argument lists differ in length) constructor CaptureConfiguration.CaptureConfiguration(CaptureResolution,CaptureQuality) is not applicable (actual and formal argument lists differ in length) constructor CaptureConfiguration.CaptureConfiguration(CaptureResolution,CaptureQuality,int,int,boolean) is not applicable (actual and formal argument lists differ in length) constructor CaptureConfiguration.CaptureConfiguration(CaptureResolution,CaptureQuality,int,int,boolean,boolean) is not applicable (actual and formal argument lists differ in length) constructor CaptureConfiguration.CaptureConfiguration(CaptureResolution,CaptureQuality,int,int) is not applicable (actual and formal argument lists differ in length) constructor CaptureConfiguration.CaptureConfiguration(int,int,int) is not applicable (actual and formal argument lists differ in length) constructor CaptureConfiguration.CaptureConfiguration(int,int,int,int,int) is not applicable (actual and formal argument lists differ in length) constructor CaptureConfiguration.CaptureConfiguration(Parcel) is not applicable (actual and formal argument lists differ in length)

What I am doing wrong?

timer

recording timer is not running

SurfaceView

How can I use SurfaceView with your library?

Sync issue between Video and Audio

I've been noticing a sync issue on recorded videos between the audio and video. Doesn't seem to depend on the FPS settings or the video size. Unsure if it's a bug or something I haven't set correctly?

Display of time elapsed?

Is there anyway to display the number of seconds the recording has been running (like in a standard camera)?

Can't capture video : Camera disabled or in use by other process

Hi,

I can't get the camera working. When the phone is in portrait, I get the icon asking to rotate the phone, but when I do that, I get this error :

Can't capture video : Camera disabled or in use by other process

My code is basic :

CaptureConfiguration configuration = new CaptureConfiguration(PredefinedCaptureConfigurations.CaptureResolution.RES_1080P, PredefinedCaptureConfigurations.CaptureQuality.HIGH, 120, 200000, true, false);

String filename= Environment.getExternalStorageDirectory().getAbsolutePath() + "/myvideo.mp4";

final Intent intent = new Intent(getActivity(), VideoCaptureActivity.class);
intent.putExtra(VideoCaptureActivity.EXTRA_CAPTURE_CONFIGURATION, configuration);
intent.putExtra(VideoCaptureActivity.EXTRA_OUTPUT_FILENAME, filename);
startActivityForResult(intent, 101);


The phone is an Honor 5x, with Android 6.0. What am I doing wrong ?

The console :

W/CameraBase: An error occurred while connecting to camera: 0
E/Camera-JNI: android_hardware_Camera_native_setup Error: -1 
E/Camera: Camera new cameraInitNormal:-1
W/System.err: java.lang.RuntimeException: Unknown camera error(-1)
W/System.err:     at android.hardware.Camera.<init>(Camera.java:578)
W/System.err:     at android.hardware.Camera.open(Camera.java:399)
W/System.err:     at com.jmolsmobile.landscapevideocapture.camera.NativeCamera.openNativeCamera(NativeCamera.java:48)
W/System.err:     at com.jmolsmobile.landscapevideocapture.camera.CameraWrapper.openCamera(CameraWrapper.java:53)
W/System.err:     at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.initializeCameraAndPreview(VideoRecorder.java:64)
W/System.err:     at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.<init>(VideoRecorder.java:59)
W/System.err:     at com.jmolsmobile.landscapevideocapture.VideoCaptureActivity.initializeRecordingUI(VideoCaptureActivity.java:89)
W/System.err:     at com.jmolsmobile.landscapevideocapture.VideoCaptureActivity.onCreate(VideoCaptureActivity.java:73)
W/System.err:     at android.app.Activity.performCreate(Activity.java:6372)
W/System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2406)
W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2513)
W/System.err:     at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4136)
W/System.err:     at android.app.ActivityThread.access$1000(ActivityThread.java:168)
W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1384)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err:     at android.os.Looper.loop(Looper.java:150)
W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5639)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:799)
W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:689)
E/VideoCapture_Exception: Unable to open camera - Camera disabled or in use by other process
W/System.err: com.jmolsmobile.landscapevideocapture.camera.OpenCameraException: Camera disabled or in use by other process
W/System.err:     at com.jmolsmobile.landscapevideocapture.camera.CameraWrapper.openCamera(CameraWrapper.java:56)
W/System.err:     at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.initializeCameraAndPreview(VideoRecorder.java:64)
W/System.err:     at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.<init>(VideoRecorder.java:59)
W/System.err:     at com.jmolsmobile.landscapevideocapture.VideoCaptureActivity.initializeRecordingUI(VideoCaptureActivity.java:89)
W/System.err:     at com.jmolsmobile.landscapevideocapture.VideoCaptureActivity.onCreate(VideoCaptureActivity.java:73)
W/System.err:     at android.app.Activity.performCreate(Activity.java:6372)
W/System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2406)
W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2513)
W/System.err:     at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4136)
W/System.err:     at android.app.ActivityThread.access$1000(ActivityThread.java:168)
W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1384)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err:     at android.os.Looper.loop(Looper.java:150)
W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5639)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:799)
W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:689)
W/CameraBase: An error occurred while connecting to camera: 0
E/Camera-JNI: android_hardware_Camera_native_setup Error: -1 
E/Camera: Camera new cameraInitNormal:-1
W/System.err: java.lang.RuntimeException: Unknown camera error(-1)
W/System.err:     at android.hardware.Camera.<init>(Camera.java:578)
W/System.err:     at android.hardware.Camera.open(Camera.java:399)
W/System.err:     at com.jmolsmobile.landscapevideocapture.camera.NativeCamera.openNativeCamera(NativeCamera.java:48)
W/System.err:     at com.jmolsmobile.landscapevideocapture.camera.CameraWrapper.openCamera(CameraWrapper.java:53)
W/System.err:     at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.initializeCameraAndPreview(VideoRecorder.java:64)
W/System.err:     at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.<init>(VideoRecorder.java:59)
W/System.err:     at com.jmolsmobile.landscapevideocapture.VideoCaptureActivity.initializeRecordingUI(VideoCaptureActivity.java:89)
W/System.err:     at com.jmolsmobile.landscapevideocapture.VideoCaptureActivity.onCreate(VideoCaptureActivity.java:73)
W/System.err:     at android.app.Activity.performCreate(Activity.java:6372)
W/System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2406)
W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2513)
W/System.err:     at android.app.ActivityThread.access$900(ActivityThread.java:168)
W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1378)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err:     at android.os.Looper.loop(Looper.java:150)
W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5639)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:799)
W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:689)
E/VideoCapture_Exception: Unable to open camera - Camera disabled or in use by other process
W/System.err: com.jmolsmobile.landscapevideocapture.camera.OpenCameraException: Camera disabled or in use by other process
W/System.err:     at com.jmolsmobile.landscapevideocapture.camera.CameraWrapper.openCamera(CameraWrapper.java:56)
W/System.err:     at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.initializeCameraAndPreview(VideoRecorder.java:64)
W/System.err:     at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.<init>(VideoRecorder.java:59)
W/System.err:     at com.jmolsmobile.landscapevideocapture.VideoCaptureActivity.initializeRecordingUI(VideoCaptureActivity.java:89)
W/System.err:     at com.jmolsmobile.landscapevideocapture.VideoCaptureActivity.onCreate(VideoCaptureActivity.java:73)
W/System.err:     at android.app.Activity.performCreate(Activity.java:6372)
W/System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2406)
W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2513)
W/System.err:     at android.app.ActivityThread.access$900(ActivityThread.java:168)
W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1378)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err:     at android.os.Looper.loop(Looper.java:150)
W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5639)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:799)
W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:689)

Unable to record video with given setting.

Hi i am recording video in Samsung Grand 2 with android version 4.4.2
but getting error "Can't capture video : Unable to record video with given setting"

CaptureConfiguration.Builder builder = new CaptureConfiguration.Builder(
PredefinedCaptureConfigurations.CaptureResolution.RES_360P,
PredefinedCaptureConfigurations.CaptureQuality.MEDIUM);
// Optional
builder.maxDuration(180); // in second
builder.maxFileSize(20); //in MB
builder.frameRate(24);
builder.showRecordingTime();
builder.noCameraToggle(); // Remove button to toggle between front and back camera

    CaptureConfiguration configuration = builder.build();

    final Intent intent = new Intent(QuestionnaireActivity.this, VideoCaptureActivity.class);
    intent.putExtra(VideoCaptureActivity.EXTRA_CAPTURE_CONFIGURATION, configuration);
    startActivityForResult(intent, AppConstants.REQUEST_VIDEO_CAPTURE);

Gradle import issue

I was trying to access the library from gradle , it always showing me the message:-

Error:(139, 13) Failed to resolve: com.github.JeroenMols:LandscapeVideoCamera:1.1.4

Can you please explain why this is happening.

Hi, How to mirror the video?

Hi,

First, thanks for this library ! It has been very useful for me.

Is there a way I can mirror the recorded video?

Thanks in advance.

Max Duration not used in version 1.0.7

Currently if you set the max duration in your capture configuration it is not being used. The sample library is using version 1.0.6 of the library so something from that version to 1.07 either removed or broke this piece. Trying to locate what specifically changed in that version history.

I set your sample to use 1.0.7 from maven locally and was able to replicate in that and my sample app.

Example configuration when using version 1.0.7 that fails -

final  CaptureConfiguration config = new CaptureConfiguration(CaptureResolution.RES_1080P, CaptureQuality.HIGH, 5, CaptureConfiguration.NO_FILESIZE_LIMIT);

Question

It works very well on landscape mode.
I am interested to know the reason why you preferred only Landscape orientation?

Support for setting desired FPS?

Hi, do you have plans to add support for requesting a specific FPS for the video?

A fall back to lower FPS, if the desired FPS is not supported would be great as well. (Or let the user change it in the Ui)

Thanks for your time!
Daniel

about toast

希望那个 toast提示可以自定义。不要是固定的,比如我们限制大小30M,到了30M提示就是英文的。这种最好放在string下,方便我们修改。
或者是可以改,我们找到吗
谢谢分享代码

E/Camera﹕ Error 100

I use this lib, but I get this exception . I had error 100 on samsung galaxy s4.

12-22 21:49:42.308  15679-15679/com.ecloud.android.musiccourse D/VideoCapture_PreviewConfigured camera for preview in surface of 1920 by 1080
12-22 21:49:43.109  15679-15679/com.ecloud.android.musiccourse I/ChoreographerSkipped 55 frames!  The application may be doing too much work on its main thread.
12-22 21:49:43.179  15679-15679/com.ecloud.android.musiccourse I/TimelineTimeline: Activity_idle id: android.os.BinderProxy@42d2ac20 time:84955214
12-22 21:49:47.523  15679-15679/com.ecloud.android.musiccourse D/VideoCapture_VideoRecorderMediaRecorder successfully initialized
12-22 21:49:47.543  15679-15679/com.ecloud.android.musiccourse I/MediaRecorderJNIprepare: surface=0x798cc5d8
12-22 21:49:47.543  15679-15679/com.ecloud.android.musiccourse D/VideoCapture_VideoRecorderMediaRecorder successfully prepared
12-22 21:49:49.385  15679-15679/com.ecloud.android.musiccourse D/VideoCapture_VideoRecorderMediaRecorder successfully started
12-22 21:49:49.385  15679-15768/com.ecloud.android.musiccourse W/IMediaDeathNotifiermedia server died
12-22 21:49:49.385  15679-15768/com.ecloud.android.musiccourse W/CameraBaseCamera service died!
12-22 21:49:49.385  15679-15768/com.ecloud.android.musiccourse W/CameraBasemediaserver's remote binder Camera object died
12-22 21:49:49.385  15679-15679/com.ecloud.android.musiccourse D/VideoCapture_VideoRecorderSuccessfully started recording - outputfile: /storage/emulated/0/Movies/1419256180494.mp4
12-22 21:49:49.405  15679-15679/com.ecloud.android.musiccourse E/CameraError 100
12-22 21:49:53.328  15679-15679/com.ecloud.android.musiccourse D/VideoCapture_VideoRecorderSuccessfully stopped recording - outputfile: /storage/emulated/0/Movies/1419256180494.mp4
12-22 21:49:53.328  15679-15679/com.ecloud.android.musiccourse D/VideoCapture_ActivityFailed to generate video preview
12-22 21:49:53.339  15679-15679/com.ecloud.android.musiccourse D/VideoCapture_VideoRecorderReleased all resources
12-22 21:49:53.729  15679-15679/com.ecloud.android.musiccourse D/VideoCapture_VideoRecorderReleased all resources

start failed: -19 android 7.1.1

/MediaRecorder: start failed: -19
04-06 09:17:18.243 6530-6530/W/System.err: java.lang.RuntimeException: start failed. 04-06 09:17:18.244 6530-6530/W/System.err: at android.media.MediaRecorder.start(Native Method) at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.startRecorder(VideoRecorder.java:182) at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.startRecording(VideoRecorder.java:91) at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.toggleRecording(VideoRecorder.java:82) at com.jmolsmobile.landscapevideocapture.VideoCaptureActivity.onRecordButtonClicked(VideoCaptureActivity.java:120) at com.jmolsmobile.landscapevideocapture.view.VideoCaptureView.onClick(VideoCaptureView.java:167)

Changing target directory

Hi,

First, thanks for this library :) It has been very useful for me.

Is there a way I can choose the target folder of the recorded video?
I have seen that your VideoFile.class is creating a Movies directory with the getFile() function but how can I override it?

Thanks in advance.
Cedric

On Android 6.0 camera does not start

Android4.4.2,It runs normally.
on Android6.0 ,Exception:Camera disabled or in use by other process

Here is the log:
W/System.err: java.lang.RuntimeException: Fail to connect to camera service
W/System.err: at android.hardware.Camera.(Camera.java:542)
W/System.err: at android.hardware.Camera.open(Camera.java:397)
W/System.err: at com.jmolsmobile.landscapevideocapture.camera.NativeCamera.openNativeCamera(NativeCamera.java:27)
W/System.err: at com.jmolsmobile.landscapevideocapture.camera.CameraWrapper.openCamera(CameraWrapper.java:54)
W/System.err: at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.initializeCameraAndPreview(VideoRecorder.java:63)
W/System.err: at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.(VideoRecorder.java:58)
W/System.err: at com.jmolsmobile.landscapevideocapture.VideoCaptureActivity.initializeRecordingUI(VideoCaptureActivity.java:83)
W/System.err: at com.jmolsmobile.landscapevideocapture.VideoCaptureActivity.onCreate(VideoCaptureActivity.java:71)
W/System.err: at android.app.Activity.performCreate(Activity.java:6303)
W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2374)
W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2481)
W/System.err: at android.app.ActivityThread.access$900(ActivityThread.java:153)
W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err: at android.os.Looper.loop(Looper.java:148)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5432)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:735)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
E/VideoCapture_Exception: Unable to open camera - Camera disabled or in use by other process
W/System.err: com.jmolsmobile.landscapevideocapture.camera.OpenCameraException: Camera disabled or in use by other process
W/System.err: at com.jmolsmobile.landscapevideocapture.camera.CameraWrapper.openCamera(CameraWrapper.java:57)
W/System.err: at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.initializeCameraAndPreview(VideoRecorder.java:63)
W/System.err: at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.(VideoRecorder.java:58)
W/System.err: at com.jmolsmobile.landscapevideocapture.VideoCaptureActivity.initializeRecordingUI(VideoCaptureActivity.java:83)
W/System.err: at com.jmolsmobile.landscapevideocapture.VideoCaptureActivity.onCreate(VideoCaptureActivity.java:71)
W/System.err: at android.app.Activity.performCreate(Activity.java:6303)
W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2374)
W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2481)
W/System.err: at android.app.ActivityThread.access$900(ActivityThread.java:153)
W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err: at android.os.Looper.loop(Looper.java:148)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5432)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:735)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)

TOP-LEVEL EXCEPTION

UNEXPECTED TOP-LEVEL EXCEPTION:

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2

如上,不知道和哪个包冲突还是重复了,只要加上compile 'com.github.JeroenMols:LandscapeVideoCamera:1.1.3'就无法通过编译。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.