播放列表

  抱歉,这篇文章有英文版

Playlist is a listing of sources for playback (for example, a collection of series). It specified in code in file parameter.

var player = new Playerjs({
   id:"player",
   file:[
      {"title":"Title","file":"URL"},
      {"title":"Title","file":"URL"}
   ]
});

You can provide URL to playlist inside text file (file extension is .txt, check cross-domain policy). If you can't use extension txt, try to pass playlist by parameter pl instead file. From version 9.50 you can specify backup links for playlists pl.txt or pl2.txt

var player = new Playerjs({id:"player",file:"http://site.com/playlist.txt"});

Format

The object is enclosed in square brackets, inside the JSON collection  with the following parameters:

The playlist is specified in JSON format. It is enclosed in square brackets, a collection of records with parameters:

title text*
file file URL*
poster image URL
subtitle subtitle URL
folder folder object
id ID for file search

* required

If the player shows a JSON error, then the document format is incorrect. In such cases, you can use any online JSON validator to fix it.

Folders

Playlist can contain folders

[
   {"title":"Season 1","folder":
      [
      {"title":"Serie 1/1","file":"URL"},
      {"title":"Serie 1/2","file":"URL"}
      ]
   },
   {"title":"Season 2","folder":
      [
      {"title":"Serie 2/1","file":"URL"},
      {"title":"Serie 2/2","file":"URL"}
      ]
   }
]

By default, the first file opens in the playlist. If it is placed in a folder, it will also automatically open. To avoid this, enable the Open playlist option in the top level in the settings of the plugin Playlist in builder.

Playlist editor

We made a special editor for quickly creating playlists using the interface.

You can download the result as a txt file, copy as a JSON and use it in the builder Settings / File to play / My playlists

You can also use a php-script to generate playlists from the file structure.

Search by id

If can specify each file in playlist with unique id and use search to launch the desired file by parameter plstart.

[
   {"title":"Serie 1","file":"URL","id":"s1"},
   {"title":"Serie 2","file":"URL","id":"s2"},
]
var player = new Playerjs({id:"player",file:"playlist.txt",plstart:"s2"});

Serie 2 starts after launching in this example.

Design

You can setup design of playlist in builder Plugin / Playlist

To make the playlist appear in the builder, you need specify it in the Settings / File

You can access the playlist in DOM (for CSS or for removing to some outside container). If the player have ID player123, then the playlist have ID player123_playlist

Memorizing

How to remember the played files in the playlist

Switching

You can enable buttons in the builder to switch files in the playlist. You can add a next:1 parameter for files in the playlist that you want to skip when switching files.

Automatic switching of playlist tracks can be enabled in the Plugins / Playlist settings Autoplay the next file

Start time

You can specify the start second with the start parameter

{"title":"1","file":"//site.com/video.mp4","start":10}

You can also start from the current second when switching from another file by specifying the value "start":"continue" (relevant for switching audio versions in playlists). You can also use other time-limiting variables.

Redirect

You can enable the Plugins / Redirect / Redirect in the playlist and use the redirect option

[{"title":"1", "file":"video1.mp4", "redirect":"site1.com"},{"title":"2", "file":"video2.mp4", "redirect":"site2.com"}]

In this case, the redirect to the specified link will occur after clicking on this position in the playlist.

M3u support

The player from version 9.21 supports playback of playlists with the m3u extension, if the links are full (start with https) and all cross-domain policy conditions are met.


20.0.6
2024 © PlayerJS

登录

登录

免费注册

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

恢复密码

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