Skip to content

feat: add abandonAudioFocus() API (QAP-4557) - #7

Merged
jun-planfit merged 1 commit into
mainfrom
feature/abandon-audio-focus
Mar 5, 2026
Merged

feat: add abandonAudioFocus() API (QAP-4557)#7
jun-planfit merged 1 commit into
mainfrom
feature/abandon-audio-focus

Conversation

@jun-planfit

Copy link
Copy Markdown

Summary

  • Add abandonAudioFocus() method to explicitly release audio focus on Android
  • When coaching audio is paused/stopped, other apps (YouTube Music, etc.) can immediately restore their volume
  • Uses ExoPlayer's setAudioAttributes toggle for handleAudioFocus=true mode, and custom FocusManager.abandonAudioFocusIfHeld() otherwise
  • iOS: no-op (resolve nil)

Changed Files

  1. src/NativeTrackPlayer.ts - TurboModule spec
  2. src/trackPlayer.ts - JS API function
  3. BaseAudioPlayer.kt - Core implementation
  4. MusicService.kt - Service wrapper
  5. MusicModule.kt - Bridge method
  6. TrackPlayer.mm - iOS no-op

Test plan

  • YouTube Music 재생 → 코칭 시작 (ducking 확인) → 일시정지 → 볼륨 복원 확인
  • 재개 → 다시 ducking 확인
  • 빠른 일시정지/재개 반복 → 크래시 없이 동작
  • iOS 리그레션 확인

Adds a new API to explicitly abandon audio focus when the player is paused/stopped,
allowing other apps (YouTube Music, etc.) to restore their volume immediately
instead of requiring full app termination. (QAP-4557)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jun-planfit
jun-planfit merged commit 1dd7d87 into main Mar 5, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant