Versions Compared

Key

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

...

REST query

Body example

Response example

Response state

Desctiption

/hls/startup

Code Block
languagejs
themeRDark
{
  "name":"test"
}

200 - OK

404 - Stream not found

500 - Internal error


Start HLS agent for the stream


/hls/find_all


Code Block
languagejs
themeRDark
{
  "test": {
    "handler": "com.flashphoner.server.client.handler.wcs4.WCS4Handler@74dbf27b",
    "state": "ACTIVE",
    "writer": "HLS-test",
    "streamStatus": "PLAYING",
    "writerStarted": "true",
    "logs": }
}

200 – OK

404 – Not found

Find all streams having HLS agents

/hls/terminate

Code Block
languagejs
themeRDark
{
  "name":"test"
}

200 – OK

404 – Not found

Stop or restart HLS agent for the stream

Parameters

...

Description

...

Example

...

name

...

Stream published name

...

test

Issues

1. If HLS agent for the stream is started by REST query /hls/startup, and there are no active HLS subscribers, agent will stop after the following timeout in seconds

Code Block
themeRDark
hls_manager_provider_timeout=300

By default, the timeout is 5 minutes. Also it concerns HLS agents which are started automatically for streams published using the following parameter

Code Block
themeRDark
hls_auto_start=true

...

[
      "2023-07-18T10:22:52.457 WARNING: Playback speed changed to 0.779, segment 49, media type: video",
      "2023-07-18T10:22:56.614 WARNING: Gap{from=112000, to=114000, duration=2000}, media type: video",
      "2023-07-18T10:22:56.615 WARNING: Fps changed from 30 to 27, segment 50 , media type: video",
      "2023-07-18T10:22:56.624 WARNING: Segment 51.1 have no data, pts 112400, duration 400, media type: video",
      ...
    ]
  }
}

200 – OK

404 – Not found

Find all streams having HLS agents

/hls/terminate

Code Block
languagejs
themeRDark
{
  "name":"test"
}

200 – OK

404 – Not found

Stop or restart HLS agent for the stream

Parameters

Parameter name

Description

Example

name

Stream published name

test

logsMessages about stream issues[]

Issues

1. If HLS agent for the stream is started by REST query /hls/startup, and there are no active HLS subscribers, agent will stop after the following timeout in seconds

Code Block
themeRDark
hls_manager_provider_timeout=300

By default, the timeout is 5 minutes. Also it concerns HLS agents which are started automatically for streams published using the following parameter

Code Block
themeRDark
hls_auto_start=true

2. If HLS agent for the stream is stopped by REST query /hls/terminate, and there are active HLS subscribers, this agent will be restarted. In this case, active HLS subscribers must reconnect to the stream.

LL HLS stream issues displaying

Since build 5.2.1709 LL HLS stream issues are displaying in response on /hls/find_all REST API query:

Code Block
languagejs
themeRDark
{
   "test": {
    "handler": "com.flashphoner.server.client.handler.wcs4.WCS4Handler@74dbf27b",
    "state": "ACTIVE",
    "writer": "HLS-test",
    "streamStatus": "PLAYING",
    "writerStarted": "true",
    "logs": [
      "2023-07-18T10:22:52.457 WARNING: Playback speed changed to 0.779, segment 49, media type: video",
      "2023-07-18T10:22:56.614 WARNING: Gap{from=112000, to=114000, duration=2000}, media type: video",
      "2023-07-18T10:22:56.615 WARNING: Fps changed from 30 to 27, segment 50 , media type: video",
      "2023-07-18T10:22:56.624 WARNING: Segment 51.1 have no data, pts 112400, duration 400, media type: video",
      ...
    ]
  }
}

By default, up to 50 last issues are displayed for every stream. This value may be changed with the following parameter

Code Block
themeRDark
hls_metrics_log_size=50

The following issues are detected:

  • Fps changed from x to y - stream FPS leap over 10 %
  • Segment x does not start with keyframe - stream keyframe interval is more than one segment duration
  • Playback speed changed to x - stream playback speed has changed
  • Segment interval is too big - an interval in milliseconds between a subsequent segments is too big
  • Video resolution changed from x to y - stream resolution has changed
  • Gap{from=x, to=y, duration=z} - stream gap detected, EXT-X-GAP tag is added to the playlist

Any of those issues means a source stream publishing quality degradation and may lead to freezes, out of audio and video sync and even HLS playback stopping in some browsers. In this case, a possible packets loss or bandwidth issues should be resolved, or pablishing technology shuld be changed from WebRTC to a more noise-resistant, RTMP or SRT for example.

HLS ABR support

For a streams with video track (video only or audio+video) WCS supports HLS ABR in CDN (a qualities are encoded on a dedicated Transcoder node) and on a single node.

...