doublesymmetry / react-native-track-player

A fully fledged audio module created for music apps. Provides audio playback, external media controls, background mode and more!
https://rntp.dev/
Apache License 2.0
3.31k stars 1.02k forks source link

Mute or Pause Audio on screen recording #2380

Closed pro-softs closed 1 month ago

pro-softs commented 1 month ago

Describe the Bug Even if we disable the screen recording with expo , the audio playback gets recorded. I want to disable recording of audio during screen record.

Steps To Reproduce Play any audio with this module. Then start screen recording. Audio is captured in the screen recording video

Environment Info: Paste the results of npx react-native info - System: OS: macOS 14.4.1 CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz Memory: 47.28 MB / 8.00 GB Shell: version: 3.2.57 path: /bin/bash Binaries: Node: version: 20.1.0 path: ~/.nvm/versions/node/v20.1.0/bin/node Yarn: version: 1.22.22 path: ~/Documents/projects/fanfliq/fanfliq-app/fanfliq-fan-app/node_modules/.bin/yarn npm: version: 9.6.4 path: ~/.nvm/versions/node/v20.1.0/bin/npm Watchman: version: 2024.01.22.00 path: /usr/local/bin/watchman Managers: CocoaPods: version: 1.15.2 path: /Users/progupta/.rbenv/shims/pod SDKs: iOS SDK: Platforms:

react-native-track-player version - 4.1.1 Using on Real device Both Android and ios.

How I can Help There is an option in Android using AudioManager.setAllowedCapturePolicy in android to disable system or third-party app to disable the audio capture. Any possibility to use this in the code. I tried adding this in the MusicService.kt file but couldn't get it working. Can anyone help out with this.

lovegaoshi commented 1 month ago

this should be implemented by YOU. organize AudioManager.setAllowedCapturePolicy calls in your own module/activity.

pro-softs commented 1 month ago

Yeh As mentioned I did but it was not working. Is there any solution for this in Android?

lovegaoshi commented 1 month ago

look up in the android dev documentation..?

to help you ask a better question next time, you posted no information that nobody knows what you did. and you would have a better chance asking in the native android community, as this has nothing to do with rn or rntp.

On Mon, Oct 7, 2024, 10:47 AM Proshanto Gupta @.***> wrote:

Yeh As mentioned I did but it was not working. Is there any solution for this in Android?

— Reply to this email directly, view it on GitHub https://github.com/doublesymmetry/react-native-track-player/issues/2380#issuecomment-2397533000, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZMOVVTT5YRC2FVGSIJQRP3Z2LCJLAVCNFSM6AAAAABPNBIN6WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJXGUZTGMBQGA . You are receiving this because you commented.Message ID: @.*** com>

pro-softs commented 1 month ago

It's fine if you can't help. Asking this question here is appropriate as this library uses the underlying kotlin audio player which has the AudioAtributes implementation which according to Android documentation should support the playback capture blocking.

I have created my own build and used in my app. Closing this now.