简体   繁体   中英

How to add previous and next buttons in video.js

I hope to know how to add previous and next buttons around play button on video.js controlBar.

When I check the controlBar functions, it seems there are not functions to point the position of custom button which added, and only exists such as addChild or appendChild functions, so now I am only writing as below.

this.controlBar.el().appendChild(nextButton.el());

So I am eager to know how to add custom button such as previous or next button into certain order, in my case, just before or after play button.

Please help me!!!

You can use insertBefore() here. Use this to insert a control after the first child, ie the play button:

player.controlBar.el().insertBefore(button.el(), player.controlBar.el().firstChild.nextSibling)

Or this to insert it before it:

player.controlBar.el().insertBefore(button.el(), player.controlBar.el().firstChild)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM