Zixi

Integrate Zixi SDK to Ant Media Server

About Zixi Plugin

Easily pull streams from ZixiBroadcaster to your Ant Media Server for playback using WebRTC/HLS/DASH or push a stream via Ant Media server to ZixiBroadcaster using any supported Ant Media Server format (WebRTC, RTSP, RTMP, SRT).

Highlights

  • Publish your streams to  Zixi:
    Push multiple streaming formats from Ant Media Server to ZixiBroadcaster so that any stream ingested into Ant Media Server (WebRTC, RTSP, RTMP, SRT) can be available in Zixi.
  • Pull your streams with ZixiFeeder:
    Pull your Zixi streams into Ant Media Server and play them back using multiple formats WebRTC/HLS/DASH. 

Supports REST Methods:
You can control all the operations through the REST API. The API REST Methods are available for every application in the Ant Media Server. To learn more about all the REST API endpoints, please reference ZixiRestService.java.

Get Started Instructions

Before Starting

You need to have an active Ant Media Server(AMS) license. You can subscribe through AWS and deploy AMS with just one click. Or directly subscribe to self-hosted license on our website.

The Zixi Plugin is compatible with Ant Media Server versions 2.5.2 and later. Current zixi-plugin.jar is also x86_64 compatible.

Deployment

Follow the steps below to install the plugin.

1. Download the pre-built zixi-plugin.jar file

wget https://github.com/ant-media/Plugins/raw/master/ZixiPlugin/build/zixi-plugin.jar

2. Copy the zixi-plugin.jar file to plugins directory under /usr/local/antmedia

sudo cp zixi-plugin.jar /usr/local/antmedia/plugins

3. Restart the Service

sudo service antmedia restart

Usage:

The Zixi plugin used REST Methods to start ZixiClient and ZixiFeeder. You first need to install your ZixiBroadcast to your instance. Please reach out to Zixi to get a ZixiBroadcaster and instructions.

Pull a Zixi stream into Ant Media Server

Using this plugin, its possible to pull a Zixi stream into Ant Media Server and play it back using WebRTC. 

Start a ZixiClient

To create a new Zixi stream to pull into Ant Media Server, login to Zixi and go to the ZixiBroadcaster. Navigate to the Inputs tab and click on new input.

Zixi Plugin

Zixi Plugin for Ant Media Server

Now add a new stream with type push. You can give any name for the stream id. In the sample below, we use stream1.

In our example below, we’ll push content of a UDP stream to port 1234 on localhost.  Then fetch the packets from port 1234 and push them to the ZixiBroadcasters on localhost port 2088 using the Zixi SDK.

Below are the commands you can use to push the stream.

Start a UDP stream using FFMPEG.

$ git clone https://github.com/ant-media/Plugins.git
$ cd Plugins/ZixiPlugin/src/test/resources/zixi_sdks-antmedia-16.4.44489/linux64/test/
$ ffmpeg -re -i ../../../test.flv -codec copy -f mpegts udp://127.0.0.1:1234?pkt_size=1316

Using the Zixi SDK, push the UDP stream to ZixiBroadcaster. The name of the stream in this example is stream1.

$ cd Plugins/ZixiPlugin/src/test/resources/zixi_sdks-antmedia-16.4.44489/linux64/test/
$ export LD_LIBRARY_PATH=../lib
$ ./feeder_interface_tester 1234 127.0.0.1 2088 stream1 1000 10000 0 -1 0

Now confirm that stream1 is online in the ZixiBroadcaster as shown in the screenshot:

Screenshot 2023 05 09 at 10.44.37

Once there is a stream running on ZixiBroadcaster, its time to pull the stream into Ant Media Server. 

Fetch the stream

Using the REST API, the below Curl command pulls a Zixi stream to Ant media server where the Zixi stream is zixi://127.0.0.1:2077/stream1

curl -X "POST" http://127.0.0.1:5080/LiveApp/rest/zixi/client?start=true -H 'Content-Type: application/json' -d '{"streamUrl":"zixi://127.0.0.1:2077/stream1"}'

The method should return something similar to the below. Pay particular attention to the dataId field because it’s the stream id you’ll need in order to play the live stream in Ant Media Server.

{"success":"true", "message":"Stream pulling is started for ", "dataId":"zLPmjtlT7whX1670583419181", "errorId":0}

Now you can visit the play.html sample page on your Ant Media Server instance to play back the Zixi stream using WebRTC.

Navigate to http://AMS_SERVER_IP:5080/LiveApp/player.html and use the stream id that was sent in the previous API response (zLPmjtlT7whX1670583419181) in the box below and click the Start Playing button.

Screenshot 2023 05 09 at 10.48.05

If you want to stop the live stream, use the following REST API:

curl -X "DELETE" http://127.0.0.1:5080/LiveApp/rest/zixi/client/zLPmjtlT7whX1670583419181 -H 'Content-Type: application/json'

Notice the live stream ID that’s appended to the end of the request URL. This is the same ID that was used to play back the live stream.

Push an Ant Media Server live stream into Zixi:

As well as pulling a Zixi stream into Ant Media for play back, its possible to also publish a WebRTC live stream from Ant Media Server and push it to Zixi.

Start a ZixiFeeder:

Click INPUTS in ZixiBroadcaster and then Click New Input

Screenshot 2023 05 09 at 10.50.20

Now add a new stream with type push. You can assign any name for the stream id. In the sample below, we’ve used stream2.

Screenshot 2023 05 09 at 10.51.03

Publish a WebRTC live stream from Ant Media Server:

It’s time to start publishing a WebRTC live stream from your Ant Media Server. Navigate to one of the installed applications and load the WebRTC publishing page at https://AMS_FQDN_DOMAIN:5443/LiveApp

Screenshot 2023 05 09 at 10.51.56

Now call the following REST method to push the ‘webrtc_stream’ to the ZixiBroadcaster. 

Pay particular attention to how we use webrtc_stream in the url below and add the ZixiBroadcaster endpoint as url parameter(zixi://127.0.0.1:2088/stream2)

curl -X "POST" http://127.0.0.1:5080/LiveApp/rest/zixi/feeder/webrtc_stream?url=zixi://127.0.0.1:2088/stream2  -H 'Content-Type: application/json'

The live stream should now be visible in ZixiBroadcaster. If you login to Zixi, you should be able to see that stream2 is connected on ZixiBroadcaster.

Screenshot 2023 05 09 at 10.53.00

Stop the ZixiFeeder:

Stop the ZixiFeeder with the following command by using stream id webrtc_stream at the end of the url

curl -X "DELETE" http://127.0.0.1:5080/LiveApp/rest/zixi/feeder/webrtc_stream  -H 'Content-Type: application/json'

Support:

Our engineers will be available for you. Please  if you need technical help. Also, we have some support package offerings here.

Screenshots

Integrate Zixi SDK to Ant Media Server