Versions Compared

Key

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

...

REST-method

Example of REST query

Example of response

Response statuses

Description

/mixer/startup

Code Block
languagejs
themeRDark
{
  "uri": "mixer://mixer1",
  "localStreamName": "stream3",
  "hasVideo": "true",
  "hasAudio": "true",
  "watermark": "watermark.png",
  "background": "background.png",
  "mixerLayoutClass": "com.flashphoner.mixerlayout.TestLayout"
}

200 - OK

400 - Bad request

409 - Conflict

500 - Internal error

Creates a mixer the provided stream is published for

/mixer/add

Code Block
languagejs
themeRDark
{
  "uri": "mixer://mixer1",
  "remoteStreamName": "stream1",
  "hasVideo": "true",
  "hasAudio": "true"
}

200 - OK

404 - Mixer not found

404 - Stream not found

500 - Internal error

Add the RTMP stream to the mixer

/mixer/remove

Code Block
languagejs
themeRDark
{
  "uri": "mixer://mixer1",
  "remoteStreamName": "stream1"
}

200 - OK

404 - Mixer not found

404 - Stream not found

500 - Internal error

Remove the RTMP stream from the mixer

/mixer/find_all


Code Block
languagejs
themeRDark
{
"localMediaSessionId": "ce92b134-2468-4460-8d06-1ea3c5aabace",
"remoteMediaSessionId": null,
"localStreamName": "mixer1",
"remoteStreamName": null,
"uri": "mixer://mixer1",
"status": "PROCESSED_LOCAL",
"mediaSessions": [
  "95bf2be8-f459-4f62-9a7f-c588f33e0ad3",
  "693781de-cada-4589-abe1-c3ee55c66901"
],
}

200 - OK

404 - Not found

500 - Internal error

Find all mixers

/mixer/terminate

Code Block
languagejs
themeRDark
{
  "uri": "mixer://mixer1"
}

200 - OK

404 - Not found

500 - Internal error

Terminate operation of the mixer

/stream/startRecording

Code Block
languagejs
themeRDark
{
  "mediaSessionId": "23d07fa1-3c74-4d6f-a0de-9b4bf83ce665"
}

200 - OK

404 - Not found

500 - Internal error

Start recording of the stream in the given media session

/stream/stopRecording

Code Block
languagejs
themeRDark
{
  "mediaSessionId": "23d07fa1-3c74-4d6f-a0de-9b4bf83ce665"
}

200 - OK

404 - Not found

500 - Internal error

Stop recording the stream in the given media session

Parameters

Parameter name

Description

Example

uri

Unique identifier of the mixer

mixer://mixer1

localStreamName

Name of the output stream of the mixer

stream3

/mixer/setAudioVideo

Code Block
languagejs
themeRDark
{
 "uri": "mixer://m1",
 "streams": "^stream.*",
 "audioLevel": 0,
 "videoMuted" true
}

200 - OK

400 - Bad request

404 - Not found

500 - Internal error

Mute/unmute video or change audio level for mexer incoming stream

Parameters

Parameter name

Description

Example

uri

Unique identifier of the mixer

mixer://mixer1

localStreamName

Name of the output stream of the mixer

stream3

hasVideoMix videotrue
hasAudioMix audiotrue

remoteStreamName

Name of the stream added to the mixer

stream1

rtmp://rtmp.flashphoner.com:1935/live/rtmp_stream1

mediaSessionId

Media session identifier

ce92b134-2468-4460-8d06-1ea3c5aabace

status

Stream status

PROCESSED_LOCAL

backgroundMixer backgroundbackground.png
watermarkMixer watermarkwatermark.png
mixerLayoutClassMixer layoutcom.flashphoner.mixerlayout.TestLayout

Sending the REST query to the WCS server

...

streamsStreams list or regular expression for search

^stream.*

["stream1", "stream2"]

audioLevelIncoming stream audio level0
videoMutedMute videotrue

Sending the REST query to the WCS server

To send the REST query to the WCS server use a REST-client.

Known limits

...

If video MCU support is enables, channel losses can affect mixer output stream quality. Custom lossless videoprocessor can be used to improve quality, that can make an additional latency.

Incoming streams audio and video management

Since build 5.2.835 it is possible to change audio level and mute video for mixer incoming streams. In this case, the original stream remains unchanged. Video track  can be muted (black screen) and then unmuted. For audio track, volume level can be set in percent up to 100, or sound can be muted by setting level to 0.

Incoming streams are managed using REST API query /mixer/setAudioVideo.

For example, create a mixer and add 3 streams to it: 2 participants and 1 speaker

Code Block
themeRDark
curl -H "Content-Type: application/json" -X POST http://localhost:8081/rest-api/mixer/startup -d '{"uri": "mixer://m1", "localStreamName":"m1"}'
curl -H "Content-Type: application/json" -X POST http://localhost:8081/rest-api/mixer/add -d '{"uri": "mixer://m1", "remoteStreamName": "stream1"}'
curl -H "Content-Type: application/json" -X POST http://localhost:8081/rest-api/mixer/add -d '{"uri": "mixer://m1", "remoteStreamName": "stream2"}'
curl -H "Content-Type: application/json" -X POST http://localhost:8081/rest-api/mixer/add -d '{"uri": "mixer://m1", "remoteStreamName": "desktop"}'

Image Added

Mute all participants excluding speaker

Code Block
themeRDark
POST /rest-api/mixer/setAudioVideo HTTP/1.1
User-Agent: curl/7.29.0
Host: localhost:8081
Accept: */*
Content-Type: application/json
Content-Length: 62

{
 "uri": "mixer://m1",
 "streams": "^stream.*",
 "audioLevel": 0
}

Image Added

REST query streams parameter may be set either as regular expression to match streams by name, or as streams list. Use regular expression syntax supported by Java, the examples can be found here.

Mute stream1 video

Code Block
themeRDark
POST /rest-api/mixer/setAudioVideo HTTP/1.1
User-Agent: curl/7.29.0
Host: localhost:8081
Accept: */*
Content-Type: application/json
Content-Length: 65

{
 "uri": "mixer://m1",
 "streams": ["stream1"],
 "videoMuted": true
}

Image Added

Check streams state by /mixer/find_all query

Code Block
themeRDark
POST /rest-api/mixer/find_all HTTP/1.1
User-Agent: curl/7.29.0
Host: localhost:8081
Accept: */*
Content-Type: application/json
Code Block
themeRDark
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Content-Type: application/json
Content-Length: 574

[
  {
    "localMediaSessionId": "e2fa5c8b-16f3-4917-9d5f-557dde75db07",
    "localStreamName": "m1",
    "uri": "mixer://m1",
    "status": "PROCESSED_LOCAL",
    "hasAudio": true,
    "hasVideo": true,
    "record": false,
    "mediaSessions": [
      {
        "localMediaSessionId": "3dd763b0-2ae7-11eb-aa72-37b2cbcbf6b9",
        "audioLevel": 0,
        "videoMuted": true,
        "localStreamName": "stream1"
      },
      {
        "localMediaSessionId": "8af64760-2ae7-11eb-b086-cdf035231b9d",
        "audioLevel": 100,
        "videoMuted": false,
        "localStreamName": "desktop"
      },
      {
        "localMediaSessionId": "7cc4b410-2ae7-11eb-b34c-a5240fe9f151",
        "audioLevel": 0,
        "videoMuted": false,
        "localStreamName": "stream2"
      }
    ]
  }
]

Quick manual on testing

1. For this test we use:

...