iOS SDK - Custom UI - Can't play music and meeting audio together

Description
I’m currently working on a Zoom integration which involves using Custom UI. It’s going quite well thanks to the documentation and code examples available. However I’m having an issue on iOS where if a user is in a meeting, and they start some music in, for example, Spotify, the meeting’s audio cuts out. That is, although the video is still displayed and updated, no sound can be heard until the user goes and stops their music.

I’ve spent some time looking into this, and having tested the Sample app, I can see that the audio mixing works when using the preset UI, however, when switching to the Custom UI in the provided sample app I see the same issue that I’m experiencing.

My question is, then, are there any configuration options I can change so that music can be played along side meeting audio when using the Custom UI?

Which version?
mobileRTC Version: 4.6.15805.0403

To Reproduce(If applicable)

  1. Open the Zoom iOS SDK Sample App
  2. Enable Custom UI from settings
  3. Enter a meeting
  4. Connect audio
  5. Confirm that meeting audio can be heard
  6. Open Spotify (Or music app of your choice)
  7. Start some music
  8. Return to the Sample App
  9. Meeting audio can no longer be heard

Smartphone (please complete the following information):

  • Device: iPhone SE (2016)
  • OS: iOS 13.3.1

Additional context
It’s possible to play meeting audio and music audio with the Android SDK.

Hi tony_mz,

Thanks for using Zoom SDK and thanks for the detailed explanation. Let me forward this to the engineering team for further investigation and get back to you shortly.

Thanks!

Hi tony_mz,

Please have a try with the following:

  1. Before starting a meeting, add the following:
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];
  1. When you are returning to your own app, in the delegate applicationDidBecomeActivie, add the following:
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];

Please have a try and see if it helps. Thanks!

Thanks for the reply, I appreciate it. Unfortunately I wasn’t able to solve the problem with this.

I’m testing with the MobileRTCSample project, and so I added this line to
- (void)joinMeeting:(NSString*)meetingNo withPassword:(NSString*)pwd on line 409, MainViewController.m, and also to the AppDelegate applicationDidBecomeActivie.

This message shows up in the log when I press play on the music while in a meeting with audio.
2020-05-07 17:56:33.973623+0100 MobileRTCSample[863:128886] audioSessionDidInterruptNotification 1

Just to confirm my exact steps when testing this:

  1. Run MobileRTCSample on my iPhone SE
  2. Go to Settings -> Meeting Settings and ensure ‘Custom Meeting’ is enabled
  3. Click Join a Meeting, enter meeting number, click ok
  4. Enter display name, and click ok
  5. Admit myself to the meeting from my host client
  6. Click ‘Join Audio’ in MobileRTCSample, then Call via Internet
  7. Confirm that the MobileRTCSample is receiving sound from my host client
  8. Swipe up the iOS control panel
  9. Click play on the audio widget
  10. Swipe down the iOS control panel to return to the MobileRTCSample app
  11. Confirm that the MobileRTCSample app is no longer receiving sound from the meeting

Thank you.

Hi tony_mz,

Thanks for the detailed information. I will forward this to the engineering team for further investigation. Will get back to you shortly.

Thanks!

1 Like

Just an update, I’ve now managed to resolve the issue.
Thank you for your help and advice.

Hi tony_mz,

Glad to hear that the problem has resolved. May I inquire how you resolve this issue? Would like to know for future reference.

Thanks!

No problem, I ended up using method swizzling to swap out the AVAudioSession.setCategory method, such that it added in the .mixWithOthers option on every call.

Thank you very much for sharing this. Happy Zooming! :slight_smile:

Hello there,

I’m being working with screen broadcast.

Initially my approach was share view, later switched to Broadcast Upload Extension.

Basically i’m trying to screen share few presentations which also has video content with audio.
The problem i’m facing here is, when sharing my screen, if any video is played, user and host can talk but i was unable to send audio generated from video at the same time.

I tried AVAudioSession with playback, ambient and also with mixWithOther options and many modes in combination, but nothing really worked.
Also swizzled the setCategory, still didn’t work out.

Background mode Audio, Airplay and Picture in picture is active.

Videos are presented with AVPlayer and default playback from WKWebView(it loads the video from local directory).

Please provide a solution or workaround.

To Reproduce

  1. Create custom meeting, and let user joins the meeting.
  2. Start broadcasting screen.
  3. Player a local video in the application with AVPlayer or stream via wkwebview.
  4. Check at user end whether video sound is coming or not, also the sound from microphone must be heard at the same time.
  • Device: iPad pro
  • OS: iOS
  • Version 13.5.1

Thanks in advance!

Hi @nitesh.vishwakarma,

Thanks for using Zoom SDK. Currently the audio sharing feature only works in Zoom default UI. It is not yet supported under Custom UI mode.

THanks!

Sure but even in zoom default ui they might have worked with some apple’s private api’s or any sound configuration.

If any guy from engineering department can let out some sound configuration, it would really help us out.

Please consider this request, and thank you so much for replying early.

Hi @nitesh.vishwakarma,

Thanks for the reply. Yes, I have forwarded this as a feature request to the engineering team and the team will investigate the possibility of adding this feature. Please follow our Github repo for any updates: https://github.com/zoom/zoom-sdk-ios

Thanks!

Hi,

Is any way to detect “Start broadcast” tapped or not?
I want to dismiss “RPSystemBroadcastPickerView” when user taps on “Start broadcast”. Please let me know any solution for this.

Hi @tony_mz @nitesh.vishwakarma

Please give any solution for this .

Is any way to detect “Start broadcast” tapped or not?
I want to dismiss “RPSystemBroadcastPickerView” when user taps on “Start broadcast”. Please let me know any solution for this.

Hi @pandiyaraj,
I have done a work around for this,
I used appgroup and store data in extension (Bool) with a specific KEY, when broadcast extension gets started init is called (set value true), when extension get finish (set value false).

In main app,
Use nsdefault to observe the Key.
Make sure to observe all this option Initial, Old and new.

Extension code :-

In init function :-
NSUserDefaults * defaults = [[NSUserDefaults alloc] initWithSuiteName:groupID];
[defaults setBool:true forKey:broadcastKey];
[defaults synchronize];

In broadcastFinished function :-
[defaults setBool: FALSE forKey:broadcastKey];
[defaults synchronize];

Main App Inside a ViewController

NSUserDefaults * appGroup = [[NSUserDefaults alloc] initWithSuiteName:groupID];
[appGroup addObserver:self forKeyPath:broadcastKey options: NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil];
[appGroup setBool:false forKey:broadcastKey]; // MAKE SURE TO INIT ONCE WITH FALSE, ELSE YOU WON’T GET CALL BACK FIRST TIME.

Next Override this function to observe when value is changed.

  • ( void )observeValueForKeyPath:(NSString *)keyPath ofObject:( id )object change:(NSDictionary *)change context:( void *)context {}

I hope it helps!

Thank you so much @nitesh.vishwakarma,

I’ll check and let you know.