Start visio with user colision
When user enter in colision with other colision, webrtc start visio
This commit is contained in:
parent
d7d7be9ed0
commit
707931724f
4 changed files with 20 additions and 16 deletions
|
@ -40,13 +40,11 @@ export class MediaManager {
|
|||
//update tracking
|
||||
});
|
||||
|
||||
this.enabledMicrophone();
|
||||
this.enabledCamera();
|
||||
this.enabledMicrophone();
|
||||
|
||||
let webRtc = document.getElementById('webRtc');
|
||||
webRtc.classList.add('active');
|
||||
|
||||
//this.getCamera();
|
||||
}
|
||||
|
||||
enabledCamera() {
|
||||
|
@ -55,7 +53,6 @@ export class MediaManager {
|
|||
this.constraintsMedia.video = true;
|
||||
this.localStream = null;
|
||||
this.myCamVideo.srcObject = null;
|
||||
//this.getCamera();
|
||||
}
|
||||
|
||||
disabledCamera() {
|
||||
|
@ -73,14 +70,12 @@ export class MediaManager {
|
|||
}
|
||||
this.localStream = null;
|
||||
this.myCamVideo.srcObject = null;
|
||||
//this.getCamera();
|
||||
}
|
||||
|
||||
enabledMicrophone() {
|
||||
this.microphoneClose.style.display = "none";
|
||||
this.microphone.style.display = "block";
|
||||
this.constraintsMedia.audio = true;
|
||||
//this.getCamera();
|
||||
}
|
||||
|
||||
disabledMicrophone() {
|
||||
|
@ -94,7 +89,6 @@ export class MediaManager {
|
|||
}
|
||||
});
|
||||
}
|
||||
//this.getCamera();
|
||||
}
|
||||
|
||||
//get camera
|
||||
|
@ -103,7 +97,6 @@ export class MediaManager {
|
|||
.then((stream: MediaStream) => {
|
||||
this.localStream = stream;
|
||||
this.myCamVideo.srcObject = this.localStream;
|
||||
this.myCamVideo.play();
|
||||
return stream;
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
|
@ -119,7 +112,6 @@ export class MediaManager {
|
|||
addActiveVideo(userId : string){
|
||||
let elementRemoteVideo = document.getElementById("activeCam");
|
||||
elementRemoteVideo.insertAdjacentHTML('beforeend', '<video id="'+userId+'" autoplay></video>');
|
||||
|
||||
this.remoteVideo[(userId as any)] = document.getElementById(userId);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,10 @@ import {ConnexionInterface} from "../Connexion";
|
|||
import {MediaManager} from "./MediaManager";
|
||||
let Peer = require('simple-peer');
|
||||
|
||||
export interface SimplePeerInterface {
|
||||
startWebRtc(): void;
|
||||
}
|
||||
|
||||
export class SimplePeer {
|
||||
Connexion: ConnexionInterface;
|
||||
MediaManager: MediaManager;
|
||||
|
@ -11,16 +15,16 @@ export class SimplePeer {
|
|||
|
||||
constructor(Connexion: ConnexionInterface, roomId: string = "test-webrtc") {
|
||||
this.Connexion = Connexion;
|
||||
this.MediaManager = new MediaManager();
|
||||
this.RoomId = roomId;
|
||||
this.initialise();
|
||||
}
|
||||
|
||||
/**
|
||||
* server has two person connected, start the meet
|
||||
*/
|
||||
initialise() {
|
||||
return this.MediaManager.getCamera().then(() => {
|
||||
startWebRtc() {
|
||||
this.MediaManager = new MediaManager();
|
||||
return this.MediaManager.getCamera().then((stream: MediaStream) => {
|
||||
this.MediaManager.localStream = stream;
|
||||
//send message to join a room
|
||||
this.Connexion.sendWebrtcRomm(this.RoomId);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue