Skip to content

Latest commit

 

History

History
200 lines (149 loc) · 16.2 KB

File metadata and controls

200 lines (149 loc) · 16.2 KB

Simulcasts

Overview

Available Operations

Create

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

using Fastpix;
using Fastpix.Models.Components;
using System.Collections.Generic;
using Fastpix.Utils;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

var sdk = new FastpixSDK(security: new Security() {
    Username = "your-access-token",
    Password = "your-secret-key",
});

var res = await sdk.Simulcasts.CreateAsync(
    streamId: "<streamId>",
    body: new SimulcastRequest() {
        Url = "<rtmp-url>",
        StreamKey = "<streamKey>",
        Metadata = new Dictionary<string, string>() {
            { "livestream_name", "<livestream_name>" },
        },
    }
);

// handle response
Console.WriteLine(
    JToken.Parse(
        JsonConvert.SerializeObject(
            res.SimulcastResponse,
            Utilities.GetDefaultJsonSerializerSettings()
        )
    ).ToString(Formatting.Indented)
);

Parameters

Parameter Type Required Description Example
StreamId string ✔️ After creating a new live stream, FastPix assigns a unique identifier to the stream.
Body SimulcastRequest ✔️ N/A {
"url": "",
"streamKey": "",
"metadata": {
"livestream_name": "<livestream_name>"
}
}

Response

CreateSimulcastOfStreamResponse

Errors

Error Type Status Code Content Type
Fastpix.Models.Errors.APIException 4XX, 5XX */*

Delete

Deletes a simulcast using its unique simulcastId, which you received during the simulcast creation process. Deleting a simulcast stops the broadcast to the associated platform, while the parent stream continues if it’s live. This action can’t be undone, and you must create a new simulcast to resume streaming to the same platform.

Webhook event: video.live_stream.simulcast_target.deleted

Example

A broadcaster may need to stop simulcasting to one platform while keeping the stream active on others. For example, a tech company is simulcasting a product launch across multiple platforms. Midway through the event, they decide to stop the simulcast on Facebook due to performance issues but continue streaming on YouTube. They use this API to delete the Facebook simulcast target.

Example Usage

using Fastpix;
using Fastpix.Models.Components;
using Fastpix.Utils;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

var sdk = new FastpixSDK(security: new Security() {
    Username = "your-access-token",
    Password = "your-secret-key",
});

var res = await sdk.Simulcasts.DeleteAsync(
    streamId: "<streamId>",
    simulcastId: "<simulcastId>"
);

// handle response
Console.WriteLine(
    JToken.Parse(
        JsonConvert.SerializeObject(
            res.SimulcastdeleteResponse,
            Utilities.GetDefaultJsonSerializerSettings()
        )
    ).ToString(Formatting.Indented)
);

Parameters

Parameter Type Required Description Example
StreamId string ✔️ After creating a new live stream, FastPix assigns a unique identifier to the stream.
SimulcastId string ✔️ When you create the new simulcast, FastPix assign a universal unique identifier which can contain a maximum of 255 characters.

Response

DeleteSimulcastOfStreamResponse

Errors

Error Type Status Code Content Type
Fastpix.Models.Errors.APIException 4XX, 5XX */*

Update

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

using Fastpix;
using Fastpix.Models.Components;
using System.Collections.Generic;
using Fastpix.Utils;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

var sdk = new FastpixSDK(security: new Security() {
    Username = "your-access-token",
    Password = "your-secret-key",
});

var res = await sdk.Simulcasts.UpdateAsync(
    streamId: "<streamId>",
    simulcastId: "<simulcastId>",
    body: new SimulcastUpdateRequest() {
        Metadata = new Dictionary<string, string>() {
            { "simulcast_name", "<simulcast_name>" },
        },
    }
);

// handle response
Console.WriteLine(
    JToken.Parse(
        JsonConvert.SerializeObject(
            res.SimulcastUpdateResponse,
            Utilities.GetDefaultJsonSerializerSettings()
        )
    ).ToString(Formatting.Indented)
);

Parameters

Parameter Type Required Description Example
StreamId string ✔️ Upon creating a new live stream, FastPix assigns a unique identifier to the stream.
SimulcastId string ✔️ When you create the new simulcast, FastPix assign a universal unique identifier which can contain a maximum of 255 characters.
Body SimulcastUpdateRequest ✔️ N/A {
"isEnabled": true,
"metadata": {
"simulcast_name": "<simulcast_name>"
}
}

Response

UpdateSpecificSimulcastOfStreamResponse

Errors

Error Type Status Code Content Type
Fastpix.Models.Errors.APIException 4XX, 5XX */*