lichobile icon indicating copy to clipboard operation
lichobile copied to clipboard

Sound effects interrupt music / background audio on iOS

Open ulope opened this issue 4 years ago • 11 comments

Describe the bug When game event sounds are enabled they constantly pause any background audio that may be playing (e.g. music, podcasts, PiP videos). This is incredibly annoying!

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Settings'
  2. Click on 'Sound | Notifications'
  3. Switch on 'Toggle Sound'
  4. Play background audio
  5. Play a game.
  6. Each move will pause audio.

Expected behavior Sound effects not interfering with background audio.

Smartphone

  • Device: iPhone XS and 13 Pro
  • OS: iOS 14, iOS 15

ulope avatar Nov 18 '21 20:11 ulope

IIRC I switched to AVAudioPlayer to play sound effects because people were complaining they couldn't adjust the volume. But I agree this isn't the right way to play audio effects and this issue is annoying, so I'll try to fix it.

veloce avatar Nov 19 '21 08:11 veloce

Can't reproduce on my ipad 15.1. The audio player is already configured to play ambiant sounds, which can mix with other audio apps: https://github.com/veloce/capacitor-sound-effect/blob/main/ios/Plugin/SoundEffectPlugin.swift#L17

See: https://developer.apple.com/design/human-interface-guidelines/ios/user-interaction/audio/

veloce avatar Nov 19 '21 09:11 veloce

Here’s a screen recording showing the problem: https://youtube.com/shorts/2niQxUgrqok?feature=share

This is on iOS 15.0.2 on an iPhone 13 Pro.

ulope avatar Nov 21 '21 21:11 ulope

Also cannot repro:

  • iPad, iOS 14.8.1, Lichess v7.13.1
  • iPhone 13 Pro (simulator), iOS 15.0, Lichess v7.14.0

jas14 avatar Nov 22 '21 13:11 jas14

I had this issue on

Device: iPhone 11 Pro
OS: ios 15.0.2
Version 7.13.1

but not anymore on ios 15.1

eshirvana avatar Nov 22 '21 20:11 eshirvana

@ulope perhaps you should try to upgrade to ios 15.1 to see if it solves your issue?

veloce avatar Nov 23 '21 11:11 veloce

Yeah will do that and report back. It's still weird though. I don't have this issue with any other app that plays sound effects (games, productivity apps, etc.).

ulope avatar Nov 23 '21 12:11 ulope

Ok, with 15.1.1 the problem appears to be fixed :)

ulope avatar Nov 23 '21 14:11 ulope

Hm I think I spoke too soon.

At least with Netflix in PIP mode the problem still happens. Haven't tested with other apps yet.

ulope avatar Dec 01 '21 09:12 ulope

It happens on Android 8.1. I have tested with the same version and the same music file. On Android 12, the background music is not interrupted, but on Android 8.1, the music is briefly interrupted when the sound effect is played. At first, I wondered if this is because the device (8.1) is too weak in terms of processing power, but when I used the mobile web version on FireFox Android, the same sound effect could be played without interrupting the background music, so I suspect that it is probably some sort of incorrect coding for playing sound effect in Android 8.1.

HubKing avatar Jan 14 '22 01:01 HubKing

I came here to file the same issue. This is SUPER annoying and it's 100% reproducible for me. iOS 15.4 on an iPhone 11, with Lichess 7.15.1

Merely opening Lichess is enough to hijack the audio. I'm using Bluetooth headphones and my phone is on silent mode--Lichess still produces sound effects in silent mode if headphones are active.

The headphones may be the key to reproducing the issue; it may not manifest otherwise.

bdkjones avatar Mar 25 '22 19:03 bdkjones

lichess moves don't interrupt music but starting the app does for me lmao

kelvinwop avatar Jan 26 '23 19:01 kelvinwop

https://user-images.githubusercontent.com/30770221/215559043-afa5d0be-fb45-44f9-9624-4a0d60719c11.MP4

see opening the app causes an interrupt

kelvinwop avatar Jan 30 '23 18:01 kelvinwop