apache / apache/cordova-plugin-media

[iOs] plugin configures AVAudioSession after AVAudioPlayer makes it active inside prepareToPlay

Open
#319 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
391
Forks
762
PR merge metrics
No merged PRs in 30d

Description

According to [AVAudioPlayer docs](https://developer.apple.com/documentation/avfaudio/avaudioplayer/1386886-preparetoplay) `prepareToPlay` activates audio session (in plugin it happens [here](https://github.com/apache/cordova-plugin-media/blob/master/src/ios/CDVSound.m#L357)). But plugin calls `setCategory` for `AVAudioSession` [a little bit later](https://github.com/apache/cordova-plugin-media/blob/master/src/ios/CDVSound.m#L374), i.e. at wrong time.

Contributor guide

Open the contributing guide

Research direction

Start in src/ios/CDVSound.m at the AVAudioPlayer prepareToPlay call near line 357 and the AVAudioSession setCategory call near line 374, then compare their order with the AVAudioPlayer prepareToPlay documentation. Done means the audio session category is configured at the correct point relative to activation and media playback still works on iOS.

Written by the indexing model from the issue text.

Assessment

Tech stack
objective-c
Domain
audio-video-rtc
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.