products / solutions
Platform / Framework

Stream publishing issues

Products / Plugins:Video Call / Voice Call / Live Streaming

Platform / Framework:iOS / Android / macOS / Windows / Web

Last updated:2022-02-11 12:34


1. After calling the enableTrafficControl method to enable flow control, why does the mainstream decrease when the network quality is poor?

EnableTrafficControl There is no "channel" parameter in the method, and it only takes effect for the mainstream by default. When two streams are pushed at the same time, the auxiliary stream cannot use flow control.

2. How to directly push CDN for mini programs?

Call the startpublish method and set the sourceType parameter in publishOption to "CDN" to get the CDN push address, which can be used for push.

const {url} = await zg.startPublishingStream(data.pushStreamID,{sourceType:"CDN"})
3. The web platform created a stream through the "createStream" method and assigned a value to the "srcObject" of the video object. Why does the video object have no screen?

It can be handled in the following two ways:

  • Need to set the autoplay property to the video object to automatically play.
  • You can set the controls property to the video object, and the user can manually click the playback control to play it.

The autoplay attribute is invalid in the iOS Safari browser and needs to be handled in the second way.

4. How does the web platform push pure audio streaming?

The SDK internally pushes audio and video by default. If you want to push a pure audio stream, you need to set the attribute video of the camera object to "false" when calling the createStream method.

let localStream = await zg.createStream({
        camera: {
            video: false,//Do not push the video
            audio: true,
       }
  });
5. The web platform calls the createStream method to create a stream. Can the parameters audioInput and videoInput pass empty strings?
  • audioInput: audio input device, if it is not passed, it is the default device, optional.
  • videoInput: video input device, if not transmitted, it is the default device, optional. If the audioInput and videoInput parameters are not passed (the entire parameters do not need to be carried), the SDK will use the default device. If an empty string is passed, the device cannot be obtained, which can be written as audioInput: undefined and videoInput:undefined.
6. "devices detect error: NotReadableError Could not start video source" error occurred when creating a stream on the web platform?

Please refer to the following methods:

  1. The browser does not have the permission to obtain the media device, please check whether the page is allowed to obtain the media device information.
  2. The media device is occupied. If the camera is occupied, please check whether other programs are using the camera device.
7. The web platform reports an error "https or localhost required". Is "https" required?
  • Based on the privacy requirements of the browser's security policy, the web terminal calls the camera to force "https". This security policy is a requirement of the browser and the SDK must comply with it.
  • You can use "localhost" for integration testing first, and the "https" environment is still required for subsequent launches.
8. Web platform screen sharing, how to share the system sound and microphone sound?

Web screen sharing can choose the target window for sharing. Different platforms and different choices will have different performances:

Windows system:

  • Share the entire desktop and be able to push out the sound of the system.
  • Share browser tabs, only the sound of the tabs can be pushed out.
  • When sharing other application windows, the application sound cannot be pushed out.
  • Screen sharing cannot collect the sound of the microphone. The SDK needs to push the second stream to push the sound collected by the microphone.

Mac system: Unable to push out the sound of the system, only the video data can be pushed.

9. Call "enablePublishDirectToCDN" to push CDN directly, after stopping the push, do you need to reset "enablePublishDirectToCDN" to "false"?

It is necessary. It is recommended to call this interface in pairs and reset it to "false" every time you stop streaming.

10. How to set the horizontal screen when pushing the Mini Program?
  1. Set in the configuration file: "pageOrientation": "auto".
  2. Cancel the lock screen of the mobile phone, and the applet will automatically switch when it is pushed to the horizontal screen.
  3. When the page is switched between horizontal and vertical screens, it will be re-layout, requiring the user to make layout adaptation.
11. When using external collection, is it possible to push PNG images with transparent channels?

External collection supports the push of pictures with transparent channels, but when using SDK rendering (including local preview and streaming viewing), the transparent part of the picture will be displayed in black. The reasons are as follows:

  • SDK currently does not support rendering transparent channels.
  • When streaming from CDN, other players do not support transparent channel.
12. Does the push stream support setting a key, and need to use the corresponding key to pull the stream?

Express SDK 1.19.0 and later versions support this function. The push end uses "setPublishStreamEncryptionKey" to set the push key, and the pull end needs to use "setPlayStreamDecryptionKey" to set the corresponding key to pull the stream successfully.

This function is only supported on ZEGO Lianmai low-latency servers, not CDN.

13. How to set the preview and streaming mirroring on the Web platform?

Developers can add css styles to the "video" tags of preview and play stream, such as transform: scale(-1, 1);.

Page Directory
Download PDF