Giter Site home page Giter Site logo

videoserver's Introduction

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

videoserver's People

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.