Intégration du lecteur vidéo

  Désolé, cet article est disponible en anglais

1. The player's script is simple placed in the <head> tag of the page.
<script src="//site.com/playerjs.js" type="text/javascript"></script>

2. Integration code for player container

<div id="player"></div>

<script>
   var player = new Playerjs({id:"player", file:"//site.com/video.mp4"});
</script>

All settings are in the builder, so only the id is required (can be changed to any other instead of player).

Other variables that may be useful:

file URL to a file video or audio, playlist, HLS, DASH, YouTube or Vimeo
poster URL to the image that will be displayed on screen before starting
title inscription or title
autoplayautoplay (1 or 0)
startstart playback from the specified second
endend playback on the specified second
duration duration in seconds, if the player does not preload metadata
subtitle URL of subtitle

Javascripts are perfectly cached by the browser, so for critical updates, it is worth dumping the cache by simply renaming the file (remember to change the name in the embed code):

playerjs.js -> playerjs1.js

Asynchronous way

The player script can be loaded asynchronously from version 9.33.

<script src="//site.com/playerjs.js" type="text/javascript" async></script>

In this case the player code must be wrapped in the PlayerjsAsync function. Please note that there can only be one such function per page.

function PlayerjsAsync(){
   player = new Playerjs({...});
}

Other methods

Integration with iframe

Replacing standard video and audio tags

Cloud hosting

Example for Vue.js

Wordpress plugin


20.0.0
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