TUILiveKit Release Notes
Live SDK Release Notes

<script src="https://video.sdk.qcloudecdn.com/web/TXLivePusher-2.1.0.min.js" charset="utf-8"></script>
body part of the HTML code. If it is imported into the head part, an error will be reported.id_local_video. Local video will be rendered in the container. To adjust the size of the container, style the div using CSS.<div id="id_local_video" style="width:100%;height:500px;display:flex;align-items:center;justify-content:center;"></div>
TXLivePusher. All subsequent operations will be performed via the instance.var livePusher = new TXLivePusher();
livePusher.setRenderView('id_local_video');
setRenderViewis unmuted by default. To mute video, obtain the video element using the code below.document.getElementById('id_local_video').getElementsByTagName('video')[0].muted = true;
// Set video qualitylivePusher.setVideoQuality('720p');// Set audio qualitylivePusher.setAudioQuality('standard');// Set the frame ratelivePusher.setProperty('setVideoFPS',25);
// Turn the camera onlivePusher.startCamera();// Turn the mic onlivePusher.startMicrophone();
rtmp:// with webrtc://.livePusher.startPush('webrtc://domain/AppName/StreamName?txSecret=xxx&txTime=xxx');
var hasVideo = false;var hasAudio = false;var isPush = false;livePusher.setObserver({onCaptureFirstAudioFrame: function() {hasAudio = true;if (hasVideo && !isPush) {isPush = true;livePusher.startPush('webrtc://domain/AppName/StreamName?txSecret=xxx&txTime=xxx');}},onCaptureFirstVideoFrame: function() {hasVideo = true;if (hasAudio && !isPush) {isPush = true;livePusher.startPush('webrtc://domain/AppName/StreamName?txSecret=xxx&txTime=xxx');}}});
livePusher.stopPush();
// Turn the camera offlivePusher.stopCamera();// Turn the mic offlivePusher.stopMicrophone();
TXLivePusher.checkSupport().then(function(data) {// Whether WebRTC is supportedif (data.isWebRTCSupported) {console.log('WebRTC Support');} else {console.log('WebRTC Not Support');}// Whether H.264 is supportedif (data.isH264EncodeSupported) {console.log('H264 Encode Support');} else {console.log('H264 Encode Not Support');}});
livePusher.setObserver({// Warnings for publishingonWarning: function(code, msg) {console.log(code, msg);},// Publishing statusonPushStatusUpdate: function(status, msg) {console.log(status, msg);},// Publishing statisticsonStatisticsUpdate: function(data) {console.log('video fps is ' + data.video.framesPerSecond);}});
var deviceManager = livePusher.getDeviceManager(); // Get the device list deviceManager.getDevicesList().then(function(data) { data.forEach(function(device) { console.log(device.deviceId, device.deviceName);}); }); // Switch cameras deviceManager.switchCamera('camera_device_id');
Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários