@fastpix/fastpix-node 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +509 -0
- package/dist/Live/index.d.ts +19 -0
- package/dist/Live/index.js +200 -0
- package/dist/NetworkFetcher/index.d.ts +7 -0
- package/dist/NetworkFetcher/index.js +74 -0
- package/dist/VideoOnDemand/index.d.ts +16 -0
- package/dist/VideoOnDemand/index.js +166 -0
- package/dist/index.cjs +635 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +166 -0
- package/dist/index.mjs +614 -0
- package/docs/Live/CreateLiveStream.md +48 -0
- package/docs/Live/ManageLiveStreams.md +116 -0
- package/docs/Live/ManageStreamPlayback.md +86 -0
- package/docs/Live/ManageStreamSimulcast.md +133 -0
- package/docs/VideoOnDemand/ManageMedia.md +147 -0
- package/docs/VideoOnDemand/ManageMediaPlayback.md +61 -0
- package/docs/VideoOnDemand/UploadMedia.md +320 -0
- package/package.json +37 -0
- package/types/index.d.ts +217 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Managing Live Streams
|
|
2
|
+
|
|
3
|
+
Live streams are uniquely identified by the `streamId`, which is generated automatically when you create a new live stream using the `initiateLiveStream` method. This `streamId` is essential for performing any operations related to live streams, such as retrieving details, updating configurations, or deleting streams.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Method: getAllLiveStreams()
|
|
8
|
+
|
|
9
|
+
The `getAllLiveStreams` method allows you to fetch a list of all live streams. You can customize the query by modifying parameters such as `limit`, `offset`, and `orderBy`. If no parameters are provided, the method will use default values.
|
|
10
|
+
|
|
11
|
+
### Parameter Details:
|
|
12
|
+
|
|
13
|
+
The method accepts the following query parameters:
|
|
14
|
+
|
|
15
|
+
| **Parameter** | **Description** | **Type** | **Default Value** | **Accepted Values** |
|
|
16
|
+
| ------------- | ------------------------------------------------------------------------------------- | -------- | ----------------- | ------------------------------------------- |
|
|
17
|
+
| `limit` | Specifies the maximum number of items to display per page. | `Number` | `10` | 1 to 50 |
|
|
18
|
+
| `offset` | Determines the starting point for data retrieval in a paginated list. | `Number` | `1` | Any positive integer (e.g., `1`, `5`, `10`) |
|
|
19
|
+
| `orderBy` | Sorts the list of streams. The list can be arranged in ascending or descending order. | `String` | `desc` | `"desc"`, `"asc"` |
|
|
20
|
+
|
|
21
|
+
### Example Request:
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
// Define pagination settings for retrieving live streams
|
|
25
|
+
const getAllLiveStreamPagination = {
|
|
26
|
+
limit: 10, // Limit the number of live streams retrieved (1 to 50)
|
|
27
|
+
offset: 1, // Skip a specified number of streams for pagination
|
|
28
|
+
orderBy: "asc", // Sort the results in ascending order
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// Fetch the live streams using the defined parameters
|
|
32
|
+
const getAllLiveStreams = await fastpix.getAllLiveStreams(
|
|
33
|
+
getAllLiveStreamPagination
|
|
34
|
+
);
|
|
35
|
+
console.log("All Live Streams:", getAllLiveStreams);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
# Method: getLiveStreamById()
|
|
41
|
+
|
|
42
|
+
The `getLiveStreamById` method allows you to retrieve the details of a specific live stream by its unique `streamId`.
|
|
43
|
+
|
|
44
|
+
### Parameter Details:
|
|
45
|
+
|
|
46
|
+
| **Parameter** | **Description** | **Type** | **Accepted Values** |
|
|
47
|
+
| --------------------- | -------------------------------------------------------------------------------------------- | -------- | ------------------------------------- |
|
|
48
|
+
| `streamId` (required) | The unique identifier assigned to the live stream. You receive this ID upon stream creation. | `String` | Any valid string (max 255 characters) |
|
|
49
|
+
|
|
50
|
+
### Example Request:
|
|
51
|
+
|
|
52
|
+
```javascript
|
|
53
|
+
// Define the streamId for the live stream you want to retrieve
|
|
54
|
+
const getLiveStreamById = await fastpix.getLiveStreamById({
|
|
55
|
+
streamId: "a09f3e958c16ed00e85bfe798abd9845", // Replace with the actual stream ID
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
console.log("Live Stream Details:", getLiveStreamById);
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
# Method: updateLiveStream()
|
|
64
|
+
|
|
65
|
+
The `updateLiveStream` method allows you to update a live stream's `metadata` and `reconnectWindow`, using the `streamId`.
|
|
66
|
+
|
|
67
|
+
### Parameter Details:
|
|
68
|
+
|
|
69
|
+
| **Parameter** | **Description** | **Type** | **Accepted Values** |
|
|
70
|
+
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | --------------------------------------------------------------- |
|
|
71
|
+
| `streamId` (required) | The unique identifier assigned to the live stream. You receive this ID upon stream creation. | `String` | Any valid string (max 255 characters) |
|
|
72
|
+
| `metadata` | Optional metadata to tag the live stream with key-value pairs. You can add up to 10 key-value pairs, and each key and value can have a maximum of 255 characters. | `Object` | Any valid key-value pair (max 255 characters per key and value) |
|
|
73
|
+
| `reconnectWindow` | The time (in seconds) before ending the stream in case of a disruption. This value can range from 60 to 1800 seconds. | `Integer` | 60 to 1800 (seconds) |
|
|
74
|
+
|
|
75
|
+
### Example Request:
|
|
76
|
+
|
|
77
|
+
```javascript
|
|
78
|
+
// Define the fields to be updated in the live stream configuration
|
|
79
|
+
const updateLiveStreamRequest = {
|
|
80
|
+
metadata: {
|
|
81
|
+
livestream_name: "Game_streaming", // Example of a metadata entry
|
|
82
|
+
},
|
|
83
|
+
reconnectWindow: 100, // Set the reconnect window to 100 seconds
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// Update the live stream with the specified streamId
|
|
87
|
+
const updateLiveStream = await fastpix.updateLiveStream(
|
|
88
|
+
{ streamId: "a09f3e958c16ed00e85bfe798abd9845" }, // Provide the stream ID for the live stream to update
|
|
89
|
+
updateLiveStreamRequest
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
console.log("Updated Live Stream:", updateLiveStream);
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
# Method: deleteLiveStream()
|
|
98
|
+
|
|
99
|
+
The `deleteLiveStream` method allows you to delete a live stream by its unique `streamId`.
|
|
100
|
+
|
|
101
|
+
### Parameter Details:
|
|
102
|
+
|
|
103
|
+
| **Parameter** | **Description** | **Type** | **Accepted Values** |
|
|
104
|
+
| --------------------- | ----------------------------------------------------------------------------------------------------- | -------- | ------------------------------------- |
|
|
105
|
+
| `streamId` (required) | The unique identifier assigned to the live stream. You receive this ID when creating the live stream. | `String` | Any valid string (max 255 characters) |
|
|
106
|
+
|
|
107
|
+
### Example Request:
|
|
108
|
+
|
|
109
|
+
```javascript
|
|
110
|
+
// Define the streamId for the live stream you wish to delete
|
|
111
|
+
const deleteLiveStream = await fastpix.deleteLiveStream({
|
|
112
|
+
streamId: "a09f3e958c16ed00e85bfe798abd9845", // Provide the stream ID of the live stream to delete
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
console.log("Deleted Live Stream:", deleteLiveStream);
|
|
116
|
+
```
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Managing Live Stream Playback
|
|
2
|
+
|
|
3
|
+
To manage playback, you must first initiate a live stream, which will provide you with a unique `streamId`. This `streamId` will be used across all playback management operations, such as generating playback IDs, retrieving policies, and deleting them.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Method: generateLiveStreamPlaybackId()
|
|
8
|
+
|
|
9
|
+
The `generateLiveStreamPlaybackId` method allows you to generate a playback ID for a live stream. This requires the `streamId` of the live stream you want to generate the playback ID for, as well as the desired `accessPolicy` which controls whether the stream will be public or private. If the `accessPolicy` is not provided, the default value is `public`.
|
|
10
|
+
|
|
11
|
+
### Parameter Details:
|
|
12
|
+
|
|
13
|
+
| **Parameter** | **Description** | **Type** | **Default Value** | **Accepted Values** |
|
|
14
|
+
| ------------------------- | ----------------------------------------------------------------------------------------------------- | -------- | ----------------- | ------------------------------------- |
|
|
15
|
+
| `streamId` (required) | The unique identifier assigned to the live stream. You receive this ID when creating the live stream. | `String` | - | Any valid string (max 255 characters) |
|
|
16
|
+
| `accessPolicy` | Determines if access to the streamed content is kept private or available to all. | `String` | `"public"` | `"public"`, `"private"` |
|
|
17
|
+
|
|
18
|
+
### Example Request:
|
|
19
|
+
|
|
20
|
+
```javascript
|
|
21
|
+
// Generate a live stream playback ID for an existing stream
|
|
22
|
+
const generateLiveStreamPlaybackId = await fastpix.generateLiveStreamPlaybackId(
|
|
23
|
+
{ streamId: "a09f3e958c16ed00e85bfe798abd9845" }, // Pass the stream ID for which the playback ID is to be generated
|
|
24
|
+
{ accessPolicy: "public" } // Specify the access policy (can be "public" or "private")
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
console.log("Generated Live Stream Playback ID:", generateLiveStreamPlaybackId);
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
# Method: deleteLiveStreamPlaybackId()
|
|
33
|
+
|
|
34
|
+
The `deleteLiveStreamPlaybackId` method allows you to delete one or more playback IDs for a live stream. This method allows you to specify the `streamId` of the live stream, and the `playbackId` you wish to delete and supports deleting a **single playback ID** as a string or **multiple playback IDs** as an array of strings.
|
|
35
|
+
|
|
36
|
+
### Parameter Details:
|
|
37
|
+
|
|
38
|
+
| **Parameter** | **Description** | **Type** | **Accepted Values** |
|
|
39
|
+
| ----------------------- | ---------------------------------------------------------------------------------------------------- | -------- | --------------------------------------- |
|
|
40
|
+
| `streamId` (required) | The unique identifier assigned to the live stream. You receive this ID when creating the live stream. | `String` | Any valid string (up to 255 characters) |
|
|
41
|
+
| `playbackId` (required) | The unique identifiers for the playback IDs to be deleted. | `Array` or `String` | Array of valid strings (up to 255 characters each) or string |
|
|
42
|
+
|
|
43
|
+
### Example Request:
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
// Define the streamId and playbackId dynamically
|
|
47
|
+
const streamId = "a09f3e958c16ed00e85bfe798abd9845";
|
|
48
|
+
|
|
49
|
+
// For single playbackId, pass it as a string
|
|
50
|
+
const playbackId = "632029b4-7c53-4dcf-a4d3-1884c29e90f8";
|
|
51
|
+
|
|
52
|
+
// For multiple playbackId's, pass them as an array of strings
|
|
53
|
+
// const playbackId = ["632029b4-7c53-4dcf-a4d3-1884c29e90f8", "687629b4-7c53-4dcf-a4d3-1884876540f8"];
|
|
54
|
+
|
|
55
|
+
const deleteLiveStreamPlaybackId = await fastpix.deleteLiveStreamPlaybackId({
|
|
56
|
+
streamId: streamId, // Pass the streamId of the live stream for which playback ID is to be deleted
|
|
57
|
+
playbackId: playbackId, // Pass the playbackId as an array (even for a single ID)
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
console.log("Deleted Live Stream Playback ID:", deleteLiveStreamPlaybackId);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
# Method: getLiveStreamPlaybackPolicy()
|
|
66
|
+
|
|
67
|
+
The `getLiveStreamPlaybackPolicy` method allows you to retrieve the playback policy for a specific live stream playback ID. You need to provide both the `streamId` of the live stream and the `playbackId` associated with that stream to fetch the playback policy.
|
|
68
|
+
|
|
69
|
+
### Parameter Details:
|
|
70
|
+
|
|
71
|
+
| **Parameter** | **Description** | **Type** | **Accepted Values** |
|
|
72
|
+
| ----------------------- | ----------------------------------------------------------------------------------------------------- | -------- | ------------------------------------- |
|
|
73
|
+
| `streamId` (required) | The unique identifier assigned to the live stream. You receive this ID when creating the live stream. | `String` | Any valid string (max 255 characters) |
|
|
74
|
+
| `playbackId` (required) | The unique identifier for the playback ID associated with the live stream. | `String` | Any valid string (max 255 characters) |
|
|
75
|
+
|
|
76
|
+
### Example Request:
|
|
77
|
+
|
|
78
|
+
```javascript
|
|
79
|
+
// Retrieve the playback policy for a specific live stream playback ID
|
|
80
|
+
const getLiveStreamPlaybackPolicy = await fastpix.getLiveStreamPlaybackPolicy({
|
|
81
|
+
streamId: "1c5e8abcc2080cba74f5d0ac91c7833e", // Replace with the actual stream ID
|
|
82
|
+
playbackId: "95ce872d-0b58-44f3-be72-8ed8b97ee2c9", // Replace with the actual playback ID
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
console.log("Live Stream Playback Policy:", getLiveStreamPlaybackPolicy);
|
|
86
|
+
```
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Manage Live Stream Simulcast
|
|
2
|
+
|
|
3
|
+
Simulcasting allows you to stream your live content to multiple platforms simultaneously. A suite of methods is available to manage live stream simulcasts, including creating a new simulcast, retrieving its details, updating its configuration, and deleting an existing simulcast.
|
|
4
|
+
|
|
5
|
+
To manage simulcasts effectively, you’ll need the `streamId` (generated when you initiate a live stream) and the `simulcastId` (generated when the simulcast is created). These identifiers are crucial for linking simulcast operations to the correct live stream and simulcast.
|
|
6
|
+
|
|
7
|
+
# Method: initiateLiveStreamSimulcast()
|
|
8
|
+
|
|
9
|
+
The `initiateLiveStreamSimulcast` method allows you to create a new simulcast for an existing live stream. Provide the `streamId` of the live stream and a simulcast payload containing the URL and stream key required to start streaming.
|
|
10
|
+
|
|
11
|
+
In the response `simulcastId` must be retained for managing future operations on the simulcast, such as updating or deleting it.
|
|
12
|
+
|
|
13
|
+
### Parameter Details:
|
|
14
|
+
|
|
15
|
+
| **Parameter** | **Description** | **Type** | **Accepted Values** |
|
|
16
|
+
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------- |
|
|
17
|
+
| `url` (required) | The RTMP URL, combined with the application name, is crucial for connecting to third-party live streaming services and transmitting the live stream. | `String` | Any valid RTMP URL (e.g., `rtmps://live.fastpix.io:443/live`) |
|
|
18
|
+
| `streamKey` (required) | A unique stream key that allows the user to start streaming on a third-party platform. This key is used in the RTMP stream configuration. | `String` | Any valid stream key (max 255 characters) |
|
|
19
|
+
| `streamId` (required) | The unique identifier assigned to the live stream. This ID is generated during the creation of the live stream. | `String` | Any valid string (max 255 characters) |
|
|
20
|
+
|
|
21
|
+
### Example Request:
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
// Define the simulcast payload with the URL and stream key
|
|
25
|
+
const simulcastPayload = {
|
|
26
|
+
url: "rtmps://live.fastpix.io:443/live", // RTMP URL for the third-party platform
|
|
27
|
+
streamKey:
|
|
28
|
+
"46c3457fa8a579b2d4da64125a2b6e83ka09f3e958c16ed00e85bfe798abd9845", // Replace with actual stream key
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// Initiate the simulcast for an existing live stream
|
|
32
|
+
const generateSimulcast = await fastpix.initiateLiveStreamSimulcast(
|
|
33
|
+
{
|
|
34
|
+
streamId: "a09f3e958c16ed00e85bfe798abd9845", // Replace with actual stream ID
|
|
35
|
+
},
|
|
36
|
+
simulcastPayload
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
console.log("Generate Simulcast:", generateSimulcast);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
# Method: getLiveStreamSimulcast()
|
|
45
|
+
|
|
46
|
+
The `getLiveStreamSimulcast` method allows you to retrieve details of a specific simulcast for a live stream. To use this method, you need to provide both the `streamId` and the `simulcastId`.
|
|
47
|
+
|
|
48
|
+
### Parameter Details:
|
|
49
|
+
|
|
50
|
+
| **Parameter** | **Description** | **Type** | **Accepted Values** |
|
|
51
|
+
| ------------------------ | ---------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------- |
|
|
52
|
+
| `streamId` (required) | The unique identifier assigned to the live stream. This ID is generated during the creation of the live stream. | `String` | Any valid string (max 255 characters) |
|
|
53
|
+
| `simulcastId` (required) | The unique identifier assigned to the simulcast stream. FastPix generates this ID when the simulcast is created. | `String` | Any valid string (max 255 characters) |
|
|
54
|
+
|
|
55
|
+
### Example Request:
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
// Define the streamId and simulcastId for the simulcast you want to retrieve
|
|
59
|
+
const getLiveSimulcast = await fastpix.getLiveStreamSimulcast({
|
|
60
|
+
streamId: "a09f3e958c16ed00e85bfe798abd9845", // Replace with actual stream ID
|
|
61
|
+
simulcastId: "7269209ff0299319b6321c9a6e7850ff", // Replace with actual simulcast ID
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
console.log("Live Stream Simulcast Details:", getLiveSimulcast);
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
# Method: updateLiveStreamSimulcast()
|
|
70
|
+
|
|
71
|
+
The `updateLiveStreamSimulcast` method allows you to update the configuration of a simulcast stream for a live stream. To use this method, you need to provide the `streamId`, `simulcastId`, and specify the fields to be updated, including `isEnabled` and `metadata`.
|
|
72
|
+
|
|
73
|
+
### Parameter Details:
|
|
74
|
+
|
|
75
|
+
| **Parameter** | **Description** | **Type** | **Accepted Values** |
|
|
76
|
+
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- | --------- | --------------------------------------------------------------- |
|
|
77
|
+
| `streamId` (required) | The unique identifier assigned to the live stream. This ID is generated during the creation of the live stream. | `String` | Any valid string (max 255 characters) |
|
|
78
|
+
| `simulcastId` (required) | The unique identifier assigned to the simulcast stream. FastPix generates this ID when the simulcast is created. | `String` | Any valid string (max 255 characters) |
|
|
79
|
+
| `isEnabled` | Determines if the simulcast stream is enabled or disabled. Set to `false` to disable the simulcast. | `Boolean` | `true` (enabled), `false` (disabled) |
|
|
80
|
+
| `metadata` | Arbitrary user-supplied metadata that will be included in the simulcast details. Max 255 characters per key and value, up to 10 entries. | `Object` | Any valid key-value pair (max 255 characters per key and value) |
|
|
81
|
+
|
|
82
|
+
### Example Request:
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
// Assign streamId, simulcastId, and fields to variables
|
|
86
|
+
const streamId = "a09f3e958c16ed00e85bfe798abd9845"; // Replace with actual stream ID
|
|
87
|
+
const simulcastId = "7269209ff0299319b6321c9a6e7850ff"; // Replace with actual simulcast ID
|
|
88
|
+
|
|
89
|
+
// Define the properties to be updated
|
|
90
|
+
const updateProperties = {
|
|
91
|
+
isEnabled: false, // Disable the simulcast stream (set to true to enable)
|
|
92
|
+
metadata: {
|
|
93
|
+
simulcast2: "media", // Update the metadata as needed
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// Call the updateLiveStreamSimulcast method with the defined variables
|
|
98
|
+
const updateLiveSimulcast = await fastpix.updateLiveStreamSimulcast(
|
|
99
|
+
{ streamId, simulcastId },
|
|
100
|
+
updateProperties
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
console.log("Updated Live Stream Simulcast:", updateLiveSimulcast);
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
# Method: deleteLiveStreamSimulcast()
|
|
109
|
+
|
|
110
|
+
The `deleteLiveStreamSimulcast` method allows you to delete a specific simulcast associated with a live stream. To remove a simulcast, you need to provide both the `streamId` and `simulcastId` that you want to delete.
|
|
111
|
+
|
|
112
|
+
### Parameter Details:
|
|
113
|
+
|
|
114
|
+
| **Parameter** | **Description** | **Type** | **Accepted Values** |
|
|
115
|
+
| ------------------------ | ----------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------- |
|
|
116
|
+
| `streamId` (required) | The unique identifier assigned to the live stream. This ID is generated when the stream is created. | `String` | Any valid string (max 255 characters) |
|
|
117
|
+
| `simulcastId` (required) | The unique identifier assigned to the simulcast stream. This ID is generated when the simulcast is created. | `String` | Any valid string (max 255 characters) |
|
|
118
|
+
|
|
119
|
+
### Example Request:
|
|
120
|
+
|
|
121
|
+
```javascript
|
|
122
|
+
// Assign streamId and simulcastId to variables
|
|
123
|
+
const streamId = "a09f3e958c16ed00e85bfe798abd9845"; // Replace with actual stream ID
|
|
124
|
+
const simulcastId = "7269209ff0299319b6321c9a6e7850ff"; // Replace with actual simulcast ID
|
|
125
|
+
|
|
126
|
+
// Call the deleteLiveStreamSimulcast method with the defined variables
|
|
127
|
+
const deleteLiveSimulcast = await fastpix.deleteLiveStreamSimulcast({
|
|
128
|
+
streamId,
|
|
129
|
+
simulcastId,
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
console.log("Deleted Live Stream Simulcast:", deleteLiveSimulcast);
|
|
133
|
+
```
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Manage Media Methods
|
|
2
|
+
|
|
3
|
+
To manage your media assets, you’ll need the `mediaId`, which is a unique identifier assigned to each media asset.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Method: getAllMediaAssets()
|
|
8
|
+
|
|
9
|
+
The `getAllMediaAssets` method allows you to fetch a list of all media assets. This method accepts three optional parameters: `limit`, `offset`, and `orderBy`. If not provided, the method will use the default values for these parameters.
|
|
10
|
+
|
|
11
|
+
### Parameters Details:
|
|
12
|
+
|
|
13
|
+
| **Parameter** | **Description** | **Type** | **Default Value** | **Accepted Values** |
|
|
14
|
+
| ------------- | ------------------------------------------------------------------------------------------ | -------- | ----------------- | ------------------------------------------- |
|
|
15
|
+
| `limit` | Specifies the maximum number of items to display per page. | `Number` | `10` | 1 to 50 |
|
|
16
|
+
| `offset` | Determines the starting point for data retrieval in a paginated list. | `Number` | `1` | Any positive integer (e.g., `1`, `5`, `10`) |
|
|
17
|
+
| `orderBy` | Sorts the values in the list. The values can be arranged in descending or ascending order. | `String` | `desc` | `"desc"`, `"asc"` |
|
|
18
|
+
|
|
19
|
+
### Example Request:
|
|
20
|
+
|
|
21
|
+
```javascript
|
|
22
|
+
const mediaQueryParams = {
|
|
23
|
+
limit: 20, // Number of assets to fetch in one request (between 1 and 50)
|
|
24
|
+
offset: 5, // Pagination starting position
|
|
25
|
+
orderBy: "asc", // Sorting order of the assets ("asc" for ascending)
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const mediaAssets = await fastpix.getAllMediaAssets(mediaQueryParams);
|
|
29
|
+
console.log("Fetched Media Assets:", mediaAssets);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
# Method: getMediaAssetById()
|
|
35
|
+
|
|
36
|
+
The `getMediaAssetById` method allows you to retrieve a specific media asset by its unique `mediaId`.
|
|
37
|
+
|
|
38
|
+
### Parameters Details:
|
|
39
|
+
|
|
40
|
+
| **Parameter** | **Description** | **Type** | **Required** | **Accepted Values** |
|
|
41
|
+
| -------------------- | ---------------------------------------------------------------------------------------------- | -------- | ------------ | ---------------------------------- |
|
|
42
|
+
| `mediaId` (required) | The unique identifier assigned to the media asset. It can contain a maximum of 255 characters. | `String` | Yes | Any valid string (up to 255 chars) |
|
|
43
|
+
|
|
44
|
+
### Example Request:
|
|
45
|
+
|
|
46
|
+
```javascript
|
|
47
|
+
// Define the parameter for fetching a specific media asset by ID.
|
|
48
|
+
const mediaQueryParams = {
|
|
49
|
+
mediaId: "media-id", // Unique identifier for the media asset to be retrieved
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const getMediaAsset = await fastpix.getMediaAssetById(mediaQueryParams);
|
|
53
|
+
console.log("Retrieved media asset by ID:", getMediaAsset);
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
# Method: updateMediaAsset()
|
|
59
|
+
|
|
60
|
+
The `updateMediaAsset` method lets you update a media asset's metadata by providing its `mediaId`.
|
|
61
|
+
|
|
62
|
+
### Parameters Details:
|
|
63
|
+
|
|
64
|
+
| **Parameter** | **Description** | **Type** | **Accepted Values** |
|
|
65
|
+
| --------------------- | ---------------------------------------------------------------------------------------------- | -------- | ---------------------------------- |
|
|
66
|
+
| `mediaId` (required) | The unique identifier assigned to the media asset. It can contain a maximum of 255 characters. | `String` | Any valid string (up to 255 chars) |
|
|
67
|
+
| `metadata` (required) | Metadata key-value pairs to be updated for the media asset. | `Object` | Key-value pairs (max 10 entries) |
|
|
68
|
+
|
|
69
|
+
### Metadata Object
|
|
70
|
+
|
|
71
|
+
| **Parameter** | **Description** | **Type** | **Accepted Values** |
|
|
72
|
+
| ------------- | -------------------------------------------------------------- | -------- | ---------------------------------- |
|
|
73
|
+
| `key` | A key for the metadata entry (max 255 characters). | `String` | Any string (up to 255 characters). |
|
|
74
|
+
| `value` | The value for the specified metadata key (max 255 characters). | `String` | Any string (up to 255 characters). |
|
|
75
|
+
|
|
76
|
+
You can add up to 10 metadata entries to the `metadata` object. Each entry is a key-value pair. This allows you to tag your media asset for easier identification or categorization.
|
|
77
|
+
|
|
78
|
+
### Example Request:
|
|
79
|
+
|
|
80
|
+
```javascript
|
|
81
|
+
// Define the parameter for specifying the media asset to be updated.
|
|
82
|
+
const mediaAssetToUpdate = {
|
|
83
|
+
mediaId: "media-id", // Unique identifier for the media asset to update.
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// Define the payload with the updates to be applied to the media asset.
|
|
87
|
+
const updatePayload = {
|
|
88
|
+
metadata: {
|
|
89
|
+
key: "value", // Replace "key" and "value" with actual metadata entries.
|
|
90
|
+
category: "nature", // Example of another metadata entry.
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const updateMediaAsset = await fastpix.updateMediaAsset(
|
|
95
|
+
mediaAssetToUpdate,
|
|
96
|
+
updatePayload
|
|
97
|
+
);
|
|
98
|
+
console.log("Updated Media Asset:", updateMediaAsset);
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
# Method: deleteMediaAsset()
|
|
104
|
+
|
|
105
|
+
The `deleteMediaAsset` method deletes a media asset by its unique `mediaId`.
|
|
106
|
+
|
|
107
|
+
### Parameters Details:
|
|
108
|
+
|
|
109
|
+
| **Parameter** | **Description** | **Type** | **Accepted Values** |
|
|
110
|
+
| -------------------- | ---------------------------------------------------------------------------------------------- | -------- | --------------------------------------- |
|
|
111
|
+
| `mediaId` (required) | The unique identifier assigned to the media asset. It can contain a maximum of 255 characters. | `String` | Any valid string (up to 255 characters) |
|
|
112
|
+
|
|
113
|
+
### Example Request:
|
|
114
|
+
|
|
115
|
+
```javascript
|
|
116
|
+
// Define the parameter for specifying the media asset to be deleted.
|
|
117
|
+
const mediaAssetToDelete = {
|
|
118
|
+
mediaId: "media-id", // Unique identifier for the media asset to delete.
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const deleteMediaAsset = await fastpix.deleteMediaAsset(mediaAssetToDelete);
|
|
122
|
+
console.log("Deleted Media Asset:", deleteMediaAsset);
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
# Method: getMediaAssetInfo()
|
|
128
|
+
|
|
129
|
+
The `getMediaAssetInfo` method allows you to retrieve detailed information about the media inputs associated with a specific media asset. You can use this method to verify the media file’s input URL, track creation status, and container format. The `mediaId` must be provided to fetch the information.
|
|
130
|
+
|
|
131
|
+
### Parameters Details:
|
|
132
|
+
|
|
133
|
+
| **Parameter** | **Description** | **Type** | **Accepted Values** |
|
|
134
|
+
| -------------------- | ---------------------------------------------------------------------------------------------- | -------- | --------------------------------------- |
|
|
135
|
+
| `mediaId` (required) | The unique identifier assigned to the media asset. It can contain a maximum of 255 characters. | `String` | Any valid string (up to 255 characters) |
|
|
136
|
+
|
|
137
|
+
### Example Request:
|
|
138
|
+
|
|
139
|
+
```javascript
|
|
140
|
+
// Define the parameter for specifying the media asset whose info is to be retrieved.
|
|
141
|
+
const mediaInfoRequest = {
|
|
142
|
+
mediaId: "media-id", // Unique identifier for the media asset.
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const getMediaInfo = await fastpix.getMediaAssetInfo(mediaInfoRequest);
|
|
146
|
+
console.log("Media Asset Info:", getMediaInfo);
|
|
147
|
+
```
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Method: generateMediaPlaybackId()
|
|
2
|
+
|
|
3
|
+
The `generateMediaPlaybackId` method allows you to generate a playback ID for a specific media asset. You must provide the `mediaId` of the asset for which you want to generate the playback ID, and you can also configure options such as the `accessPolicy` to control the visibility of the media.
|
|
4
|
+
|
|
5
|
+
### Parameters Details:
|
|
6
|
+
|
|
7
|
+
| **Parameter** | **Description** | **Type** | **Accepted Values** |
|
|
8
|
+
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | -------- | --------------------------------------- |
|
|
9
|
+
| `mediaId` (required) | The unique identifier assigned to the media asset. This is required to specify the media for which you want to generate a playback ID. | `String` | Any valid string (up to 255 characters) |
|
|
10
|
+
| `accessPolicy` (required) | Determines if access to the streamed content is kept private or available to all. This can be set to either `public` or `private` or `drm`. | `String` | `"public"`, `"private"`, `"drm"` |
|
|
11
|
+
|
|
12
|
+
### Example Request:
|
|
13
|
+
|
|
14
|
+
```javascript
|
|
15
|
+
// Define the mediaId and accessPolicy dynamically
|
|
16
|
+
const mediaPlaybackRequest = {
|
|
17
|
+
mediaId: "media-id", // Unique identifier for the media asset.
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const playbackOptions = {
|
|
21
|
+
accessPolicy: "public", // Can be 'public' or 'private' or 'drm'.
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const playbackIdResponse = await fastpix.generateMediaPlaybackId(
|
|
25
|
+
mediaPlaybackRequest, // Pass the mediaId
|
|
26
|
+
playbackOptions // Pass the accessPolicy
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
console.log("Playback ID Creation Response:", playbackIdResponse);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
# Method: deleteMediaPlaybackId()
|
|
35
|
+
|
|
36
|
+
The `deleteMediaPlaybackId` method allows you to delete one or more playback IDs for a media asset. This method allows you to specify both the `mediaId` and the `playbackId` you wish to delete and it supports deleting a **single playback ID** as a string or **multiple playback IDs** as an array of strings.
|
|
37
|
+
|
|
38
|
+
### Parameters Details:
|
|
39
|
+
|
|
40
|
+
| **Parameter** | **Description** | **Type** | **Accepted Values** |
|
|
41
|
+
| ----------------------- | ---------------------------------------------------------------------------------------------------- | -------- | --------------------------------------- |
|
|
42
|
+
| `mediaId` (required) | The unique identifier assigned to the media asset. It can contain a maximum of 255 characters. | `String` | Any valid string (up to 255 characters) |
|
|
43
|
+
| `playbackId` (required) | The unique identifiers for the playback IDs to be deleted. | `Array` or `String` | Array of valid strings (up to 255 characters each) or string |
|
|
44
|
+
|
|
45
|
+
### Example Request:
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
const mediaId = "media-id"; // The ID of the media asset for which you want to delete the playback ID.
|
|
49
|
+
const playbackId = "playback-id"; // For deleting a single playback ID as a string.
|
|
50
|
+
|
|
51
|
+
// Example for multiple playback IDs:
|
|
52
|
+
// const playbackId = ["playback-id-1", "playback-id-2"]; // Pass an array of playback IDs to delete.
|
|
53
|
+
|
|
54
|
+
// Use the deleteMediaPlaybackId method to delete the specified playback ID(s).
|
|
55
|
+
const deletePlaybackResponse = await fastpix.deleteMediaPlaybackId({
|
|
56
|
+
mediaId: mediaId, // Pass the mediaId for which playback ID(s) are to be deleted
|
|
57
|
+
playbackId: playbackId, // Pass the playbackId(s) to delete.
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
console.log("Playback ID Deletion Response:", deletePlaybackResponse);
|
|
61
|
+
```
|