Browse Source

feat: 多人音视频功能

xsx 1 năm trước cách đây
mục cha
commit
8b824eead5
2 tập tin đã thay đổi với 4 bổ sung4 xóa
  1. 3 3
      im-ui/src/api/camera.js
  2. 1 1
      im-ui/src/components/rtc/RtcGroupVideo.vue

+ 3 - 3
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, //音频开启回音消除

+ 1 - 1
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;
 							// 显示本地视频