Skip to content

conwin/VideoServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VideoServer.js

Usage

  • First use npm to install the required modules listed in the package.json file

    • npm install

  • Second use node to run the main server: RTSP.js

    • node RTSP.js

    • Ensure the folder resources inside the main application folder has the video files
      • So paths to the videos from the .js files will take the form ./resources/videoX.mjpeg
    • Server has been coded to throw and error and exit if the video files are not found
  • Next run the client VideoPlayer.exe using a windows machine

    • Server IP address: 127.0.0.1 as denoted by the HOST variable in RTSP.js
    • Connect to Port: 3000 as denoted by the PORT variable in RTSP.js
  • You're all set!

Package Information

RTSP.js

  • The main application of the package
  • Hosts a TCP server for clients to connect to
  • Communicates back with client
  • Parses clients data and messages to create client objects
  • Parse client messages to direct operations based on if the client wishes to SETUP, PLAY, PAUSE, or TEARDOWN

Clients.js

  • Client management data type
  • At core holds array of client objects
  • Public Functions:
    • addClient(address, port) adds a new client object
    • returnInitClient(address, port) returns the client object created on connection with the server
    • removeClient(id) removes the client in the array with the specified session id
    • getClient(id) returns the client object with the specified session id
  • Client objects store:
    • File: path to file from RTSP.js location
    • Address: udp communication address
    • Port: initial joinging port
    • commPort: udp communication port
    • SessionID: session id generated by server
    • Socket: udp socket object for communication
    • Position: current position in client.File(for pause-play functionality)
    • Timer: timeoutId for the timer sending video packets
    • FileSize: size of client.File
    • Sequence: initial sequence number
    • Timestamp: initial timestamp
  • Client object have methods:
    • reset(): resets all attributes to initial values
    • setTimer(timer): adds the timer object to client.Timer
    • stopTimer(): calls clearTimeout on client.Timer's timeoutId (for pause and teardown functionality)

RTP.js

  • creates udp socket for client object
  • Gets initial timestamp and sequence number
  • Holds the streaming function utilized asynchronusly by client objects
  • New video frame sent every 50 ms

RTPpacket.js

  • Creates an RTP header
  • Concatenates an RTP header buffer object with a video frame buffer object

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published