Stream publishing issues
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.
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"})It can be handled in the following two ways:
- Need to set the
autoplayproperty to thevideoobject to automatically play. - You can set the
controlsproperty to thevideoobject, 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.
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,
}
});- 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: undefinedandvideoInput:undefined.
Please refer to the following methods:
- 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.
- The media device is occupied. If the camera is occupied, please check whether other programs are using the camera device.
- 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.
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.
It is necessary. It is recommended to call this interface in pairs and reset it to "false" every time you stop streaming.
- Set in the configuration file: "pageOrientation": "auto".
- Cancel the lock screen of the mobile phone, and the applet will automatically switch when it is pushed to the horizontal screen.
- When the page is switched between horizontal and vertical screens, it will be re-layout, requiring the user to make layout adaptation.
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.
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.
Developers can add css styles to the "video" tags of preview and play stream, such as transform: scale(-1, 1);.
