LiveGBS中GB28181协议摄像头语⾳对讲前端采集代码代码⽰例
在vue中,利⽤websocket进⾏⾼性能的GB28181语⾳对讲前端代码
......
talkStart(e) {
if(!this.ws) {
var ws = new WebSocket(this.wsTalkURL());
console.log("ws talk open");
this.ws = ws;
}
console.log("ws talk close");
}
console.log("ws talk error", evt);
}
}
var $target = $(e.currentTarget);
der) {
$target.addClass("active");
return;
}
<((rec, err) => {
if(err) {
alert(err);
return
}
// this.$refs["player"].setMuted(true);
$target.addClass("active");
}, {
sampleBits: 16,
sampleRate: 8000,
pcmCallback: pcm => {
// binary to base64 string
var reader = new window.FileReader();
var base64 = sult;
var base64 = base64.split(',')[1];
if(this.ws) {
this.ws.send(base64);
}
}
}
})
},
talkStop() {
der) {
// der = null;
$(this.$el).find(".fa-microphone.active").removeClass("active"); // this.$refs["player"].setMuted(false);
}
if(this.ws) {
this.ws.close();
this.ws = null;
}
},
......
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论