Operations for video playback management
- create - Create a playback ID
- listIds - Get all playback IDs details for a media
- delete - Delete a playback ID
- get - Get a playback ID
- updateDomainRestrictions - Update domain restrictions for a playback ID
- updateUserAgentRestrictions - Update user-agent restrictions for a playback ID
You can create a new playback ID for a specific media asset. If you have already retrieved an existing playbackId using the Get Media by ID endpoint for a media asset, you can use this endpoint to generate a new playback ID with a specified access policy.
If you want to create a private playback ID for a media asset that already has a public playback ID, this endpoint also allows you to do so by specifying the desired access policy.
-
Make a
POSTrequest to this endpoint, replacing<mediaId>with theuploadIdoridof the media asset. -
Include the
accessPolicyin the request body withprivateorpublicas the value. -
You receive a response containing the newly created playback ID with the specified access level.
A video streaming service generates playback IDs for each media file when users request to view specific content. The video player then uses the playback ID to stream the video.
import { Fastpix } from "@fastpix/fastpix-node";
const fastpix = new Fastpix({
security: {
username: "your-access-token",
password: "your-secret-key",
},
});
async function run() {
const result = await fastpix.playback.create({
mediaId: "your-media-id",
body: {
accessPolicy: "public",
drmConfigurationId: "your-drm-configuration-id",
resolution: "1080p",
},
});
console.log(result);
}
run();The standalone function version of this method:
import { FastpixCore } from "@fastpix/fastpix-node/core.js";
import { playbackCreate } from "@fastpix/fastpix-node/funcs/playbackCreate.js";
// Use `FastpixCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const fastpix = new FastpixCore({
security: {
username: "your-access-token",
password: "your-secret-key",
},
});
async function run() {
const res = await playbackCreate(fastpix, {
mediaId: "your-media-id",
body: {
accessPolicy: "public",
drmConfigurationId: "your-drm-configuration-id",
resolution: "1080p",
},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("playbackCreate failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CreateMediaPlaybackIdRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.CreateMediaPlaybackIdResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.FastpixDefaultError | 4XX, 5XX | */* |
Retrieves all playback IDs associated with a given media asset, including each playback ID’s access policy and detailed access restrictions such as allowed or denied domains and user agents.
How it works:
- Send a
GETrequest to this endpoint with the targetmediaId. - The response includes an array of playback ID records with their respective access controls.
Use case: Useful for validating and managing playback permissions programmatically, reviewing restriction settings, or powering an access control dashboard.
import { Fastpix } from "@fastpix/fastpix-node";
const fastpix = new Fastpix({
security: {
username: "your-access-token",
password: "your-secret-key",
},
});
async function run() {
const result = await fastpix.playback.listIds({
mediaId: "your-media-id",
});
console.log(result);
}
run();The standalone function version of this method:
import { FastpixCore } from "@fastpix/fastpix-node/core.js";
import { playbackListIds } from "@fastpix/fastpix-node/funcs/playbackListIds.js";
// Use `FastpixCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const fastpix = new FastpixCore({
security: {
username: "your-access-token",
password: "your-secret-key",
},
});
async function run() {
const res = await playbackListIds(fastpix, {
mediaId: "your-media-id",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("playbackListIds failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.ListPlaybackIdsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.ListPlaybackIdsResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.FastpixDefaultError | 4XX, 5XX | */* |
This endpoint deletes a specific playback ID associated with a media asset. Deleting a playback ID revokes access to the media content linked to that ID.
-
Make a
DELETErequest to this endpoint, replacing<mediaId>with the unique ID of the media asset from which you want to delete the playback ID. -
Include the
playbackIdyou want to delete in the request body.
Your platform offers limited-time access to premium content. When the subscription expires, you can revoke access to the content by deleting the associated playback ID, preventing users from streaming the video further.
import { Fastpix } from "@fastpix/fastpix-node";
const fastpix = new Fastpix({
security: {
username: "your-access-token",
password: "your-secret-key",
},
});
async function run() {
const result = await fastpix.playback.delete({
mediaId: "your-media-id",
playbackId: "your-playback-id",
});
console.log(result);
}
run();The standalone function version of this method:
import { FastpixCore } from "@fastpix/fastpix-node/core.js";
import { playbackDelete } from "@fastpix/fastpix-node/funcs/playbackDelete.js";
// Use `FastpixCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const fastpix = new FastpixCore({
security: {
username: "your-access-token",
password: "your-secret-key",
},
});
async function run() {
const res = await playbackDelete(fastpix, {
mediaId: "your-media-id",
playbackId: "your-playback-id",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("playbackDelete failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.DeleteMediaPlaybackIdRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.DeleteMediaPlaybackIdResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.FastpixDefaultError | 4XX, 5XX | */* |
This endpoint retrieves details about a specific playback ID associated with a media asset. Use it to check the access policy for that specific playback ID, such as whether it is public or private.
How it works:
- Make a GET request to the endpoint, replacing
{mediaId}with the media ID and{playbackId}with the playback ID. - This request is useful for auditing or validation before granting playback access in your application.
Example: A media platform might use this endpoint to verify if a playback ID is public or private before embedding the video in a frontend player or allowing access to a restricted group.
import { Fastpix } from "@fastpix/fastpix-node";
const fastpix = new Fastpix({
security: {
username: "your-access-token",
password: "your-secret-key",
},
});
async function run() {
const result = await fastpix.playback.get({
mediaId: "your-media-id",
playbackId: "your-playback-id",
});
console.log(result);
}
run();The standalone function version of this method:
import { FastpixCore } from "@fastpix/fastpix-node/core.js";
import { playbackGet } from "@fastpix/fastpix-node/funcs/playbackGet.js";
// Use `FastpixCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const fastpix = new FastpixCore({
security: {
username: "your-access-token",
password: "your-secret-key",
},
});
async function run() {
const res = await playbackGet(fastpix, {
mediaId: "your-media-id",
playbackId: "your-playback-id",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("playbackGet failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetPlaybackIdRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.GetPlaybackIdResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.FastpixDefaultError | 4XX, 5XX | */* |
This endpoint updates domain-level restrictions for a specific playback ID associated with a media asset. It allows you to restrict playback to specific domains or block known unauthorized domains.
How it works:
- Make a
PATCHrequest to this endpoint with your desired domain access configuration. - Set a default policy (
allowordeny) and specify domain names in theallowordenylists. - This is commonly used to restrict video playback to your website or approved client domains.
Example:
A streaming service can allow playback only from example.com and deny all others by setting: "defaultPolicy": "deny" and "allow": ["example.com"].
import { Fastpix } from "@fastpix/fastpix-node";
const fastpix = new Fastpix({
security: {
username: "your-access-token",
password: "your-secret-key",
},
});
async function run() {
const result = await fastpix.playback.updateDomainRestrictions({
mediaId: "your-media-id",
playbackId: "your-playback-id",
body: {
allow: [
"yourdomain.com",
"sampledomain.com",
],
deny: [
"yourworkdomain.com",
],
},
});
console.log(result);
}
run();The standalone function version of this method:
import { FastpixCore } from "@fastpix/fastpix-node/core.js";
import { playbackUpdateDomainRestrictions } from "@fastpix/fastpix-node/funcs/playbackUpdateDomainRestrictions.js";
// Use `FastpixCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const fastpix = new FastpixCore({
security: {
username: "your-access-token",
password: "your-secret-key",
},
});
async function run() {
const res = await playbackUpdateDomainRestrictions(fastpix, {
mediaId: "your-media-id",
playbackId: "your-playback-id",
body: {
allow: [
"yourdomain.com",
"sampledomain.com",
],
deny: [
"yourworkdomain.com",
],
},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("playbackUpdateDomainRestrictions failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.UpdateDomainRestrictionsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.UpdateDomainRestrictionsResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.FastpixDefaultError | 4XX, 5XX | */* |
This endpoint allows updating user-agent restrictions for a specific playback ID associated with a media asset. It can be used to allow or deny specific user-agents during playback request evaluation.
How it works:
- Make a
PATCHrequest to this endpoint with your desired user-agent access configuration. - Specify a default policy (
allowordeny) and provide specificallowordenylists. - Use this to restrict access to specific browsers, devices, or bots.
Example: A developer may configure a playback ID to deny access from known scraping user-agents while allowing all others by default.
import { Fastpix } from "@fastpix/fastpix-node";
const fastpix = new Fastpix({
security: {
username: "your-access-token",
password: "your-secret-key",
},
});
async function run() {
const result = await fastpix.playback.updateUserAgentRestrictions({
mediaId: "your-media-id",
playbackId: "your-playback-id",
body: {
allow: [
"Mozilla/55.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
],
deny: [
"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/53745.36 (KHTML, like Gecko) Chrome/138.0.0.0 Mobile Safari/537.36",
],
},
});
console.log(result);
}
run();The standalone function version of this method:
import { FastpixCore } from "@fastpix/fastpix-node/core.js";
import { playbackUpdateUserAgentRestrictions } from "@fastpix/fastpix-node/funcs/playbackUpdateUserAgentRestrictions.js";
// Use `FastpixCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const fastpix = new FastpixCore({
security: {
username: "your-access-token",
password: "your-secret-key",
},
});
async function run() {
const res = await playbackUpdateUserAgentRestrictions(fastpix, {
mediaId: "your-media-id",
playbackId: "your-playback-id",
body: {
allow: [
"Mozilla/55.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
],
deny: [
"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/53745.36 (KHTML, like Gecko) Chrome/138.0.0.0 Mobile Safari/537.36",
],
},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("playbackUpdateUserAgentRestrictions failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.UpdateUserAgentRestrictionsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.UpdateUserAgentRestrictionsResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.FastpixDefaultError | 4XX, 5XX | */* |