Browse Source

feat: 多人音视频功能

master
xsx 2 years ago
parent
commit
8b824eead5
  1. 6
      im-ui/src/api/camera.js
  2. 2
      im-ui/src/components/rtc/RtcGroupVideo.vue

6
im-ui/src/api/camera.js

@ -9,15 +9,15 @@ ImCamera.prototype.isEnable = function() {
return !!navigator && !!navigator.mediaDevices && !!navigator.mediaDevices.getUserMedia;
}
ImCamera.prototype.openVideo = function(isFacing) {
ImCamera.prototype.openVideo = function() {
return new Promise((resolve, reject) => {
if(this.stream){
this.close()
}
let facingMode = isFacing ? "user" : "environment";
let constraints = {
video: {
facingMode: facingMode
with: window.screen.width,
height: window.screen.height
},
audio: {
echoCancellation: true, //音频开启回音消除

2
im-ui/src/components/rtc/RtcGroupVideo.vue

@ -498,7 +498,7 @@
return new Promise((resolve, reject) => {
if (this.isCamera) {
// +
this.camera.openVideo(this.isFacing).then((stream) => {
this.camera.openVideo().then((stream) => {
console.log("摄像头打开成功")
this.stream = stream;
//

Loading…
Cancel
Save