Versions Compared

Key

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

...

Code Block
languagejs
themeRDark
    stream = session.createStream(options).on(STREAM_STATUS.PENDING, function(stream) {
        ...
    }).on(STREAM_STATUS.PLAYING, function(stream) {
        ...
    }).on(STREAM_STATUS.STOPPED, function() {
        setStatus(STREAM_STATUS.STOPPED);
        onStopped();
    }).on(STREAM_STATUS.FAILED, function(stream) {
        ...
    }).on(STREAM_STATUS.NOT_ENOUGH_BANDWIDTH, function(stream){
        ...
    });
    stream.play();

VOD loop

VOD live translation supports VOD loop: after end of file, capturing starts from file begin. This feature is enabled with the following parameter in flashphoner.properties file

Code Block
themeRDark
vod_live_loop=true

VOD capturing from AWS S3

VOD stream can be captured from file placed to AWS S3 storage. Comparing with VOD capture from local disk, file from external storage is downloaded and captured sequentally.

To capture VOD from AWS S3 file, specify a link to the vod file as a stream name when calling the session.createStream() function, as follows:

Code Block
languagebash
themeRDark
vod://s3/bucket/sample.mp4

where

  • bucket is S3 bucket name
  • sample.mp4 is file name

Operation flowchart

Image Added

1. Browser requests VOD capture from AWS file

2. WCS server sends request to AWS

3. File is downloaded to WCS server

4. WebRTC stream from file is sending to browser for playback

Set up

To download files from AWS S3 bucket, S3 credentials must be set in flashphoner.properties file

Code Block
themeRDark
aws_s3_credentials=zone;login;hash

To capture stream from file while it is downloading, the following parameter should be set

Code Block
themeRDark
vod_mp4_container_new=true

File format requirements

Header section (moov) should always be before data section (mdat). File structure should be like this:

Code Block
themeRDark
Atom ftyp @ 0 of size: 32, ends @ 32
Atom moov @ 32 of size: 357961, ends @ 357993
...
Atom free @ 357993 of size: 8, ends @ 358001
Atom mdat @ 358001 of size: 212741950, ends @ 213099951

VOD capture management with REST API

REST query should be HTTP/HTTPS POST request as:

  • HTTP: http://test.flashphoner.com:8081/rest-api/vod/startup
  • HTTPS: https://test.flashphoner.com:8444/rest-api/vod/startup

Where:

  • test.flashphoner.com - WCS server address
  • 8081 - standard REST / HTTP port
  • 8444 - standard HTTPS port
  • rest-api - mandatory part of URL
  • /vod/startup - REST method used

REST queries and responses

REST query

REST query example

REST response example

Response states

Description

/vod/startup

Code Block
languagejs
themeRDark
{
 "uri":"vod://sample.mp4"
 "localStreamName": "test"
}

409 - Conflict

500 - Internal error


Capture VOD stream from file


/vod/find
Code Block
languagejs
themeRDark
{
 "localStreamName": "test"

}
Code Block
languagejs
themeRDark
[
    {
        "localMediaSessionId": "29ec3236-1093-42bb-88d6-d4ac37af3ac0",
        "localStreamName": "test",
        "uri": "vod://sample.mp4",
        "status": "PROCESSED_LOCAL",
        "hasAudio": true,
        "hasVideo": true,
        "record": false
    }
]

200 – OK

404 – not found

Find VOD streams by criteria

/vod/find_all


Code Block
languagejs
themeRDark
[
    {
        "localMediaSessionId": "29ec3236-1093-42bb-88d6-d4ac37af3ac0",
        "localStreamName": "test",
        "uri": "vod://sample.mp4",
        "status": "PROCESSED_LOCAL",
        "hasAudio": true,
        "hasVideo": true,
        "record": false
    }
]

200 – OK

404 – not found

Find all VOD streams

/vod/terminate

Code Block
languagejs
themeRDark
{
 "uri":"vod://sample.mp4"
 "localStreamName": "test"
}

200 - Stream is stopped

404 - stteam not found

Stop VOD stream

Parameters

Name

Description

Example

uri

File name to capture

vod://sample.mp4
localStreamNameStream name
test

status

Stream status

PROCESSED_LOCAL
localMediaSessionIdMediasession Id
29ec3236-1093-42bb-88d6-d4ac37af3ac0
hasAudioStream has audio
true
hasVideoStream has video
true
recordStream is recording
false

Known issues

1. AAC frames of type 0 are not supported by decoder and will be ignored while stream pulled playback

...