I want to make an application which creates sound, music, or system sound when an iPhone is in silent mode. Is it possible to play any type of sound whether music or system tones when it is silent mode?
In Find My iPhone on iCloud.com, click All Devices, then select the device you want to play a sound on. If you don't see All Devices, it's because you've already selected a device. Click the name of the current device in the center of the toolbar to access the Devices list, then select a new device. Click Play Sound.
Your iPhone's audio system is apparently glitching because it still plays notification sounds even when it's already set to silent. Many people who have encountered the same issue for the first time have found a quick fix by simply switching silent mode off and then on again shortly.
You can't play two audio tracks from the same iTunes source or the like but you can connect within apps using “bus” to play along side each other and interact or chain off one another as well.
Open the Find My app. Choose the Devices tab or the Items tab. Select your missing device or item, then choose Play Sound. If your device is offline, it won't play a sound until it connects to a network.
It's not advisable, but who am I to say you can't do it. You may have a good reason to be playing sound.
If you are using Audio Sessions, then include <AVFoundation/AVFoundation.h>
at the start of your file and
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: nil];
should do the trick. Note if you play music or sounds, then iPod playback will be paused.
Once this has been done, probably somewhere in the initialization of one of your classes that plays the sounds, you can instantiate sounds like this:
// probably an instance variable: AVAudioPlayer *player; NSString *path = [[NSBundle mainBundle] pathForResource...]; NSURL *url = [NSURL fileURLWithPath:path]; player = [[AVAudioPlayer alloc] initWithContentsOfURL:url];
When that's done, you can play with it any time you want with:
[player play]; // Play the sound [player pause]; // Pause the sound halfway through playing player.currentTime += 10 // skip forward 10 seconds player.duration // Get the duration
And other nice stuff. Look up the AVAudioPlayer Class reference.
And for Swift 2, 3, 4.2
do { try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback) try AVAudioSession.sharedInstance().setActive(true) } catch { print(error) }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With