Members
(constant) cors
Module for cross-origin resource sharing; needed so that the protocol default CORS policy can be overridden.
currentPeer :Object
Reference to the most recently connected peer.
- Object
- Source
(constant) express
Express module for starting route-based apps.
(constant) ExpressPeerServer
Module for peer.js that allows for express app support for peer-to-peer connections.
(constant) Gesture :Object
Enum for the different types of gestures Spark recognizes.
- Object
- Source
gesturesEnabled :boolean
Boolean for toggling whether or not gestures are enabled. Default disabled.
- boolean
- Source
isBreakout :boolean
Boolean for toggling whether or not the user is in a breakout room. Default false.
- boolean
- Source
(constant) myVideo
Reference to the created (local) video object
- Source
myVideoStream :Object
Reference to the local video stream for the client.
- Object
- Source
participantBreakOutRoomMap :Object
Variable to keep track of breakout rooms for determining where to place participants.
- Object
(constant) peers
Container for all connected peers in the room.
- Source
(constant) RateLimit
Module for enforcing rate limit on an express app
roomHostsMap :Object
Variable to keep track of room hosts for determining host-only actions
- Object
roomParticipantsMap :Object
Variable to keep track of room participants for determining host-only actions
- Object
screenSharing :boolean
Boolean for determining if a screen is being shared or not.
- boolean
- Source
screenStream :Object
Reference object of the screen sharing video stream.
- Object
- Source
(constant) videoGrid
The grid of local and remote video objects representing the video of all peers.
- Source
Methods
addVideoStream(video, stream)
Adds a new video to the client's video grid, and forcing the stream of the video to play.
| Name | Type | Description |
|---|---|---|
video | Object | |
stream | Object |
- Source
breakoutUnbreakout()
Toggles the brekoutRoom and exitBreakoutRoom for the user, along with setting the Breakout Rooms and Exit Breakout button by calling their defined functions.
- Source
connectToNewUser(userId, stream)
Uses peer.js to add a new peer, along with setting up the listeners for "this" client.
| Name | Type | Description |
|---|---|---|
userId | string | User (socket) ID of the new user |
stream | Object | Video stream to add to "this" client's video grid |
- Source
detect_fingersup(lmlist) → {Array}
Determines how many fingers are pointing "up", using arrays to store the result.
| Name | Type | Description |
|---|---|---|
lmlist | Array |
- Source
The fingers IDs that are found as "up"
- Type:
- Array
findhandpos(landmarks) → {Array}
Helper function to determine the x-y coordinates of the positions of the hand
| Name | Type | Description |
|---|---|---|
landmarks | Object |
- Source
x-y coordinates of the hand data
- Type:
- Array
muteUnmute()
Toggles the mute and unmute of the video stream, along with setting the mute and unmute button by calling their defined functions.
- Source
onGestureAction(results)
Callback for the Hands onResults event to see what gestures came out of that and how to map those gestures to certain room controls.
| Name | Type | Description |
|---|---|---|
results | Object | The hand detection results |
- Source
onResults(results) → {Object}
Determines what gesture is being shown based on the given hand detection data.
| Name | Type | Description |
|---|---|---|
results | Object | Hand detection data |
- Source
The gesture enum that was determined
- Type:
- Object
peerServer(peerAppopt)
The HTTP server module used for starting Spark's server to listen for new peers and their activity; uses createServer to set up the peer.js functionality.
| Name | Type | Attributes | Description |
|---|---|---|---|
peerApp | Object | <optional> | Reference to instantiated peer.js express app that server module can interface on |
playStop()
Toggles the show and hide of the video stream, along with setting the show and hide video buttons by calling their defined functions. It does this by using the myVideo pause() and play() functions from HTMLVideoElement to manipulate video state.
- Source
scrollToBottom()
Scrolls to the bottom of the chat container HTML element to show the latest chat message.
- Source
setDisableGestures()
Utilizes DOM manipulation to display the disable gesture button on the gesture enable/disable button container.
- Source
setEnableGestures()
Utilizes DOM manipulation to display the enable gesture button on the gesture enable/disable button container.
- Source
setExitBreakoutRoom()
Utilizes DOM manipulation to display the ExitBreakout button on the breakoutRoom/exitBreakout button container.
- Source
setMuteButton()
Utilizes DOM manipulation to display the mute button on the mute/unmute button container.
- Source
setPlayVideo()
Utilizes DOM manipulation to display the show video button on the video show/stop button container.
- Source
setStopVideo()
Utilizes DOM manipulation to display the stop video button on the video show/stop button container.
- Source
setUnmuteButton()
Utilizes DOM manipulation to display the unmute button on the mute/unmute button container.
- Source
startScreenShare()
Changes your video to point to point to your screen sharing video that's prompted. If permitted, it will change your video stream to the screen sharing stream you are doing for all peers that are connected to you. If stopping screen share, see stopScreenSharing function.
- Source
stopScreenSharing()
Replaces the video stream of the screen sharing to be video stream of the user who stopped the screen sharing.
- Source
toggleChat()
Utilizes DOM manipulation to toggle the chat section of the room.
- Source
toggleGesture()
Toggles the detection of gestures in the video stream, along with setting the enable and disable buttons by calling their defined functions.
- Source
.onchange(event)
Sends the 'filetransfer' signal to the server along with the byte data of the file that was chosen to be submitted by the user.
| Name | Type | Description |
|---|---|---|
event | Object | The event object that holds the file data to transfer |
- Source