Skip to content

Latest commit

 

History

History
170 lines (115 loc) · 19.3 KB

File metadata and controls

170 lines (115 loc) · 19.3 KB

SimulcastStream

Overview

Available Operations

create_simulcast_of_stream

Creates a simulcast for a parent live stream. Simulcasting allows you to broadcast a live stream to multiple social platforms simultaneously (for example, YouTube, Facebook, or Twitch). This helps expand your audience reach across platforms. A simulcast can only be created when the parent live stream is in the idle state (not currently live or disabled). Only one simulcast target can be created per API call.

How it works

  1. Change to: When you call this endpoint, provide the parent streamId along with the simulcast target details (such as platform and credentials). The API returns a unique simulcastId, which you can use to manage the simulcast later.

  2. To notify your application about the status of simulcast related events check for the webhooks for simulcast target events.

Example

An event manager sets up a live stream for a virtual conference and wants to simulcast the stream on YouTube and Facebook Live. They first create the primary live stream in FastPix, ensuring it's in the idle state. Then, they use the API to create a simulcast target for YouTube.

Related guide: Simulcast to 3rd party platforms

Example Usage

import os
import json

from fastpix_python import Fastpix, models

with Fastpix(
    security=models.Security(
        username="your-access-token",
        password="your-secret-key",
    ),
) as fastpix:

    res = fastpix.simulcast_stream.create_simulcast_of_stream(stream_id="your-stream-id", url="rtmp://hyd01.contribute.live-video.net/app/", stream_key="live_1012464221_DuM8W004MoZYNxQEZ0czODgfHCFBhk", metadata={
        "livestream_name": "your-livestream-name",
    })

    # Handle response
    print(json.dumps(res.model_dump(mode="json", by_alias=True, exclude_unset=True), indent=2))

Parameters

Parameter Type Required Description Example
stream_id str ✔️ After creating a new live stream, FastPix assigns a unique identifier to the stream. your-stream-id
url Optional[str] The RTMPS hostname, combined with the application name, is crucial for connecting to third-party live streaming services and transmitting the live stream. rtmp://hyd01.contribute.live-video.net/app/
stream_key Optional[str] A unique stream key is generated for streaming, allowing the user to start streaming on any third-party platform using this key. live_1012464221_DuM8W004MoZYNxQEZ0czODgfHCFBhk
metadata Dict[str, str] You can search for videos with specific key-value pairs using metadata, when you tag a video in "key":"value" pairs. {
"livestream_name": "your-livestream-name"
}
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.CreateSimulcastOfStreamResponse

Errors

Error Type Status Code Content Type
errors.FastpixDefaultError 4XX, 5XX */*

get_specific_simulcast_of_stream

Retrieves the details of a specific simulcast associated with a parent live stream. By providing both the streamId of the parent stream and the simulcastId, FastPix returns detailed information about the simulcast, such as the stream URL, the status of the simulcast, and metadata.

Example

This endpoint can be used to verify the status of the simulcast on external platforms before the live stream begins. For example, before starting a live gaming event, the organizer wants to ensure that the simulcast to Twitch is set up correctly. They retrieve the simulcast information to confirm that everything is properly configured.

Example Usage

import os
import json

from fastpix_python import Fastpix, models

with Fastpix(
    security=models.Security(
        username="your-access-token",
        password="your-secret-key",
    ),
) as fastpix:

    res = fastpix.simulcast_stream.get_specific_simulcast_of_stream(stream_id="your-stream-id", simulcast_id="your-simulcast-id")

    # Handle response
    print(json.dumps(res.model_dump(mode="json", by_alias=True, exclude_unset=True), indent=2))

Parameters

Parameter Type Required Description Example
stream_id str ✔️ After creating a new live stream, FastPix assigns a unique identifier to the stream. your-stream-id
simulcast_id str ✔️ When you create the new simulcast, FastPix assign a universal unique identifier which can contain a maximum of 255 characters. your-simulcast-id
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.GetSpecificSimulcastOfStreamResponse

Errors

Error Type Status Code Content Type
errors.FastpixDefaultError 4XX, 5XX */*

update_specific_simulcast_of_stream

Updates the status of a specific simulcast linked to a parent live stream. You can enable or disable the simulcast at any time while the parent stream is active or idle. After the live stream is disabled, the simulcast can no longer be modified.

Webhook event: video.live_stream.simulcast_target.updated

Example

When a PATCH request is made to this endpoint, the API updates the status of the simulcast. This can be useful for pausing or resuming a simulcast on a particular platform without stopping the parent live stream.

Example Usage

import os
import json

from fastpix_python import Fastpix, models

with Fastpix(
    security=models.Security(
        username="your-access-token",
        password="your-secret-key",
    ),
) as fastpix:

    res = fastpix.simulcast_stream.update_specific_simulcast_of_stream(stream_id="your-stream-id", simulcast_id="your-simulcast-id", is_enabled=True, metadata={
        "simulcast_name": "your-livestream-name",
    })

     # Handle response (convert datetimes to JSON-serializable strings)
    print(json.dumps(res.model_dump(mode="json", by_alias=True, exclude_unset=True), indent=2))

Parameters

Parameter Type Required Description Example
stream_id str ✔️ Upon creating a new live stream, FastPix assigns a unique identifier to the stream. your-stream-id
simulcast_id str ✔️ When you create the new simulcast, FastPix assign a universal unique identifier which can contain a maximum of 255 characters. your-simulcast-id
is_enabled Optional[bool] When set to false, the simulcast is disabled for the specified stream. true
metadata Dict[str, str] You can search for videos with specific key-value pairs using metadata, when you tag a video in "key":"value" pairs. {
"livestream_name": "your-livestream-name"
}
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.UpdateSpecificSimulcastOfStreamResponse

Errors

Error Type Status Code Content Type
errors.FastpixDefaultError 4XX, 5XX */*