App in Background Or Lock Phone Then Spatial Audio Selector Not Working

App in Background Or Lock Phone Then Spatial Audio Selector Not Working

KetanSodvadiyaKetanSodvadiya Member Posts: 20
Hello,

For Spatial Audio,

Here we Declare Variable of CADisplayLink ->

private var AudioUpdater: CADisplayLink?


And Play Audio Function we write code for Play Spatial Audio ->

spatialNotificationAudioUpdater = CADisplayLink(target: self, selector: #selector(self.AudioUpdateUI))


And this function is used when my spatial start playing

 @objc func AudioUpdateUI() {

        AudioCurrentPosition = AudioCurrentFrame + AudioSkipFrame

        AudioCurrentPosition = max(AudioCurrentPosition, 0)

        AudioCurrentPosition = min(AudioCurrentPosition, AudioLengthSamples)

        // if reached end of audio file

        if AudioCurrentPosition >= AudioLengthSamples {

       }

}

When i play audio in Foreground mode then AudioUpdateUI() function is called but when my app is on Background (Phone Lock) then AudioUpdateUI() function is not Called.


Thanks,
Ketan.

Answers

Sign In or Register to comment.