Page Content
Channel APIs - Beta
The APIs described on this page are currently in beta. To use the beta release, please contact your Phenix technical representative.
Channel Viewer
The Channel Viewer API is extended with the following beta features.
Insertable streams
The WebSDK supports transforming the raw media (video or audio) prior to rendering. This is analogous to the Frame Ready API for iOS and Android. Please see the Media Stream Track Insertable Media Processing using Streams working draft standard for more information.
To enable this feature, add the insertable-streams capability on the subscriber.
View an example in the Phenix download area.
JavaScript
var videoElement = document.getElementsByTagName('video')[0];
var channel = phenix.Channels.createChannel({
videoElement: videoElement,
token: token,
videoStreamTransformCallback: videoFrameTransformFunction,
audioStreamTransformCallback: audioFrameTransformFunction
});
function videoFrameTransformFunction(track, videoFrame, controller) {
// Use videoFrame source to generate a new video frame and enqueue it for rendering via controller
}
function audioFrameTransformFunction(track, audioData, controller) {
// Use audioData source to generate a new audio data and enqueue it for playback via controller
}
Stream Track Transform Callback Arguments
Name | Type | Description |
---|---|---|
track | MediaStreamTrack | A single media track within a stream. |
chunk | AudioData or VideoFrame | WebCodecs API interface that represents an audio sample or video frame. |
controller | TransformStreamDefaultController | Streams API interface to manipulate the associated ReadableStream and WritableStream. |
v2024-03-07T16:32:22.000Z