Overview

Creating a media player that is engaging and accessible is key to growing and retaining an audience. Learn how to add subtitles, a thumbnail track, and chapters to your media player using Ittybit's Tracks API.

Step-by-step guide

  1. Locate the media file you want to add Tracks to. You will need the file_id or url as an input as well as an API Key. You can find the file_id in the Media object.

  2. Use the following code snippets to add Tracks to your media player:

const API_KEY = "YOUR API KEY HERE" // Your Ittybit API key
const response = await fetch("https://api.ittybit.com/tasks", {
headers: {
Method: "POST",
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
body: JSON.stringify({
file_id: "med_abcdefgh1234", // Required parameter: file_id or url
kind: "subtitles", // Required parameter: desired output kind
},
}),
},
});

About the API

Endpoint

POST https://api.ittybit.com/tasks

Body parameters

{
  "file_id": "file_abcdefgh1234", // Required parameter: file_id or url
  "kind": "subtitles" // or "chapters" or "thumbnail"
}

Required:

  • Either url or file_id must be provided.

    • url string - The URL of the file to use as the input for the task. This must be a publicly accessible URL.
    • file_id string - The ID of the file to use as the input for the task. This must be a file that has been uploaded to Ittybit. You can find the file_id in the response when you upload a file via the API.
  • kind string - The desired output type. See Tasks for available kinds:

Additional parameters and modifiers:

  • confidence float - The minimum confidence level required for the output. This is only applicable for certain kinds.

For a complete list of available kinds and other modifiers, see the Tasks documentation.

Next: Combine with Automations API

You can use the Automations API to automatically add subtitles, a thumbnail track, and chapters to all uploaded media files. This is useful for large media libraries or social networks with user-generated content.

See the guide here: Automations

Or see Tracks in action within an Automations API request:

const response = await fetch("https://api.ittybit.com/automations", {
headers: {
  Method: "POST",
  Authorization: `Bearer ${API_KEY}`,
  "Content-Type": "application/json",
  body: JSON.stringify({
"name": "All video uploads",
"trigger": {
	"event": "media.created",
	"conditions": [
		{"prop": "kind", "value": "video"}
	]
},
"tasks": [
	{
		"kind": "image",
		"start": 0
	}, {
		"kind": "video",
		"width": 600,
		"format": "mp4",
		"filename": "600.mp4",
		"next": [
			{
				"kind": "speech",
				"next": [
					{
						"kind": "subtitles"
					}
				]
			},
			{
				"kind": "thumbnails"
			}
		]
	}
]
 }),
},
});

Considerations

This guide is being updated. Please check back soon for more information.