To add chapters to your videos using query parameters, follow these steps:
- Determine the URL of the chapter file you want to use. This should also be in WebVTT format.
- Add another JSON object to the tracks parameter array to specify the chapter track:
{“kind”:”chapters”, “src”:”URL_TO_CHAPTER_FILE.vtt”, “srclang”:”en”}
- “kind”: Set this to “chapters” to indicate it’s a chapter track.
- “src”: Replace URL_TO_CHAPTER_FILE.vtt with the URL of the chapter file.
- “srclang”: Specify the language code for the chapters (e.g., “en” for English).
- Here’s an example URL with both captions and chapters added using query parameters:
https://your-video-url.com/your-video.mp4?tracks=[
{“kind”:”captions”, “src”:”https://example.com/captions_en.vtt”, “srclang”:”en”, “label”:”English”, “default”:”1″},
{“kind”:”captions”, “src”:”https://example.com/captions_de.vtt”, “srclang”:”de”, “label”:”German”},
{“kind”:”captions”, “src”:”https://example.com/captions_es.vtt”, “srclang”:”es”, “label”:”Spanish”},
{“kind”:”chapters”, “src”:”https://example.com/chapters.vtt”, “srclang”:”en”}