Liste personnalisée dans le menu des paramètres

  Désolé, cet article est disponible en anglais

Hi, I wanted to ask if adding custom download buttons to options menu (under the kogwheel) is possible. I wanted to create buttons like "Download as MKV", "Download as MP4", "Download Subttiles" and pass the link to given file as an argument.

You can add your custom list to the settings menu in the PRO version. Just select Custom menu in one of the items.

In this case, the player will add the MyOption item to the menu with a choice of three options (One, Two and Three).

If you want to make one option without a list, provide just a title.

ow to specify an action

When you click on this item in such a menu, the player will access the global function PlayerjsMenu1 and pass the player id, the name of the selected menu item, and the sequence number of this option as arguments. Then you can use any JS API commands in this function.

function PlayerjsMenu1(id,title,num){
   console.log(id,title,num);
}

You can also specify the API command directly in the option title Title->api:command:option

Playback:Play->api:play,Pause->api:pause
Seek hotkey step:5->api:seekstep:5,10->api:seekstep:10,15->api:seekstep:15
Skin:Red->api:design:1,Blue->api:design:2,Black->api:design:3

How to set the default value

By default, the player selects the first value. But you can specify another by adding options (*) to the name

MyOption:One,Two(*),Three

You can also set the default value in the player code using the menu1 option with the number of the desired option (0,1,2, etc.).

let player = new Playerjs({id:"player", file:URL, menu1:0});

You can also specify the value -1 if there is no single value to choose from in the list and there is no need to mark the current position.

API

You can set the desired value via the API

player.api("menu1",0);

And also get the current value:

player.api("menu1");

20.0.1
2024 © PlayerJS

S'inscrire gratuitement

S'inscrire
En vous inscrivant, vous acceptez les Termes de service
Login si vous avez un compte.

Restaurer le mot de passe

Restaurer
Vous avez oublié votre adresse électronique ? Contactez-nous