logo
On this page

Minimize audio room window

In-app minimization

With only two simple steps, you can achieve the effect of minimizing the audio room window within the application. Ideally, the final effect will look like this:

Integrate in-app minimization

1
Display minimize button

To display the minimize button, configure the ZegoUIKitPrebuiltLiveAudioRoomConfig's topMenuBar, and add the ZegoLiveAudioRoomMenuBarButtonName.minimizingButton button to the top menu bar.

2
Configure the Overlay

To achieve the effect of minimizing the window, you need to use the ZegoUIKitPrebuiltLiveAudioRoomMiniOverlayPage component and insert it into the Overlay of the app.

3
Prevent building multiple ZegoUIKitPrebuiltLiveAudioRoom

When you minimize the interface, if the button is not restricted, clicking the enter button again will enter the live audio room again. To avoid this situation, it is necessary to restrict the button.

Therefore, in the click event of the button, you need to handle it: if it is currently in a minimized state, do not carry out the page jump operation.

After completing the above two steps, you can now minimize the audio room window within the application.

Out-of-app minimization

PIP, also known as Picture In Picture, is a window displayed when the application is in background.

In addition, interactive operations are not allowed at this time, so it is only in viewing mode.

The default value of ZegoLiveAudioRoomPIPConfig.enableWhenBackground is true, which means the PIP feature is enabled by default. If you don't want to enable it, you can set it to false.

If you want to display the PIP window by clicking a button, you can achieve this by adding ZegoCallMenuBarButtonName.pipButton to topMenuBar.buttons.

The final effect will look like this:

ezgif-6-ecee9ad8fe.gif

Integrate with button

Untitled
ZegoUIKitPrebuiltLiveAudioRoom(
  appID: YourAppID,
  appSign: YourAppSign,
  userID: userID,
  userName: userName,
  roomID: roomID,
  config: isHost
      ? ZegoUIKitPrebuiltLiveAudioRoomConfig.host()
      : ZegoUIKitPrebuiltLiveAudioRoomConfig.audience()
    ..pip.enableWhenBackground = true,
    ..topMenuBar.buttons = [
      ZegoLiveAudioRoomMenuBarButtonName.pipButton
    ],
),
1
Copied!

Config

  • ZegoLiveAudioRoomPIPConfig
AttributeDescriptionType
aspectWidthaspect widthint
aspectHeightaspect heightint
enableWhenBackgroundandroid: only available on SDK higher than 31(>=31)bool
androidandroid configZegoLiveAudioRoomPIPAndroidConfig
  • ZegoLiveAudioRoomPIPAndroidConfig
AttributeDescriptionType
backgroundbackground widget, default is a black widgetWidget?
showUserNameshow user name or notbool
userNameTextColortext color of user name, default is whiteColor?