-
Notifications
You must be signed in to change notification settings - Fork 523
Volume Control
Richard Groves edited this page Jun 23, 2015
·
2 revisions
For performance reasons, the volume property does not work on iOS unless you initialise the STKAudioPlayer
with the enableVolumeMixer
option as follows:
STKAudioPlayerOptions audioOptions;
memset(&audioOptions, 0, sizeof(audioOptions));
audioOptions.enableVolumeMixer = YES;
STKAudioPlayer* audioPlayer = [[STKAudioPlayer alloc] initWithOptions:audioOptions];
On iOS it is recommended that you use the MPVolumeView class to allow the user to control the volume (https://developer.apple.com/library/ios/documentation/mediaplayer/reference/MPVolumeView_Class/Reference/Reference.html).
Mac OSX allows direct volume control of the default output Audio Unit so the volume property will work without enabling STKAudioPlayerOptionEnableVolumeMixer
.