製品概要
サブ製品の説明
基本概念
製品機能
ユースケース
製品の優位性
使用制限

<script src="https://video.sdk.qcloudecdn.com/web/TXLivePusher-2.1.0.min.js" charset="utf-8"></script>
<div id="id_local_video" style="width:100%;height:500px;display:flex;align-items:center;justify-content:center;"></div>
TXLivePusherを介してSDKインスタンスを生成し、後続の操作はすべてインスタンスを介して完了します。var livePusher = new TXLivePusher();
livePusher.setRenderView('id_local_video');
setRenderViewdocument.getElementById('id_local_video').getElementsByTagName('video')[0].muted = true;
// ビデオ品質の設定livePusher.setVideoQuality('720p');// オーディオ品質の設定livePusher.setAudioQuality('standard');// フレームレートのカスタマイズ設定livePusher.setProperty('setVideoFPS', 25);
// カメラを起動livePusher.startCamera();// マイクを起動livePusher.startMicrophone();
rtmp://を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();
// カメラを終了livePusher.stopCamera();// マイクを終了livePusher.stopMicrophone();
TXLivePusher.checkSupport().then(function(data) { // WebRTCをサポートしているか if (data.isWebRTCSupported) { console.log('WebRTC Support'); }else{ console.log('WebRTC Not Support'); } // H264コードをサポートしているか if (data.isH264EncodeSupported) { console.log('H264 Encode Support'); }else{ console.log('H264 Encode Not Support'); }});
livePusher.setObserver({ // プッシュ警告情報 onWarning: function(code, msg) { console.log(code, msg); }, // プッシュ接続状態 onPushStatusUpdate: function(status, msg) { console.log(status, msg); }, // プッシュ統計データ onStatisticsUpdate: function(data) { console.log('video fps is ' + data.video.framesPerSecond); }});
var deviceManager = livePusher.getDeviceManager();// デバイスリストの取得deviceManager.getDevicesList().then(function(data) { data.forEach(function(device) { console.log(device.deviceId, device.deviceName); });});// カメラデバイスの切り替えdeviceManager.switchCamera('camera_device_id');
フィードバック