You can use the API to create new, edit existing or delete chapters for the player. 

addChapter

Adds a chapter to the player dynamically. The new chapter will be displayed on the chapters bar in the order of appearance.

addChapter({"start": millis, "title": chaptertitle,"description": chapterdescription,"thumbnail": chapterthumbnail })
ParameterData typeDescription
millisintegerStart time for the chapter (given in milliseconds)
chaptertitletextChapter title to be displayed
chapterdescriptiontextDescription for the chapter (displayed beneath the title)
chapterthumbnailURLURL of the chapter thumbnail to be displayed


Sample usage:


VideoPlayer.Collection.getPlayerById("player_container_id").addChapter({
      "start": 3000,
      "title": "Chapter 1",
      "description": "description for chapter 1",
      "thumbnail": "//www.movingimage.com/wp-content/uploads/2019/08/movingimage-Enterprise-Video-Platform.jpg"
    })

In this example, the code will add a new chapter at 00:03 with the given title, description and thumbnail.



updateChapter

Use this method to update an existing chapter dynamically. A chapter can be identified using its start time.

updateChapter(millis, {"start": millis, "title": chaptertitle,"description": chapterdescription,"thumbnail": chapterthumbnail })


ParameterData typeDescription
millisintegerStart time for the chapter (given in milliseconds)
chaptertitletextChapter title to be displayed
chapterdescriptiontextDescription for the chapter (displayed beneath the title)
chapterthumbnailURLURL of the chapter thumbnail to be displayed


Sample usage:

VideoPlayer.Collection.getPlayerById("player_container_id").updateChapter(3000, {
      "start": 3000,
      "title": "Chapter 3",
      "description": "description for chapter 3",
      "thumbnail": "//www.movingimage.com/wp-content/uploads/2019/08/movingimage-Enterprise-Video-Platform.jpg"
    })

The code above will update the chapter that starts at 00:03.


Partially updating chapters is also possible. Using the same method, you can pass only the properties that should be updated.

VideoPlayer.Collection.getPlayerById("player_container_id").updateChapter(3000, {
      "title": "Chapter 5",
    })



deleteChapter

Use this method to delete an existing chapter.  Enter the start time of a chapter, and it will delete all the chapter(s) that start at that time.

deleteChapter(millis)
ParameterData typeDescription
millisintegerStart time for the chapter (given in milliseconds)

Sample usage:

VideoPlayer.Collection.getPlayerById("player_container_id").deleteChapter(3000)


The code above will delete the chapter that starts at 00:03.