When previewing videos in LapTimer I thought it was odd that there was never any sound, then I noticed that my iPhone was on silent (using the switch on the side in case is matters) and as soon as I took it off silent the sound was there.
So seems like a bug that LapTimer isn't playing sound like Photos etc does if silent mode is enabled. I'm assuming the app needs to tell iOS to ignore silent mode some how in the playback call it makes.
Videos play without sound
-
- 20 or more Posts ★★★
- Posts: 29
- Joined: Wed Jun 01, 2022 2:00 pm
Re: Videos play without sound
3rd party apps cannot play sounds in case the mute button is triggered. There are choices only Apple apps have.
- Harry
- Harry
-
- 20 or more Posts ★★★
- Posts: 29
- Joined: Wed Jun 01, 2022 2:00 pm
Re: Videos play without sound
Just did some quick digging and wonder if that has changed now as this apple developer article seems to indicate that you can override this behaviour by configuring the playback category.
Does this help?
Code: Select all
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let audioSession = AVAudioSession.sharedInstance()
do {
try audioSession.setCategory(.playback)
} catch {
print("Setting category to AVAudioSessionCategoryPlayback failed.")
}
return true
}
Re: Videos play without sound
I think this is checking whether the phone is muted, not overriding mode of operation. Probably an item that could be displayed in LapTimer's Health Check.
- Harry
- Harry
-
- 20 or more Posts ★★★
- Posts: 29
- Joined: Wed Jun 01, 2022 2:00 pm
Re: Videos play without sound
From the description it sounds like it does override and allow sound playback in silent mode:
An audio session category defines the general audio behavior your app requires. AVFoundation defines several audio session categories that you can use, but most media playback apps require the playback category. This category indicates that audio playback is a central feature of your app. When you specify this category, your app’s audio continues with the Ring/Silent switch set to silent mode (iOS only). Enabling this category also allows your app to play background audio if you’re using the “Audio, AirPlay, and Picture in Picture” background mode
-
- 20 or more Posts ★★★
- Posts: 29
- Joined: Wed Jun 01, 2022 2:00 pm
Re: Videos play without sound
Awesome thanks