MCPcopy Index your code
hub / github.com/JeroenMols/LandscapeVideoCamera

github.com/JeroenMols/LandscapeVideoCamera @1.3.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.3.0 ↗ · + Follow
336 symbols 1,156 edges 32 files 15 documented · 4% updated 6y ago1.3.0 · 2017-03-15★ 1,21111 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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" }
          }

2) Add a dependency on the library:

          compile 'com.github.JeroenMols:LandscapeVideoCamera:1.2.2'

3) Specify the VideoCaptureActivity in your manifest:

         <activity
             android:name="com.jmolsmobile.landscapevideocapture.VideoCaptureActivity"
             android:screenOrientation="sensor" >
         </activity>

4) 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" />

5) 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,...)

6) 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);

7) 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

Extension points exported contracts — how you extend this code

RecordingButtonInterface (Interface)
(no doc) [2 implementers]
library/src/main/java/com/jmolsmobile/landscapevideocapture/view/RecordingButtonInterface.java
VideoRecorderInterface (Interface)
(no doc) [2 implementers]
library/src/main/java/com/jmolsmobile/landscapevideocapture/recorder/VideoRecorderInterface.java
CapturePreviewInterface (Interface)
(no doc) [2 implementers]
library/src/main/java/com/jmolsmobile/landscapevideocapture/preview/CapturePreviewInterface.java

Core symbols most depended-on inside this repo

d
called by 19
library/src/main/java/com/jmolsmobile/landscapevideocapture/CLog.java
printStackTrace
called by 14
library/src/main/java/com/jmolsmobile/landscapevideocapture/camera/OpenCameraException.java
e
called by 13
library/src/main/java/com/jmolsmobile/landscapevideocapture/CLog.java
build
called by 13
library/src/main/java/com/jmolsmobile/landscapevideocapture/configuration/CaptureConfiguration.java
getFile
called by 11
library/src/main/java/com/jmolsmobile/landscapevideocapture/VideoFile.java
getDefault
called by 11
library/src/main/java/com/jmolsmobile/landscapevideocapture/configuration/CaptureConfiguration.java
stopRecording
called by 10
library/src/main/java/com/jmolsmobile/landscapevideocapture/recorder/VideoRecorder.java
getFullPath
called by 9
library/src/main/java/com/jmolsmobile/landscapevideocapture/VideoFile.java

Shape

Method 300
Class 30
Enum 3
Interface 3

Languages

Java100%

Modules by API surface

library/src/androidTest/java/com/jmolsmobile/landscapevideocapture/recorder/VideoRecorderTest.java33 symbols
library/src/androidTest/java/com/jmolsmobile/landscapevideocapture/camera/CameraWrapperTest.java29 symbols
library/src/main/java/com/jmolsmobile/landscapevideocapture/configuration/CaptureConfiguration.java28 symbols
library/src/main/java/com/jmolsmobile/landscapevideocapture/VideoCaptureActivity.java25 symbols
example/src/main/java/com/jmolsmobile/landscapevideocapture_sample/CaptureDemoFragment.java19 symbols
library/src/androidTest/java/com/jmolsmobile/landscapevideocapture/view/VideoCaptureViewTest.java18 symbols
library/src/main/java/com/jmolsmobile/landscapevideocapture/recorder/VideoRecorder.java17 symbols
library/src/main/java/com/jmolsmobile/landscapevideocapture/camera/NativeCamera.java17 symbols
library/src/main/java/com/jmolsmobile/landscapevideocapture/camera/CameraWrapper.java16 symbols
library/src/main/java/com/jmolsmobile/landscapevideocapture/view/VideoCaptureView.java15 symbols
library/src/androidTest/java/com/jmolsmobile/landscapevideocapture/preview/CapturePreviewTest.java15 symbols
library/src/androidTest/java/com/jmolsmobile/landscapevideocapture/configuration/CaptureConfigurationBuilderTest.java13 symbols

For agents

$ claude mcp add LandscapeVideoCamera \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact