Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A video stream is captured from an RTSP source that provides audio and video in the supported codecs. Then, the server transforms this video stream for playing in browsers and mobile devices.

RTSP sources

...

  • IP cameras
  • Media servers
  • Surveillance systems
  • Conference servers

Supported codecs

...

  • H.264
  • VP8
  • AAC
  • G.711
  • Speex

Supported platforms and browsers

...

REST-methods and response statuses

REST-method

Example of REST-query

Example of response

Response statuses

Description

/rtsp/startup

Code Block
languagejs
themeRDark
{
 "uri":"rtsp://myserver.com/live/myStream"
}

409 - Conflict

500 - Internal error


Pull the RTMP stream by the specified URL


/rtsp/find_all


Code Block
languagejs
themeRDark
{
"uri": "rtsp://myserver.com/live/myStream",
"status": "PLAYING"
}

200 – streams found
404 – streams not found


Find all pulled RTMP-streams

/rtsp/terminate

Code Block
languagejs
themeRDark
{
"uri":"rtsp://myserver.com/live/myStream"
}

200 - stream terminated
404 - stream not found


Terminate the pulled RTMP stream

Parameters

Parameter name

Description

Example

uri

URL of the RTSP stream

rtsp://myserver.com/live/myStream

status

Current status of the stream

PLAYING

Call flow

Below is the call flow when using the Player example

...

Code Block
languagejs
themeRDark
function playStream(session) {
    var streamName = $('#streamName').val();
    var options = {
        name: streamName,
        display: remoteVideo,
        flashShowFullScreenButton: true
    };
    ...    
    stream = session.createStream(options).on(STREAM_STATUS.PENDING, function(stream) {
        var video = document.getElementById(stream.id());
        if (!video.hasListeners) {
            video.hasListeners = true;
            video.addEventListener('playing', function () {
                $("#preloader").hide();
            });
            video.addEventListener('resize', function (event) {
                var streamResolution = stream.videoResolution();
                if (Object.keys(streamResolution).length === 0) {
                    resizeVideo(event.target);
                } else {
                    // Change aspect ratio to prevent video stretching
                    var ratio = streamResolution.width / streamResolution.height;
                    var newHeight = Math.floor(options.playWidth / ratio);
                    resizeVideo(event.target, options.playWidth, newHeight);
                }
            });
        }
        ...
    });
    stream.play();
}

4. Request from WCS to the RTSP source to broadcast the stream.

...