Coder Social home page Coder Social logo

bmcreations / scrcast Goto Github PK

View Code? Open in Web Editor NEW
212.0 212.0 26.0 1.64 MB

Drop-in Android Screen Recording Library

Home Page: https://bmcreations.github.io/scrcast/

License: Apache License 2.0

Kotlin 91.46% Java 7.30% Shell 1.23%
android android-library androidx coroutines kotlin mediarecorder recording screencapture screencast

scrcast's People

Contributors

bmc08gt avatar circalucid avatar masoodfallahpoor avatar zackees 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

scrcast's Issues

Is updateOptions() to be used if I want change the directory where video is saved?

I have setup the recorder like so:

recorder = ScrCast.use(this);
recorder.updateOptions(GetDefaultOptions());

and the GetDefaultOptions() function is defined as follows:

private static Options GetDefaultOptions() {
            return new Options(
                    new VideoConfig(),
                    new StorageConfig("somedir", Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM)),
                    new NotificationConfig(),
                    false,
                    0,
                    true
            );
    }

I was assuming that updateOptions function would do the needful but when I inspect the recorder object in the debugger, the outputDirectory for the recorder seems to be different from that of the options object of the recorder.

How am I supposed to change the directory where the video is saved.

Non default directory name is not respected.

Describe the bug
When I record the screen using the sample app, the recorded video is saved in a directory named "scrcast".

Expected behavior
The video should be saved in a directory named "scrcast-sample".

To Reproduce
Just use the sample app to record the screen.

Version
Library version 0.3.0
Device: Samsung Galaxy S9+ running Android 10 (API level 29)

"No matching variant of dev.bmcreations:scrcast:0.3.0 was found." using gradle

Describe the bug
I cannot install library using gradle. After adding implementation "org.jetbrains.kotlin:kotlin-reflect:1.6.21" to dependencies in build.gradle and running build I am getting following error:

   > Could not resolve dev.bmcreations:scrcast:0.3.0.
     Required by:
         project :xyz-kotlin
      > No matching variant of dev.bmcreations:scrcast:0.3.0 was found. The consumer was configured to find a runtime of a component, preferably only the resources files but:
          - Variant 'releaseApiPublication' capability dev.bmcreations:scrcast:0.3.0:
              - Incompatible because this component declares an API of a component, with the library elements 'aar' and the consumer needed a runtime of a component, preferably only the resources files
          - Variant 'releaseRuntimePublication' capability dev.bmcreations:scrcast:0.3.0 declares a runtime of a component:
              - Incompatible because this component declares a component, with the library elements 'aar' and the consumer needed a component, preferably only the resources files

the same happens for version 0.2.0

Expected behavior
build ends wiht success

To Reproduce
Add implementation "org.jetbrains.kotlin:kotlin-reflect:1.6.21" to dependencies in build.gradle and run a build

Logs/Screenshots
If applicable, add logs or screenshots to help explain your problem.

Version
Library version: 0.3.0, 0.2.0
Ubuntu 20:04
java openjdk version "17.0.5" 2022-10-18
kotlin

Expose state as observable field via LiveData/Flow

Allow view observers to bind to scrcast for current state and not force receivers to handle lifecycle bounds (e.g callback when app isn't in foreground - just don't emit when not active). Replayable (last state) will allow observers to update any UI elements derived from our state (is recording, is idle, is in start delay, is paused)

Update default notification to resemble Android 11 UX

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is.

No

Describe the solution you'd like
A clear and concise description of what you want to happen.

UX improvement to the default notification to be closer to what Android 11's implementation proposes.

Additional context
Add any other context or screenshots about the feature request here.

cannot record audio

Describe the bug
setAudioSource(MediaRecorder.AudioSource.MIC)
setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB)

when i add these lines in createrecorder method .i am unable to record audio and recording screen.please fix issue or guide me how can i enable audio when screen recording..please anyone help me

Expected behavior
A clear and concise description of what you expected to happen.

To Reproduce
How can we reproduce this?

Logs/Screenshots
If applicable, add logs or screenshots to help explain your problem.

Version
What library version are you using? Also does this occur on a specific API level or Android device.

When importing library, other library is required and is failing the build;

this messege appear in the build log:

Searched in the following locations:
  - https://dl.google.com/dl/android/maven2/com/github/bmc08gt/activity-results-dispatcher/master-SNAPSHOT/maven-metadata.xml
  - https://dl.google.com/dl/android/maven2/com/github/bmc08gt/activity-results-dispatcher/master-SNAPSHOT/activity-results-dispatcher-master-SNAPSHOT.pom
  - https://dl.google.com/dl/android/maven2/com/github/bmc08gt/activity-results-dispatcher/master-SNAPSHOT/activity-results-dispatcher-master-SNAPSHOT.jar
  - https://jcenter.bintray.com/com/github/bmc08gt/activity-results-dispatcher/master-SNAPSHOT/maven-metadata.xml
  - https://jcenter.bintray.com/com/github/bmc08gt/activity-results-dispatcher/master-SNAPSHOT/activity-results-dispatcher-master-SNAPSHOT.pom
  - https://jcenter.bintray.com/com/github/bmc08gt/activity-results-dispatcher/master-SNAPSHOT/activity-results-dispatcher-master-SNAPSHOT.jar
  - https://maven.google.com/com/github/bmc08gt/activity-results-dispatcher/master-SNAPSHOT/maven-metadata.xml
  - https://maven.google.com/com/github/bmc08gt/activity-results-dispatcher/master-SNAPSHOT/activity-results-dispatcher-master-SNAPSHOT.pom
  - https://maven.google.com/com/github/bmc08gt/activity-results-dispatcher/master-SNAPSHOT/activity-results-dispatcher-master-SNAPSHOT.jar
Required by:
    project :app > dev.bmcreations:scrcast:0.2.0


the build gradle file:
repositories {
        jcenter()
        google()
        mavenCentral()
    }

mediaStorageLocation is overwritten/not used for storing videos

Bug
I set the directory, directoryName, and fileNameFormatter I want in the object options. The fileNameFormatter specified is used, but the video is not saved to the correct directory.

Expected behaviour
The video saves to the specified directory.

Logs/Screenshots
First line is the storage directory specified (recorder.options.storage.mediaStorageLocation immediately after applying options to recorder).
Second line is the path to which the video file is actually saved (file.absolutePath in onRecordingFinished callback).
image

Version
v0.3.0

Note
I'm relatively new to Android development, so it may be a simple mistake in my code rather than a bug.

Not working on Android Q+

The file of recording is not being saved on Android Q+ (I think the library doesn't have a Scoped storage support)

Add snapshot() functionality for screenshots during a recording

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is.

No

Describe the solution you'd like
A clear and concise description of what you want to happen.

The ability to capture a specific frame during an ongoing recording to focus in on something could prove useful for certain usecases (e.g QA use)

Additional context
Add any other context or screenshots about the feature request here.

  • Add direct API to snapshot(delay: Long)
  • Add notification support (dismiss status bar and snapshot)

Android 12 Issue - MediaRecorder "prepare failed"

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

Recording screen when app is in landscape mode it records small screen.

Describe the bug
When recording screen and app is in land scape mode it still records as Portrait and shows small landscape recording in between.

Expected behavior
When app is in landscape it should record screen as landscape with full screen width and height and save video with full resolution. it should save Lanscape recording into full screen width and height with correct orientation.

To Reproduce
How can we reproduce this?
I am using this capacitor plugin for my Ionic app:
https://github.com/Cap-go/capacitor-screen-recorder

Test Repo: https://github.com/Saqib92/capacitor-screen-recording

Logs/Screenshots
TNfvMc

Exception lib usage in Fragment

Describe the bug
It is a runtime exception when attempted to create instance of ScrCast about lifecycle.

java.lang.IllegalStateException: LifecycleOwner y@d1a71e8 is attempting to register while current state is RESUMED. LifecycleOwners must call register before they are STARTED.

Expected behavior
Expected creation of ScrCast and later start recording.

To Reproduce
Try to create instance of class in fragment (no matter onCreate, onActivityCreated, onViewCreate)

Logs/Screenshots
image
image

E/AndroidRuntime: FATAL EXCEPTION: main
Process: kz.nurbank.app.dev, PID: 32114
java.lang.IllegalStateException: LifecycleOwner kz.crystalspring.ib_for_individuals.ui.activities.client_restrictions.ClientRestrictionsActivity@d1a71e8 is attempting to register while current state is RESUMED. LifecycleOwners must call register before they are STARTED.
at androidx.activity.result.ActivityResultRegistry.register(ActivityResultRegistry.java:123)
at androidx.activity.ComponentActivity.registerForActivityResult(ComponentActivity.java:659)
at androidx.activity.ComponentActivity.registerForActivityResult(ComponentActivity.java:668)
at dev.bmcreations.scrcast.ScrCast.(ScrCast.kt:166)
at dev.bmcreations.scrcast.ScrCast.(ScrCast.kt:42)
at dev.bmcreations.scrcast.ScrCast$Companion.use(ScrCast.kt:375)
at kz.crystalspring.ib_for_individuals.ui.accounts.accounts_binding.form.photo.face.ContactOperationFaceFragment.onCreate(ContactOperationFaceFragment.kt:86)
at androidx.fragment.app.Fragment.performCreate(Fragment.java:2949)
at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:475)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:278)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2106)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002)
at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:524)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:236)
at android.app.ActivityThread.main(ActivityThread.java:8061)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)

Version
minSdk: 23
targetSdk: 30
libraryVersion: 0.3.0

Add auto-pause when own app package isn't in foreground

Is your feature request related to a problem? Please describe.
Allow end users to only allow recording to occur on their own app processes - auto pausing when their app is backgrounded.

Describe the solution you'd like
Add configuration option to auto-pause when scrcast detects that the client app process is transitioning to the background.

Additional context
#50

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.