Git Product home page Git Product logo

tfpvideo's Introduction

Application Files

  • webserver.js : a NodeJS Express HTTP Server that serves the client files and generates Twilio video tokens.
  • docroot/index.html : Client HTML, basic video client application
  • docroot/video.js : JavaScript code.
  • docroot/video.css : Web page styles and formatting
  • app.json and package.json, file descriptures for deploying to Heroku.
  • docroot/index.php : Sample PHP generation of a token that would be used.

For testing, check and close rooms:

JavaScript based on:

Twilio JavaScript Video Client Web Application

Run locally, download the files and run:

$ node webserver.js

Deploy to Heroku

The following is implemented and tested:

  • User can preview their local video track to test their camera.
  • User can enter their identity that will be used when they get a token and enter a room.
  • User can enter a room name and join the room. Before entering the room, a token is generated to gain access to the room.
  • A second participant can join the room. When they do, each participant can view the other's video track. I believe audio is working, but have not tested it.
  • Participants can leave a room. When they leave, the tracks are stopped and are no longer displayed locally and remotely.

To do:

  • Handle more than 2 participants in a room.
  • Mute and unmute audio during a session.
  • Turn video track off and on during a session.

Web Client Screen Print


Web Client Functionality Documentation

This section documents video.js, the client JavaScript code.

Startup

window.onload : initialize log message text box. Bind functionality to HTML buttons in index.html

Preview Video Track

previewLocalTracksAttach() : in the HTML DOM, append the local Twilio Video video track DIV, into a DIV container.

Before attaching video track:
    <div id="local-media"></div>
After attaching video track:
    <div id="local-media"><video autoplay=""></video></div>

previewLocalTracksDetach : in the HTML DOM, remove the local Twilio Video video track DIV, from the DIV container.

Before detach video track:
    <div id="local-media"><video autoplay=""></video></div>
After detach video track:
    <div id="local-media"></div>

You join a Room.

joinRoom() : connect to a room using a Twilio Video token and connection options.

  • Preview local video track: previewLocalTracks().
  • Attach the tracks of the room's current participants: attachParticipantTracks(participant)
  • Set room event handling: participantConnected, participantDisconnected, and disconnected(you disconnect).

attachParticipantTracks(participant) : in the HTML DOM, append the remote participant's Twilio Video video track into a DIV container. Use the participant's identity for the appended DIV's ID.

Before attaching participant video track:
    <div id="remote-media-div">remote-media</div>
After attaching video track:
    <div id="remote-media-div">remote-media<div id="stacy"><video autoplay=""></video></div></div>

You leave a Room.

Room event: disconnected.

  • Detach the local media video track.
  • Remove all remote participant DIVs.

You're in a Room, and a Remote participant joins the Room.

Room event: participantConnected.

  • Attach the tracks of the room's current participants: attachParticipantTracks(participant)

You're in a Room, and a Remote participant leaves the Room.

Room event: participantDisconnected.

  • Remove the the listeners for this participant.
  • Remove remote participant DIV.
Before detaching participant video track:
    <div id="remote-media-div">remote-media<div id="stacy"><video autoplay=""></video></div></div>
After detaching video track:
    <div id="remote-media-div">remote-media</div>

Twilio Video Web Application Documentation Links

Programmable Video Getting Started: JavaScript steps to create a video client web application.

Generate tokens documentation with a sample Node.JS program

Programmable Video Tutorials

Part 1: Creating a server with Node/Express

Part 2: Creating the web client Frontend


Cheers...

tfpvideo's People

Contributors

tigerfarm avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.