Lista de reproducción exterior

  Lo sentimos, este artículo está disponible en inglés

The playlist from the player can be moved to the outer container. Firstly you need to catch init event when the player is ready to work with the API. Then create a player with a playlist and move it.

<div id="player1"></div>
<div id="playlist_container"></div>
<script>
   document.getElementById("player1").addEventListener("init",PlayerInit);
   var player = new Playerjs({
      id:"player1",
      file:[
         {"title":"1",file:"//site.com/1.mp4"},
         {"title":"2",file:"//site.com/2.mp4"}
      ]
   });
   function PlayerInit(){
      player.api("moveplaylist","playlist_container");
   }
</script>

Important points

  • If you want to catch init event with a listener, you need to enable the option Plugins / API / Events tracking / Use listeners
  • Navigation arrows do not move with the playlist. They can disabled it in the settings Plugins / Playlist / Scroll arrows and make your own if you need.
  • The playlist button must also be turned off (in the Elements section).
  • The player continues to interact with the playlist after moving.
  • Read more about playlist

Demo


How to make buttons for navigation

The playlist is available in the DOM by the playerid_playlist id, where playerid is the id of the player. If the player has id = player, then the playlist object can be accessed at player_playlist.

An example with buttons for a horizontal playlist (using jquery):

var playlist = $("#player_playlist");
$(".right_scroll_button").click(function() {
   playlist.animate({
      scrollLeft: playlist.scrollLeft()+100
   }, 500);
});
$(".left_scroll_button").click(function() {
   playlist.animate({
      scrollLeft: playlist.scrollLeft()-100
   }, 500);
});

You can adjust the speed if you change the numbers in the code (100 is the number of pixels to scroll, and 500 is the time of the animation).

An example with buttons for a vertical playlist (using jquery):

var playlist = $("#player_playlist");
$(".up_scroll_button").click(function() {
   playlist.animate({
      scrollTop: playlist.scrollTop()-100
   }, 500);
});
$(".down_scroll_button").click(function() {
   playlist.animate({
      scrollTop: playlist.scrollTop()+100
   }, 500);
});

20.0.0
2024 © PlayerJS

Inicio de sesión

Conectarse

Regístrate gratis

Inscríbete
Al registrarte, aceptas Condiciones del servicio
Iniciar sesión si tienes una cuenta.

Restaurar contraseña

Restaurar
¿Ha olvidado su correo electrónico? Contacte con nosotros