Tokbox iOS: Video call disconnects when phone lock - ios

I am using tokbox for video calling in my iOS application. I am getting the issue when while video calling, when I lock the app, the stream gets disconnected and the call ends.

This documentation outlines running TokBox in the background, i.e. when the phone is locked. The following is an excerpt from the limitations of running TokBox in the background:
Apps cannot do the following while in the background state:
Use the camera as a video source for a publisher.
The documentation goes on to explain that you can keep an audio-only session active when running in the background, but not a video session.

Related

Using Vidyo and Callkit on iOS - Audio question

I've integrated Vidyo with CallKit on iOS for VOIP, except for one issue: Audio is sometimes muted on connection, and either needs the microphone toggled twice, or stays muted. I'm using the Vidyo.io resource to connect. I know that Apple has special calls to enhance audio when using voip protocols, but I do not call these, because I think Vidyo is handling the audio here (plus I don't know what to call!). Has anyone successfully integrated CallKit into Vidyo, and, if so, what do you do for Configure AVAudioSession?

OpenTok (iOS) - Best practice to start a video chat when one participant has the app in background

We have Participant A and Participant B.
A triggers sessionDidConnect
A triggers session streamCreated
A pauses the app. The app is running in background
B triggers sessionDidConnect
B triggers session streamCreated
When A brings the app to foreground, then the connection and stream get destroyed. I would like to understand what we are doing wrong.
When is the best moment to call the following methods?
session.publish(publisher, ...)
session.subscribe(subscriber, ...)
Thx for your help.
TokBox Developer Evangelist here.
In order to prevent your application from disconnecting from the session in background mode, please do the following:
Open XCode
Click on Capabilities and turn on Background Modes
Check the Audio, AirPlay, and Picture in Picture option
Rebuild the application.
After making these changes, your application will stay connected to the session, publish audio, and stay subscribed to the streams in the session when in background mode, but you will not be able to publish video until the application is brought to the foreground.

Access iOS microphone without muting audio?

If a user runs Spotify or another audio app in the background while playing my game, the audio is fine until I access the microphone, at which point audio gets muted.
The release notes for AIR 15.0.0.27 state that one of the fixed issues is:
[iOS8] Requesting microphone access terminates all further audio.
However, I'm experiencing this with AIR 15.0.0.356.
Can this be avoided? And if not, what do I do to restore audio again after the user is done using the microphone?

How do I start a Record iOS audio session in the background?

I'm trying to start a kAudioSessionCategory_RecordAudio after my app is woken up in the background but not forefront (like during a significant location change, I have seen other apps in the store do this so I know it is possible). However whenever I try to start the audio session like so
CheckError(AudioQueueStart(queue,
NULL),
"AudioQueueStart failed");
I get this error:
Error: AudioQueueStart failed (-12985)
So I read up on that but only suggestion is setting the audio session to active AudioSessionSetActive(YES) but that also fails with a '!cat' error. Apparently you can try to toggle the active state of the audio session but that hasn't worked for me.
I have the audio background mode plist flag set and starting an audio session while my app is forefront then switching to another app works (shows the red bar showing that it is recording). Its just starting the audio session while the app isn't forefront is the issue.
Does anyone have a sample project I could look at demonstrating starting a recording audio session in the background?
Note: I am looking for a solution that uses audio queues as I need the audio in buffers, not a file.
It turns out that Apple's SpeakHere sample code with some modifications will start recording audio in the background if you just add the audio multitasking flag to info.plist and add the appropriate significant location change APIs. You might look https://github.com/benvium/SpeakHere for an updated version of SpeakHere since Apple hasn't updated it in awhile.
Currently, iOS does not allow starting an audio session or audio recording in the background. An app has to start audio in the foreground, but can just throw away any recorded audio data until needed, which could be in the background when using the appropriate background modes and audio session.

iPhone restore AudioSession in Play&Record after playing youtube video

I have a problem about managing AudioSession (set as Play&Record category) interruptions in my VoIP app in iOS 5.x.
When I have a call in progress, going background and starting youtube app, the audio session begin-interruption occurs and I can put in pause the current call.
The problem is when I return to foreground and want to reactive my call (WITHOUT killing youtube app, simply putting it in background previously): no end-interruption callback occurs and even if I force to set active my previous audioSession, it returns error.
I check if the audio resources are maybe in use by other process (with AudioSessionGetProperty (kAudioSessionProperty_OtherAudioIsPlaying,...) but they don't.
If I kill manually youtube app the end-interruption occurs instead and there's no problem.
Since normally no one kills manually the app, how can i restore the audioSession of my call??
I've checked other examples and Viber works correctly and can "intercepts" in some way the end-interruption.
Another strange behaviour is that if I set also "allowMixing" category in my AudioSession, it is completely ignored in iOS 5.x (youtube takes control of audio resources) while in iOS 4.x it works as it should (that is I listen in contemporary the audio call and youtube mixed).
I had a similar issue. I solved it by stopping and (re-) starting my audio unit in the interruption callback.

Resources