动态链接

  抱歉,此页面正在等待翻译成土耳其语

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.

If you plan to use AJAX inside this function, please use the synchronous request.

function GetFile(id){
   let url;
   let xhr = new XMLHttpRequest();
   xhr.open('GET', 'script.php?id='+id, false);
   xhr.onreadystatechange = function() {
      url = xhr.responseText;
   }
   xhr.send();
   return url;
}

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


19.10.26
2024 © PlayerJS

登录

登录

免费注册

注册
注册即表示您同意服务条款
登录(如果您有帐户)

恢复密码

恢复
忘记电子邮件?联系我们