mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44:16 +00:00
added basic layout
This commit is contained in:
parent
4047667911
commit
0a9a6c3106
81
packages/app/src/pages/callRoom/[id].jsx
Normal file
81
packages/app/src/pages/callRoom/[id].jsx
Normal file
@ -0,0 +1,81 @@
|
||||
import React from "react"
|
||||
import { LiveChat } from "components"
|
||||
import classnames from "classnames"
|
||||
//import Peer from "peer"
|
||||
|
||||
import "./index.less"
|
||||
|
||||
export default class CallRoom extends React.Component {
|
||||
state = {
|
||||
participants: [],
|
||||
}
|
||||
|
||||
peer = null
|
||||
|
||||
viewsRef = React.createRef()
|
||||
|
||||
selfVideoRef = React.createRef()
|
||||
|
||||
componentDidMount = async () => {
|
||||
this.initialize()
|
||||
}
|
||||
|
||||
initialize = async () => {
|
||||
const stream = await this.createMediaStream()
|
||||
|
||||
this.selfVideoRef.current.srcObject = stream
|
||||
}
|
||||
|
||||
async createMediaStream() {
|
||||
const stream = await navigator.mediaDevices.getUserMedia({
|
||||
audio: true,
|
||||
video: {
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
return stream
|
||||
}
|
||||
|
||||
render() {
|
||||
return <div className="room">
|
||||
<div
|
||||
className={classnames(
|
||||
"room_views",
|
||||
{
|
||||
"one": this.state.participants.length === 0
|
||||
}
|
||||
)}
|
||||
ref={this.viewsRef}
|
||||
>
|
||||
<div className="participant_video">
|
||||
<video
|
||||
autoPlay
|
||||
muted
|
||||
playsInline
|
||||
ref={this.selfVideoRef}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{
|
||||
this.state.participants.map((participant) => {
|
||||
return <div className="participant_video">
|
||||
<video
|
||||
autoPlay
|
||||
muted
|
||||
playsInline
|
||||
srcObject={participant.stream}
|
||||
/>
|
||||
</div>
|
||||
})
|
||||
}
|
||||
</div>
|
||||
|
||||
<div className="text_room">
|
||||
<LiveChat
|
||||
roomId={this.props.params.id}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
46
packages/app/src/pages/callRoom/index.less
Normal file
46
packages/app/src/pages/callRoom/index.less
Normal file
@ -0,0 +1,46 @@
|
||||
.room {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
gap: 30px;
|
||||
|
||||
.room_views {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
|
||||
width: 100%;
|
||||
|
||||
height: 30vh;
|
||||
|
||||
padding: 20px 50px;
|
||||
|
||||
background-color: var(--background-color-accent);
|
||||
|
||||
border-radius: 12px;
|
||||
|
||||
&.one {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.participant_video {
|
||||
height: 100%;
|
||||
|
||||
video {
|
||||
border-radius: 8px;
|
||||
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.text_room {
|
||||
border-radius: 12px;
|
||||
padding: 0 20px;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user