How to dynamically set sources for playback

You don't need to specify links to video or audio in the player's connection code or playlist, but pass them to the player each time before starting a new file. To do this, just specify the name of the JS function or variable with js: at the beginning instead of the reference.

var player = new Playerjs({id:"player", file:"js:GetFile()"});

In this example, the player will request your JS GetFile function, which will return a link to the file to play. Similarly you can use this method in playlists:

var player = new Playerjs({id:"player",file:[{"title":"1","file":"js:GetFile(1)"},{"title":"2","file":"js:GetFile(2)"}]});

This method works with version 12

2021 © PlayerJS


Restore password
Sign up
Log in

Sign up free

Sign up
By signing up, you agree to Terms of Service
Login if you have an account


Your name
Order player

Restore password

Forgot email? Contact us