Skip to content

Latest commit

 

History

History
100 lines (72 loc) · 6.83 KB

File metadata and controls

100 lines (72 loc) · 6.83 KB

InVideoAIfeatures

Overview

Available Operations

generateChapters

This endpoint enables you to generate chapters for an existing media file.

How it works

  1. Make a PATCH request to this endpoint, replacing <mediaId> with the ID of the media for which you want to generate chapters.
  2. Include the chapters parameter in the request body to enable.
  3. The response contains the updated media data, confirming the changes made.

You can use the video.mediaAI.chapters.ready webhook event to track and notify about the chapters generation.

Use case: This is particularly useful when a user uploads a video and later decides to enable chapters without re-uploading the entire video.

Related guide: Video chapters

Example Usage

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.inVideoAIfeatures.generateChapters({
    mediaId: "your-media-id",
    body: {},
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { FastpixCore } from "@fastpix/fastpix-node/core.js";
import { inVideoAIfeaturesGenerateChapters } from "@fastpix/fastpix-node/funcs/inVideoAIfeaturesGenerateChapters.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 inVideoAIfeaturesGenerateChapters(fastpix, {
    mediaId: "your-media-id",
    body: {},
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("inVideoAIfeaturesGenerateChapters failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.UpdateMediaChaptersRequest ✔️ 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.

Response

Promise<operations.UpdateMediaChaptersResponse>

Errors

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