-
-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Audio IOS native #602
Comments
same here, @robsonvasquez did you find solution for this? |
I have the same problem 👋 |
Hi! I solved my issue by switching to the fixed WebRTC version 7.0.1, as with other versions, the audio would either play only on the recipient’s end or only on the caller’s end, depending on the WebRTC version. Here’s an example of how the delegate turned out: import UIKit @UIApplicationMain
} Unfortunately, I'm having an audio issue on iOS when making a call from the app to someone. The audio doesn’t work on iOS, and the device’s microphone doesn’t open. This call is made with the app open through Flutter. If anyone manages to resolve this, please let me know. |
Hmm... In my case i ended up with using FlutterMethodChannel to manually activate/deactivate audio session when inviting/accepting calls on iOS side in foreground mode And background/terminated/locked screen modes audio are handled by callkit via didActivateAudioSession/didDeactivateAudioSession // AppDelegate.swift
// probably you'll need some of these imports
import CallKit
import PushKit
import flutter_callkit_incoming
import AVFAudio
import WebRTC
import Foundation
// didFinishLaunchingWithOptions:
let controller = window?.rootViewController as! FlutterViewController
let methodChannel = FlutterMethodChannel(
name: "com.example.app/swift",
binaryMessenger: controller.binaryMessenger
)
methodChannel.setMethodCallHandler { (call, result) in
switch call.method {
case "start-av":
RTCAudioSession.sharedInstance().audioSessionDidActivate(AVAudioSession.sharedInstance())
RTCAudioSession.sharedInstance().isAudioEnabled = true
return
case "stop-av":
RTCAudioSession.sharedInstance().audioSessionDidDeactivate(AVAudioSession.sharedInstance())
RTCAudioSession.sharedInstance().isAudioEnabled = false
return
default:
result(FlutterMethodNotImplemented)
}
}
// ... // signaling.dart
import 'package:flutter/services.dart';
final methodChannel = const MethodChannel('com.example.app/swift');
// call connected
// use .ignore() to ignore errors on android version
// actually i store call id inside of call session "session.call_id"
if (callData['id'] != null) {
await FlutterCallkitIncoming.setCallConnected(callData['id']);
} else {
methodChannel.invokeMethod('start-av', {}).ignore();
}
// call disconnected
// no call_id means call happened in foreground without callkit
await FlutterCallkitIncoming.endAllCalls();
if (callData['id'] == null) {
methodChannel.invokeMethod('stop-av', {}).ignore();
} |
Forgot to mention i use iPhone 8 (iOS 16.7.10) and latest versions of callkit+webrtc but for me there no difference when i switching versions # Flutter 3.29.0 • channel stable
flutter_webrtc: ^0.12.11
flutter_callkit_incoming: ^2.5.0 And also i use this callkit config for background/terminated handling (same variables on swift side) ios: IOSParams(
iconName: 'AppIcon',
handleType: 'generic',
supportsVideo: true,
maximumCallGroups: 1,
maximumCallsPerCallGroup: 1,
audioSessionMode: callType == 1 ? 'videoChat' : 'voiceChat',
audioSessionActive: true,
configureAudioSession: true,
audioSessionPreferredSampleRate: 44100.0,
audioSessionPreferredIOBufferDuration: 0.005,
supportsDTMF: false,
supportsHolding: false,
supportsGrouping: false,
supportsUngrouping: false,
ringtonePath: 'system_ringtone_default',
), Also i seen similar issues in webrtc package |
I’m using WebRTC and flutter_callkit_incoming. When I make a call and answer through iOS's native interface, the audio doesn’t play on the iPhone, but it does for the recipient. It was working perfectly on iOS before 10/20/2024 with the latest versions of both libraries, but then the audio just stopped working on iOS when using CallKit to answer. Switching WebRTC versions sometimes makes the audio work on iOS but not for the recipient, and other versions have the opposite effect. Is anyone else experiencing audio issues with both libraries when answering through iOS's native interface?
Delegate
import UIKit
import Flutter
import awesome_notifications
//import shared_preferences_ios
import shared_preferences_foundation
import CallKit
import AVFAudio
import PushKit
import flutter_callkit_incoming
import WebRTC
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate, PKPushRegistryDelegate, CallkitIncomingAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
}
// Call back from Recent history
override func application(_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
}
}
}
The text was updated successfully, but these errors were encountered: