Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12210] iOS: Audio Ducking Support

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterDawson Toth
AssigneeUnknown
Created2013-01-04T19:27:05.000+0000
Updated2018-02-28T20:04:16.000+0000

Description

Feature

Add support for "ducking" and "unducking" the iOS audio session. The SDK doesn't expose this right now, but it can very easily. An example of ducking is when the GPS lowers other sounds to say something, then raises them after it is done speaking.

Proposed Solution

Expose "Ti.Media.ducking = true /* or false */;". Something like the following: In TiMediaAudioSession.m:
-(void)setDucking:(UInt32)mode
{
	if ([self isActive]) {
		DebugLog(@"[WARN] Setting ducking while playing audio... changes will not take effect until audio is restarted.");
	}
	AudioSessionSetProperty(kAudioSessionProperty_OtherMixableAudioShouldDuck,sizeof(mode),&mode);
}
And in MediaModule.m:
-(void)setDucking:(NSNumber*)mode
{
    [[TiMediaAudioSession sharedSession] setDucking:[mode unsignedIntValue]];
}

Apple Documentation

Apple talks about this feature in the last paragraph on this page: http://developer.apple.com/library/ios/#documentation/Audio/Conceptual/AudioSessionProgrammingGuide/Configuration/Configuration.html

Comments

  1. Trevor Chong 2015-01-30

    Yes, Please allow more flexibility with regards to iOS audio session options like AVAudioSessionCategoryOptionMixWithOthers and AVAudioSessionCategoryOptionDuckOthers.

JSON Source