# Mute video when app goes in background

**URL:** <https://devforum.zoom.us/t/mute-video-when-app-goes-in-background/43490>\
**Category:** Meeting SDK\
**Created:** [February 16, 2021, 4:17pm UTC](https://devforum.zoom.us/t/mute-video-when-app-goes-in-background/43490 "2021-02-16T16:17:24Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhishek.nagpure](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/abhishek.nagpure/32/17909_2.png) [@abhishek.nagpure](https://devforum.zoom.us/u/abhishek.nagpure)\
**Post date:** [February 16, 2021, 4:17pm UTC](https://devforum.zoom.us/t/mute-video-when-app-goes-in-background/43490/1 "2021-02-16T16:17:24Z")

</div>

**Description**  
Hello, I am using CustomMeetingUI.  
I want to mute the video when the app goes in the background.  
I have registered UIApplication.willResignActiveNotification and performed `meetingService.muteMyVideo(true)` on this event, but the app is crashing after it.

Please let me know if there is anything else to be done.

**Which version?**  
v5.4.54802.0124

---

<div class="post-metadata">

**Author:** ![Michael\_Condon](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_condon/32/13543_2.png) [@Michael\_Condon](https://devforum.zoom.us/u/Michael_Condon)\
**Post date:** [February 17, 2021, 9:27pm UTC](https://devforum.zoom.us/t/mute-video-when-app-goes-in-background/43490/2 "2021-02-17T21:27:59Z")

</div>

Hey @abhishek.nagpure,

Thanks for using the dev forum!

I just did a quick test on the latest version and did not see the same behavior. The video turns into just the user’s name after they have backgrounded the application.  
Do you also have  
MobileRTC.shared().appWillResignActive()  
being called?

Here is my appDelegate code:

```
@main
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        return true
    }

    func applicationWillTerminate(_ application: UIApplication) {
        MobileRTC.shared().appWillTerminate()
    }

    func applicationDidBecomeActive(_ application: UIApplication) {
        MobileRTC.shared().appDidBecomeActive()
    }

    func applicationWillResignActive(_ application: UIApplication) {
        MobileRTC.shared().getMeetingService()?.muteMyVideo(true)
        MobileRTC.shared().appWillResignActive()
    }

    func applicationDidEnterBackground(_ application: UIApplication) {
        MobileRTC.shared().appDidEnterBackgroud()
    }
}

```

Thanks!  
Michael

---

<div class="post-metadata">

**Author:** ![abhishek.nagpure](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/abhishek.nagpure/32/17909_2.png) [@abhishek.nagpure](https://devforum.zoom.us/u/abhishek.nagpure)\
**Post date:** [February 18, 2021, 4:22pm UTC](https://devforum.zoom.us/t/mute-video-when-app-goes-in-background/43490/3 "2021-02-18T16:22:27Z")

</div>

Hello Michael,  
Thank you so much for your prompt reply.

This solution resolved the issue and achieved the expected behavior.

Regards,  
Abhishek

---

<div class="post-metadata">

**Author:** ![Michael\_Condon](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_condon/32/13543_2.png) [@Michael\_Condon](https://devforum.zoom.us/u/Michael_Condon)\
**Post date:** [February 18, 2021, 10:04pm UTC](https://devforum.zoom.us/t/mute-video-when-app-goes-in-background/43490/4 "2021-02-18T22:04:36Z")

</div>

Hey @abhishek.nagpure,

Awesome! I am really happy to hear! 🙂

Please let us know if you have any other questions.  
Michael

---

<div class="post-metadata">

**Author:** ![abhishek.nagpure](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/abhishek.nagpure/32/17909_2.png) [@abhishek.nagpure](https://devforum.zoom.us/u/abhishek.nagpure)\
**Post date:** [February 22, 2021, 6:14am UTC](https://devforum.zoom.us/t/mute-video-when-app-goes-in-background/43490/5 "2021-02-22T06:14:58Z")

</div>

Hello Michael,  
Yes, I do have one more question. Let me tell you the scenario,

Suppose, if the participant joins the non-started meeting, then the participant is added to the waiting queue.  
And later on, when the host starts the meeting, after some seconds he is shown the popup to admit that same participant.

So my question is, can we reduce or configure this time which is taken in between ie. from meeting start to showing admit popup ( for the already waiting participant). And after what time does the ZoomSDK check for the meeting is started or not.

Waiting for your reply, thank you once again.

---

<div class="post-metadata">

**Author:** ![Michael\_Condon](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_condon/32/13543_2.png) [@Michael\_Condon](https://devforum.zoom.us/u/Michael_Condon)\
**Post date:** [February 22, 2021, 7:29pm UTC](https://devforum.zoom.us/t/mute-video-when-app-goes-in-background/43490/6 "2021-02-22T19:29:58Z")

</div>

Hey @abhishek.nagpure,

> [@abhishek.nagpure](#):
>
> can we reduce or configure this time which is taken in between ie. from meeting start to showing admit popup ( for the already waiting participant).

No, this time is not cofigurable. The prompt will try to be shown as soon as possible.

> [@abhishek.nagpure](#):
>
> And after what time does the ZoomSDK check for the meeting is started or not.

I do not believe there is a defined time period for this. When the meeting is started a network request is sent to the meeting listeners to inform them the meeting has started.

Thanks!  
Michael

---

<div class="post-metadata">

**Author:** ![abhishek.nagpure](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/abhishek.nagpure/32/17909_2.png) [@abhishek.nagpure](https://devforum.zoom.us/u/abhishek.nagpure)\
**Post date:** [February 25, 2021, 8:37am UTC](https://devforum.zoom.us/t/mute-video-when-app-goes-in-background/43490/7 "2021-02-25T08:37:51Z")

</div>

Hi Michael, Thank you for the updates.

I have one more question, after updating the SDK to the latest one, the MobileRTCVideoAspect\_PanAndScan, is not showing video in full screen.  
Some black space is appearing from the top of the videoView.

videoView = MobileRTCActiveVideoView(frame: baseView.bounds)  
videoView.setVideoAspect(MobileRTCVideoAspect\_PanAndScan)

---

<div class="post-metadata">

**Author:** ![Michael\_Condon](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_condon/32/13543_2.png) [@Michael\_Condon](https://devforum.zoom.us/u/Michael_Condon)\
**Post date:** [February 25, 2021, 9:08pm UTC](https://devforum.zoom.us/t/mute-video-when-app-goes-in-background/43490/8 "2021-02-25T21:08:18Z")

</div>

Hey @abhishek.nagpure,

At what point in your ViewController’s lifecycle are you calling this code?

Thanks!  
Michael

---

<div class="post-metadata">

**Author:** ![abhishek.nagpure](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/abhishek.nagpure/32/17909_2.png) [@abhishek.nagpure](https://devforum.zoom.us/u/abhishek.nagpure)\
**Post date:** [February 26, 2021, 6:48am UTC](https://devforum.zoom.us/t/mute-video-when-app-goes-in-background/43490/9 "2021-02-26T06:48:04Z")

</div>

Hey [Michael\_Condon](https://devforum.zoom.us/u/michael_condon),

I am calling this code in the viewDidLoad().  
I also tried calling this in DispatchQueue.main.async {} or in viewDidAppear(), however, it is not showing up on the full screen.

---

<div class="post-metadata">

**Author:** ![Michael\_Condon](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_condon/32/13543_2.png) [@Michael\_Condon](https://devforum.zoom.us/u/Michael_Condon)\
**Post date:** [February 26, 2021, 6:17pm UTC](https://devforum.zoom.us/t/mute-video-when-app-goes-in-background/43490/10 "2021-02-26T18:17:17Z")

</div>

Hey @abhishek.nagpure,

I see, can you run it inside of viewDidAppear. Once the black space starts showing, start the view debugger, and rotate the view debugger so that I can see the layers of the views? If you are not comfortable sharing the UI of your application on this public forum, you can also send it to [developersupport@zoom.us](mailto:developersupport@zoom.us) with a note that I sent you.

Thanks!  
Michael

---

<div class="post-metadata">

**Author:** ![abhishek.nagpure](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/abhishek.nagpure/32/17909_2.png) [@abhishek.nagpure](https://devforum.zoom.us/u/abhishek.nagpure)\
**Post date:** [March 1, 2021, 6:26am UTC](https://devforum.zoom.us/t/mute-video-when-app-goes-in-background/43490/11 "2021-03-01T06:26:10Z")

</div>

Hello [Michael\_Condon](https://devforum.zoom.us/u/michael_condon),

I followed the mentioned instructions and shared the screenshots on the given email, please check.

---

<div class="post-metadata">

**Author:** ![Michael\_Condon](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_condon/32/13543_2.png) [@Michael\_Condon](https://devforum.zoom.us/u/Michael_Condon)\
**Post date:** [March 1, 2021, 6:30pm UTC](https://devforum.zoom.us/t/mute-video-when-app-goes-in-background/43490/12 "2021-03-01T18:30:28Z")

</div>

Hey @abhishek.nagpure,

Awesome, thank you for sending those over. Will follow up there 🙂

Thanks!  
Michael
