Restreaming - PhenixRTS Docs

Restreaming to Social Media platforms

This page outlines the steps required to restream to various social media networks from the PhenixRTS platform using the Restreaming API. These instructions use the PhenixRTS Customer Portal for ease of use; however, this workflow is not limited to the Portal.

Beta Notice

Restreaming is currently in beta\ testing.

Phenix has tested restreaming to YouTube, Twitch, Instagram, and Facebook. Please contact Phenix for guidance.

The main factor that impacts latency is resolution. Some restreaming targets, such as Instagram, insert additional delay (typically about 10 seconds) to the Creator's Live feed for its viewers.

Requirements

To restream to another platform, you must have the following:

  1. Access to the Phenix Customer Portal.

  2. Knowledge on how to use EdgeAuth - this document uses the packaged nodeJS EdgeAuth library.

  3. A stream published to an existing channel. The capabilities for the stream's publish token must include streaming if using the default restreaming mode, or must include at least one of multi-bitrate, multi-bitrate-contribution, or prefer-h264 if using low-latency mode.

  4. A viewing token with egress set in the capabilities, and with origin stream id. An additional capability may be required, depending on the restreaming mode selected. You can retrieve the stream id using the Notifications API programmatically if preferred.

  5. An account on the desired platform (e.g., YouTube) prepared to receive the stream. Each platform has its own requirements to ingest external video. For example, TikTok requires you to be 18 as well as have 1000 followers before they will let a user have access to their stream key. YouTube can take up to 24 hours for live streaming to be enabled.

Restream

  1. In the portal, select the Streams tab in the channel you created. Copy the stream id below the video that is displaying your published stream.

  2. Using EdgeAuth, create a token with egress in the capabilities and with the stream id. If using the low-latency restreaming mode, include the mpegts-egress capability as well.

The Phenix EdgeAuth library comes in a variety of languages. Choose the one most suitable for your development environment.

To get started quickly, use the node-based command line application to build a token. This method should not be used for production.

An example is shown below.

git clone git@github.com:PhenixRTS/EdgeAuth.git
cd EdgeAuth/node
npm install

node src/edgeAuth.js --applicationId "my-application-id" --secret 'my-secret' --expiresInSeconds 31536000 --originStreamId "my-stream-id-from-portal" --capabilities "egress" --streamingOnly

The result will be a base64-encoded token.

  1. Replace the following variables per these instructions to create the restream cURL command below.
curl --connect-timeout 3 \
-H 'Authorization: Bearer DIGEST:..' \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-X PUT --data '{
"uri" : "<SOCIAL_MEDIA_URI>/<STREAM_KEY>"
  }' \
https://pcast.phenixrts.com/pcast/<APPLICATION_ID>/stream/egress/uri/<rtmp|rtmps>

The successful result of the call should look like the following, note that the token is truncated:

{"status":"ok","streamId":"us-southwest#phx-ad-2.Z8j50oGL.20230511.EyNDdzxy","sharedSecret":"DIGEST:...","options":[]}%

Restreaming tips: