[TIMOB-24140] iOS: Ti.Media.audioSessionCategory not working with Ti.Media.Sound
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-11-28T22:14:58.000+0000 |
Affected Version/s | Release 6.0.0 |
Fix Version/s | Release 6.0.1 |
Components | iOS |
Labels | audiosessioncategory, background, ios, qe-6.0.1, sound |
Reporter | Hans Knöchel |
Assignee | Hans Knöchel |
Created | 2016-11-11T17:05:52.000+0000 |
Updated | 2019-11-26T19:59:46.000+0000 |
Description
Thanks to [~designbymind], he reported an issue via mail that indicates a problem with our
Ti.Media.AUDIO_SESSION_CATEGORY_*
constants. As of TIMOB-23925, we wrapped our Ti.Media constants and in [this line](https://github.com/appcelerator/titanium_mobile/pull/8456/files#diff-e19e566138e39044280d74cfee0d3b4eR217), I wrapped it to only be compiled when the Ti.Media.AudioPlayer
API is defined. But as it turns out, you can also use them for the Ti.Media.Sound
API, so we just need to add that statement as well.
Attachments
File | Date | Size |
---|---|---|
test_file.mp3 | 2016-11-11T19:12:20.000+0000 | 1430174 |
PR (master): https://github.com/appcelerator/titanium_mobile/pull/8600 PR (6_0_X): https://github.com/appcelerator/titanium_mobile/pull/8601 Test-case 1:
Test-case 2:
Tested the various audioSessionCategory constants available, and found the following results:
Ti.Media.AUDIO_SESSION_CATEGORY_AMBIENT:
_Also used for for 'play along' style applications, such a virtual piano that a user plays over iPod audio._ *RESULT:* - Spotify Music does not pause when app is opened or when Sound is played. (/) - AudioSessionCategory: AVAudioSessionCategoryAmbient (/)Ti.Media.AUDIO_SESSION_CATEGORY_RECORD:
_Session mode for recording audio; it silences playback audio._ - Spotify Music is paused when app is opened. (/) - Sound does not play. (/) - AudioSessionCategory: AVAudioSessionCategoryRecord (/)Ti.Media.AUDIO_SESSION_CATEGORY_SOLO_AMBIENT:
_When you use this category, audio from built-in applications, such as the iPod, is silenced. Your audio is silenced when the Ring/Silent switch is set to silent or when the screen locks._ *RESULT:* Spotify Music pauses when App is opened or when Sound is played. (/) Audio is silenced when the Ring/Silent switch is set to Silent. (/) Audio is silenced when screen is locked. (/) AudioSessionCategory: AVAudioSessionCategorySoloAmbient (/)Ti.Media.AUDIO_SESSION_CATEGORY_PLAYBACK:
_When using this mode, your application audio continues with the Ring/Silent switch set to silent or when the screen locks. This property normally disallows mixing iPod audio with application audio._ *RESULT:* Spotify Music pauses when App is opened or when sound is played. (/) Playback audio continues when device’s Ring/Silent switch is set to Silent. (/) Playback is silenced when screen is locked (x) Playback is silenced when app is backgrounded. (x) AudioSessionCategory: AVAudioSessionCategoryPlayback (/) *Reopening this issue* asTi.Media.AUDIO_SESSION_CATEGORY_PLAYBACK
does not meet the expected behaviour as described in the documentation. Tested On: iPhone 6 Plus 10.1.1 Device iPhone 5S 9.3.5 Device Mac OS Sierra (10.12.1) Ti SDK: 6.0.1.v20161121005220 Appc Studio: 4.8.0.201611121409 Appc NPM: 4.2.8 App CLI: 6.0.0 Xcode 8.1 Node v4.4.7 *EDIT:* After further investigation it was found that in order to allow background audio for iOS, the following needs to be specified in theIt does not seem that this instruction is present in our documentation for Ti.Media.Sound or Ti.Media.AudioPlayer.
Hi guys, I'm experiencing problems with background audio playing on iOS13.2.3 - on older versions(13.1 and 12.x.x) it was fine and working. Now, I can anything but when my app minimizes, audio stops(the goal is to start playing after local notification is received). Phone makes 0.5seconds sound and then it's silence. When I maximize app(go foreground), music plays(it seems that notification starts player to play, but no sound is comming from speaker when in background, after going foreground player plays not from start, but continues...) Can you please look at it? I tried AUDIO_SESSION_CATEGORY_PLAYBACK and AUDIO_SESSION_CATEGORY_AMBIENT, but no change... Thanks