Stream publishing parameters changing on the fly¶
Since WebSDK build 2.0.258 some stream publishing parameters may be changed on the fly, without stopping and starting the stream again. This works in Chromium based and Safari browsers.
Stream resolution changing¶
A stream publishing resolution may be changed by Stream.updateVideoResolution
method
function onResolutionClick(stream) {
stream.updateVideoResolution({
width: parseInt($('#sendWidth').val()),
height: parseInt($('#sendHeight').val())
}).then(function(constraints) {
console.log("Publishing video constraints changed to " + JSON.stringify(constraints));
}).catch(function(e) {
console.error("Error " + e);
});
}
Under the hoods, the video track will be re-created with the new resolution constraints. All the other constraints are not affected.
Warning
The resolution constraints are recommendations for a browser, not requirement. The browser may drop the video resolution if publisher channel is not so good, or if publisher hardware performance does not allow to capture and encode the resolution.
Stream encoding parameters changing¶
A stream encoding parameters may be changed by Stream.updateVideoSettings
method
In this case, stream video track encoding parameters are changed without the track re-creation. They even may be changed simutaneously
Warning
Encoding bitrate only may be set by such way. A bandwidth limit has a priority above the encoder bitrate. For example, if the bandwidth is limited to 1000 kbps, and encoder bitrate is set to 1500 kbps, the video track will be published with 1000 kbps bitrate