[+] 终端信令连接

This commit is contained in:
acgist
2022-11-13 12:14:10 +08:00
parent b8f243c64c
commit 8d1392a6da
21 changed files with 412 additions and 70 deletions

View File

@@ -50,11 +50,35 @@
list.appendChild(child);
}
const taoyao = new Taoyao();
taoyao
.init()
.buildUserMedia()
.then(stream => taoyao.local('local', stream))
.catch((e) => alert('获取终端媒体失败:' + e));
// 初始
taoyao.init();
// 配置媒体
taoyao.request('/config/media', {}, 'GET', false)
.then(response => {
taoyao.configMedia(response.audio, response.video);
})
.catch(e => console.error('获取媒体配置失败', e));
// 配置WebRTC
taoyao.request('/config/webrtc', {}, 'GET', false)
.then(response => {
taoyao.configWebrtc(response);
taoyao.buildChannel(callback);
})
.catch(e => console.error('获取WebRTC配置失败', e));
// 信令回调
function callback(data) {
switch(data.header.pid) {
case 1000:
// 心跳
break;
}
}
// 信令通道
/*
taoyao.buildLocalMedia()
.then(stream => taoyao.localMedia('local', stream))
.catch((e) => alert('获取终端媒体失败:' + e));
*/
</script>
</body>
</html>