Reputation: 11
I'm developing a Flutter application that needs to keep SIP calls persistent even when the app is killed. I've been using the flutter_foreground_task
plugin to achieve this, but I'm encountering some issues, especially with video calls. Here's what I've done so far:
flutter_foreground_task
The flutter_foreground_task
plugin allows creating a background service in a separate isolate from the main/UI isolate. After the user logs in, the background service starts, resulting in two isolates: the UI isolate and the SIP service isolate. Data is sent between these isolates to manage the UI state.
For audio calls, the SIP service isolate sends the following data to the main isolate:
Microphone state (bool
)
Hold state (bool
)
Local and remote user names (String
)
This approach works perfectly for audio calls as the data sent are primitive data types.
But for video calls, I need to send an additional MediaStream
object to the main isolate. However, since MediaStream
is not a primitive data type, I can't implement video calling using the same method.
How can I keep SIP video calls persistent in the background in a Flutter application? Is there a way to work around the limitation of sending non-primitive data types between isolates, or is there an alternative approach to achieve this?
Upvotes: 0
Views: 73