Skip to content

Commit

Permalink
[#24] wip: wip userlist cam mic
Browse files Browse the repository at this point in the history
  • Loading branch information
eunyeong1113 committed Feb 14, 2022
1 parent 23be0dd commit a55670d
Show file tree
Hide file tree
Showing 5 changed files with 8,908 additions and 8,676 deletions.
91 changes: 60 additions & 31 deletions src/components/meetingroom/VideoRoomComponent copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class VideoRoomComponent extends Component {

isHostfun() {
isHost = postData.isHost;
console.log(isHost, '호스트닝?');
// console.log(isHost, '호스트닝?');
if (isHost === true) {
localUser.setHost(localUser.isHost());
}
Expand All @@ -92,7 +92,7 @@ class VideoRoomComponent extends Component {
window.addEventListener('resize', this.updateLayout);
window.addEventListener('resize', this.checkSize);
this.joinSession();
console.log('url' + this.props.openviduServerUrl);
// console.log('url' + this.props.openviduServerUrl);
}
componentWillUnmount() {
window.removeEventListener('beforeunload', this.onbeforeunload);
Expand All @@ -107,7 +107,7 @@ class VideoRoomComponent extends Component {

joinSession() {
this.OV = new OpenVidu();
console.log(this.OV);
// console.log(this.OV);
this.setState(
{
session: this.OV.initSession(),
Expand All @@ -121,12 +121,12 @@ class VideoRoomComponent extends Component {

connectToSession() {
if (this.props.token !== undefined) {
console.log('token received: ', this.props.token);
// console.log('token received: ', this.props.token);
this.connect(this.props.token);
} else {
this.getToken()
.then((token) => {
console.log(token);
// console.log(token);
this.connect(token);
})
.catch((error) => {
Expand Down Expand Up @@ -280,32 +280,61 @@ class VideoRoomComponent extends Component {
localUser.getStreamManager().publishAudio(localUser.isAudioActive());
this.sendSignalUserChanged({ isAudioActive: localUser.isAudioActive() });
this.setState({ localUser: localUser });

this.remoteCamChange();
this.subscribeToUserChanged();
}

remoteCamChange(){

this.state.subscribers[0].setVideoActive(true);
this.state.subscribers[0].getStreamManager().subscribeToVideo(true);
this.sendSignalUserChanged({ isVideoActive: true });

const user = this.state.subscribers.filter(
(userName) => userName.nickname === "jy"
)[0];
console.log(user,"filter")
for (let i = 0; i < this.state.subscribers.length; i++) {
let user = this.state.subscribers[i];
if (user.nickname === "jy") {
console.log(user,"user");
user.setVideoActive(!user.isVideoActive());
user.getStreamManager().subscribeToVideo(user.isVideoActive());
this.sendSignalUserChanged({ isVideoActive: user.isVideoActive() });
console.log(user.videoActive)
this.state.subscribers[i]=user;
}
}
// console.log(Object.prototype.toString.call(localUser).slice(8,-1),"타입 local...");
// console.log(Object.prototype.toString.call(user).slice(8,-1),"타입 remote...");
// console.log(Object.prototype.toString.call(this.remotes[0]).slice(8,-1),"타입 remote[0]...");
// Object.assign({},user,localUser);
// console.log(user,"안나와?")
// console.log(Object.prototype.toString.call(user).slice(8,-1),"타입 remote...");
this.setState({ localUser: localUser });
// this.state.subscribers.subscribeToVideo(true);
// const user = this.state.subscribers.filter(
// (userName) => userName.nickname === "jy"
// )[0];
// console.log(user,"filter")
// // console.log(Object.prototype.toString.call(user).slice(8,-1),"타입 user...");
// user.setVideoActive(!user.isVideoActive());
// console.log(user.videoActive,"비디오활성화");

// user.getStreamManager().subscribeToVideo(user.isVideoActive());
// console.log(user.getStreamManager().subscribeToVideo,"subscribeToVideo");

// this.sendSignalUserChanged({ isVideoActive: user.isVideoActive()});
// console.log(this.state.session,"session");

// // const temp = this.state.subscribers.filter(
// // (userName) => userName.nickname === "jy"
// // )[0];
// // console.log(temp, user);
// // this.setState({subscribers: this.state.subscribers.map(
// // modify=> user.nickname === modify.nickname ? {modify,user} : modify
// // )})

// console.log(user.videoActive);


// // for (let i = 0; i < this.state.subscribers.length; i++) {
// // let user = this.state.subscribers[i];
// // if (user.nickname === "jy") {
// // console.log(user,"user");
// // user.setVideoActive(!user.isVideoActive());
// // user.getStreamManager().subscribeToVideo(user.isVideoActive());
// // this.sendSignalUserChanged({ isVideoActive: user.isVideoActive() });
// // console.log(user.videoActive);
// // this.state.subscribers[i]=user;
// // }
// // }
// // console.log(Object.prototype.toString.call(localUser).slice(8,-1),"타입 local...");
// // console.log(Object.prototype.toString.call(user).slice(8,-1),"타입 remote...");
// // console.log(Object.prototype.toString.call(this.remotes[0]).slice(8,-1),"타입 remote[0]...");
// // Object.assign({},user,localUser);
// // console.log(user,"안나와?")
// // console.log(Object.prototype.toString.call(user).slice(8,-1),"타입 remote...");
}


Expand Down Expand Up @@ -565,7 +594,7 @@ class VideoRoomComponent extends Component {
if (display === 'block') {
this.setState({ chatDisplay: display, messageReceived: false });
} else {
console.log('chat', display);
// console.log('chat', display);
this.setState({ chatDisplay: display });
}
this.updateLayout();
Expand Down Expand Up @@ -618,7 +647,7 @@ class VideoRoomComponent extends Component {
/>
</div>
)}
{/* !host */}
{/* !local */}
{this.state.subscribers.map((sub, i) => (
<div
key={i}
Expand Down Expand Up @@ -763,9 +792,9 @@ class VideoRoomComponent extends Component {

resolve(resPost.data.sessionToken);

console.log('data: ', resPost.data);
console.log('res1: ', postData);
console.log('res2: ', Nickname);
// console.log('data: ', resPost.data);
// console.log('res1: ', postData);
// console.log('res2: ', Nickname);
})
)
.catch((error) => reject(error));
Expand Down
2 changes: 1 addition & 1 deletion src/components/meetingroom/user/UserComponent.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
position: absolute;
width: 331px;
height: 478px;
left: 78%;
left: 10%;
top: 35%;
margin-right: 100px;
background: #FCFCFC;
Expand Down
4 changes: 2 additions & 2 deletions src/components/meetingroom/user/UserComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class UserComponent extends Component {
consoleUser() {
this.local = this.props.local;
this.remotes = this.props.remote;
console.log(this.local);
console.log(this.remotes);
// console.log(this.local);
// console.log(this.remotes);
}
render() {
return (
Expand Down
4 changes: 2 additions & 2 deletions src/components/meetingroom/user/UserStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class UserStatus extends Component {
consoleUser() {
this.User = this.props.user;
this.host = this.props.isHost;
console.log(this.User);
console.log(this.host, '호스트냐');
// console.log(this.User);
// console.log(this.host, '호스트냐');
}
changeVideo(){
this.User.setVideoActive(!this.User.isVideoActive());
Expand Down
Loading

0 comments on commit a55670d

Please sign in to comment.