Skip to end of metadata
Go to start of metadata

Overview

Since build 5.2.841 it is possible to iject one stream published on server into another. This feature can be used, for example, to add advertising material into a stream. The original stream content will be fully replaced by injected stream one until injected stream is stopped or injection is terminated.

Supported codecs

Video:

  • H264
  • VP8

Audio:

  • Opus
  • AAC
  • G711

Known limits

1. Both streams to which injection is applied must be encoded with the same audio and video codecs.

2. Audio tracks in both streams should have the same sampleratye and channels number.

3. Injection cannot be applied to SIP call streams. Use the special audio and video injection technologies for SIP call streams.

4. Only one stream can be injected into the stream simultaneously, but one stream can be injected into multiple streams.

5. Cyclic injection is not supported. It is not possible to inject stream1 into stream2 and then stream2 into stream1 without terminating the previous injection.

Injection management using REST API

REST query must be HTTP/HTTPS POST request as follows:

  • HTTP: http://test.flashphoner.com:8081/rest-api/stream/inject/startup

  • HTTPS: https://test.flashphoner.com:8444/rest-api/stream/inject/startup

Where:

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

REST queries and responses

REST query

REST query body example

REST response example

Response states

Description

/stream/inject/startup

{
 "localStreamName": "stream1",
 "remoteStreamName": "stream2"
}

200 - OK

400 - Bad request

404 - Not found

409 - Conflict

500 - Internal error


Inject stream2 into stream1


/stream/inject/find_all
[
 {
   "localStreamName": "stream1",
   "remoteStreamName": "stream2"
 }
]

200 - OK

404 - Not found


Find all injections on the server
/stream/inject/terminate
{
 "localStreamName": "stream1"
}

200 - OK

400 - Bad request

404 - Not found

500 - Internal error


Stop injection into stream1

Parameters

Name

Description

Example

localStreamNameStream name to inject to
stream1
remoteStreamNameStream name to be injected
stream2

Quick testing

1. For test we use

  • WCS server;
  • Media Devices web application to publish stereams;
  • Two webcams, or two different PCs to publish streams;
  • Player web application to play stream to be injected to;
  • Chrome browser and REST client to send queries to the server

2. Open Media Devices aplication page, publish stream test in resolution 640x360

2. Plat the stream test in Player example

3. Publish adv stream in Media Devices example using another browser tab, another webcam or another PC

4. Open REST client, send /stream/inject/startup query

5. adv stream content is playing in test stream

6. Send /stream/inject/terminate query

7. Original test stream content is playing again