logo
On this page

How to set mirror mode in Express?

2022-11-04
Products / Plugins:Video Call / Audio Call / Live streaming
Platform / Framework:iOS / Android / macOS / Windows

ZEGO Express SDK provides the functionality to mirror video during encoding. You can call the setVideoMirrorMode interface before publishing or after stopping publishing. Use the "mirrorMode" parameter to set whether the local preview video and the published video (the video seen by the remote user) enable mirror mode. You can choose the specific mode according to your actual needs.

Note
  • setVideoMirrorMode also supports setting during the publishing process and takes effect immediately.
  • If your data is not rendered by the SDK, the local preview mirror in the mirror mode set by setVideoMirrorMode is invalid.

The currently supported mirror modes are as follows:

Enum ValueMeaningDescription
NO_MIRRORBoth local preview and the video seen by the stream playing end are not mirrored.After setting this mode, the local and remote views are not affected, that is, both are original effects.
ONLY_PREVIEW_MIRROROnly local preview is mirrored, this mode is used by default.On the local device, the local user's video stream is bound to the local view. The user can see the mirror effect displayed by the local view, and the remote view is not affected (that is, the original effect).
ONLY_PUBLISH_MIRROROnly the video seen by the stream playing end is mirrored.After the local video stream is encoded, it will be sent to the remote user to watch. After setting this mode, only the remote user's view is mirrored, which does not affect the local user's view (that is, the original effect).
BOTH_MIRRORBoth local preview and the video seen by the stream playing end are mirrored.After setting this mode, both local and remote users' views are affected, that is, both are mirrored effects.

The effects of the four mirror modes are as follows:

Taking setting the stream playing end mirror and local preview non-mirror as an example, the sample code for each platform is as follows:

  • iOS/macOS
[[ZegoExpressEngine sharedEngine] setVideoMirrorMode:ZegoVideoMirrorModeOnlyPublishMirror];
  • Android
engine.setVideoMirrorMode(ZegoVideoMirrorMode.ONLY_PUBLISH_MIRROR);
  • Windows
engine->setVideoMirrorMode(ZegoVideoMirrorMode::ONLY_PUBLISH_MIRROR);

Previous

After successful co-streaming between both parties, if one party stops publishing the stream due to powering off or killing the process, how long does the pulling party need to receive the stream removal message?

Next

Why does running the source code directly after downloading from GitHub result in an error?