Code Monkey home page Code Monkey logo

Comments (2)

xigxmmbc avatar xigxmmbc commented on August 23, 2024

After making the following modifications, I can now open it
// val rates = audioCapabilities.supportedSampleRates
// if (rates != null && rates.isNotEmpty()) {

// val ratesUnsigned = rates.toUIntArray()
// val default = DiscreteSampleRateInfo.toNearest(ratesUnsigned, tryDefault)!!
//
// return DiscreteSampleRateInfo(ratesUnsigned, default)

@SuppressLint("SoonBlockedPrivateApi")
val SAMPLE_RATE_HZ_MIN_COMPAT: Int = 4000

@SuppressLint("SoonBlockedPrivateApi")
val SAMPLE_RATE_HZ_MAX_COMPAT: Int = 48000

Where are the codes to start and end recording? I want to use it to record WeChat calls. Is this feasible?

from bcr.

chenxiaolong avatar chenxiaolong commented on August 23, 2024
Caused by: java.lang.NullPointerException: Attempt to get length of null array
at android.media.MediaCodecInfo$AudioCapabilities.getSupportedSampleRates(MediaCodecInfo.java:973)

That's unfortunate. Seems like a bug in MIUI if it's crashing within the Android framework.

Where are the codes to start and end recording? I want to use it to record WeChat calls. Is this feasible?

The recording process for a single call is handled by RecorderThread. When the thread starts, the recording starts. When the thread is cancelled, the recording stops.

The thread is created from RecorderInCallService. It registers a callback with Android's telephony framework so that it is notified when the call state changes (onCallAdded()/onCallRemoved()/onStateChanged()/onDetailsChanged()).

If you want to modify the code to record third party apps, it'll likely take a significant amount of work. At the very least, RecorderInCallService would have to be replaced with custom call detection logic because Android doesn't really have an API to detect VOIP calls in third party apps. I'm guessing you'd probably need to use the accessibility API to determine when WeChat's calls begin and end.

RecorderThread would probably also need to be updated to point to whichever audio stream WeChat uses (phone calls use MediaRecorder.AudioSource.VOICE_CALL, but third party VOIP calls likely use something different).

from bcr.

Related Issues (20)

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.