Jump to content

silent phone mode

Recommended Posts

Please tell me how to check the silent mode on the iPhone or not?

any ideas
thank you in advance

Share this post

Link to post

The "trick" here seems just to play, and measure the time.

    private func playSound() {
            self.interval = Date.timeIntervalSinceReferenceDate //<==== Measure before

            AudioServicesPlaySystemSoundWithCompletion(self.soundId) { [weak self] in
                self?.soundFinishedPlaying()   //<==== Start playing

    /// Called when AudioService finished playing sound
    private func soundFinishedPlaying() {
        self.isPlaying = false

        let elapsed = Date.timeIntervalSinceReferenceDate - self.interval //<==== Measure elapsed time
        let isMute = elapsed < 0.1  //<==== !! Decide here whether it was muted or not



Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now