Title

Global

Members

# configuration

stun and turn servers used for the peer to peer connection credentials for turn server are provided by xirsys. stun servers used are provided by google.

View Source public/script.js, line 14

# constant express

created a express server

View Source index.js, line 5

# constant io

imported socket.io for real time communication it creates a bidirectional channel between Socket.io client and server

View Source index.js, line 13

# peers

array to store unique user Ids and call object

View Source public/script.js, line 105

# constant socket

imported socket.io for real time communication

View Source public/script.js, line 5

# constant videoGrid

variable to store video element

View Source public/script.js, line 96

Methods

# addVideoStream(video, stream)

function addVideoStream adds the video element to the video-grid videoGrid is the div container used to hold the video stream

Parameters:
Name Type Description
video media

video of the user accessed from the device

stream object

MediaStream object

View Source public/script.js, line 250

# chatWindow()

hides and show the main chat Window as user toggles the hide and display button

View Source public/script.js, line 330

# connectToNewUser(stream, userId)

called when 'user-connected' event is emitted this function is used to call the new user that connected by sending the stream of the user who is calling. This function also strores the call object in peers array

Parameters:
Name Type Description
stream object

we send our own audio and video stream to connect

userId string

id of the user we want to connect to

View Source public/script.js, line 224

# copy()

copies the ROOM_ID to share with different users to join a room

View Source public/script.js, line 264

# getUserName()

function takes the username input through prompt and sets the user variable to obtained username function uses bootbox library to generate prompt

View Source public/script.js, line 53

# muteUnmute()

toggles the mute and unmute button if audio is true the mutes it else unmutes it

View Source public/script.js, line 300

# playStop()

to stop and play Video as user clicks to stop Video or play Video

View Source public/script.js, line 315

# scrollToBottom()

scrolls to bottom as chat window gets filled

View Source public/script.js, line 290

# setMuteButton()

changes inner html of mute button

View Source public/script.js, line 346

# setPlayVideo()

changes inner html of play video button

View Source public/script.js, line 382

# setStopVideo()

changes inner html of Stop video button

View Source public/script.js, line 370

# setUnmuteButton()

changes inner html of unmute button

View Source public/script.js, line 358

Type Definitions

Object

# Peer

created a Peer type object for peer to peer communication I hosted my own peerjs server on heroku for the purpose

Properties:
Name Type Description
host string

"dbpeerjsserver.herokuapp.com", my own peerjs server

port number

443 for https requests

secure boolean

it's a secure port

config object

iceServers (stun and turns servers)

View Source public/script.js, line 74