API Workflow Example
This page outlines how to use the Phenix APIs to publish and subscribe to content, with links to documentation for the APIs used by the example (REST to create the Channel, EdgeAuth token creation for stream access, and the WebSDK to publish and subscribe).
This example publishes user media, but a similar workflow can be used for publishing content using other sources, as outlined in ingest options.
A similar client workflow is used for publishing and viewing using other client SDKs (e.g., Android and iOS).
Create a Channel
Create a Channel using the Create Channel API. The platform's response will include the Channel ID, which you will use in the following steps.
Create a Publish Token
Create a publish token ("for publishing only") using the Edge Auth library with the Channel ID of the Channel you created above.
Publish Content
Create a web page that executes the Channel Publisher API. Include user media as the mediaStream, using a getUserMedia function as shown in our example.
Create a Viewing Token
Create a viewing token (with no "for publishing only", "for authentication only", or "for streaming only") using the Edge Auth library with the Channel ID of the Channel you created above.
View Content
Create a web page that executes the channel viewer API as shown in our example, indicating the video element to be used for rendering the video.