这是indexloc提供的服务,不要输入任何密码
Skip to content

[bug] iOS Audio Ducking of External Audio (e.g., Ringback Tone) with LiveKit #791

@rahulraj-idt

Description

@rahulraj-idt

Describe the bug
On iOS, an external audio stream (e.g., ringback tone via just_audio) is ducked/silenced when a LiveKit room connection is established. Playing a ring back tone is a crucial feature for any VoIP app.

To Reproduce

  • Connect to the room
await room.connect(
     llivekitURL,
     livekitToken,
   )
  • Play ring back tone while waiting for the callee to join
Future<void> startRingbackTone() async {
    try {
      _audioPlayer ??= AudioPlayer();
      await _audioPlayer!.setAsset('.../ringing.mp3');
      await _audioPlayer!.setLoopMode(LoopMode.all);
      await _audioPlayer!.play();
    } catch (e) {
      Log.error('RingbackTonePlayer: Failed to start ringback tone: $e');
    }
  }
  • Then unable to hear the ring back tone since livekit connection ducking external audio (significantly reduced).
    Expected behavior
    The audio stream continues to play clearly alongside LiveKit audio.
    Note that I’ve already tried configuring the WebRTC audio both before and after the LiveKit connection, but the issue persists.
    if (Platform.isIOS) {
      try {
        await webrtc.Helper.setAppleAudioConfiguration(webrtc.AppleAudioConfiguration(
          appleAudioCategory: webrtc.AppleAudioCategory.playAndRecord,
          appleAudioCategoryOptions: {
            webrtc.AppleAudioCategoryOption.mixWithOthers,
            webrtc.AppleAudioCategoryOption.defaultToSpeaker,
            webrtc.AppleAudioCategoryOption.allowBluetooth,
            webrtc.AppleAudioCategoryOption.allowBluetoothA2DP,
          },
          appleAudioMode: webrtc.AppleAudioMode.videoChat,
        ));
        Log.info('LiveKit: iOS audio configuration set for mixing with ringback tone');
      } catch (e) {
        Log.error('LiveKit: Failed to configure iOS audio session: $e');
      }
    }

Platform information
iOS 18.4.1

  • Flutter version:
    3.24.5
  • Plugin version:
    livekit_client: ^2.4.7
  • Flutter target OS:
    iPhone - iOS 18.4.1
    ^^ @cloudwebrtc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions