Erik Thuning 5b9f86cbf4 Fixed a bug caused by the chrome workaround for subtitles
Triggering recallSettings() on canplay events caused a bug where
linking to a timestamp made the player get stuck at that
timestamp. Fixing this involved two changes that may be individually
sufficient, but since I can't be sure I implement both:

 - switched the canplay event (which definitely triggers multiple
   times) to loadedmetadata (which hopefully only triggers once)

 - added a boolean flag to only call recallSettings() on the first
   trigger of the watched event
2026-09-25 13:15:00 +02:00
2022-08-10 17:13:26 +02:00

multiplayer.js - A custom HTML element for multi-stream video playback

This is a video player that plays multiple video streams at once, keeping them in sync based on elapsed playback time. The player is tested with up to 4 simultaneous streams, but should in principle support an arbitrary number.

Usage

To use the player, load multiplayer.js on the relevant page and use the <multi-player> tag to create a player. The player requires one of the following attributes to be set in order to function:

  • play: Absolute or relative URL to a file containing a package definition.
  • play-local: A string containing a package definition.

To activate playlist functionality, set one of the following attributes:

  • list: Absolute or relative URL to a file containing a playlist definition.
  • list-local: A string containing a playlist definition.

An arbitrary number of players can be placed on the same page.

Internationalization

The player defaults to English as its UI language. If the containing HTML document has a lang attribute, it is used to set the UI language in the player. Currently only supports English (en) and Swedish (sv).

URL parameters

The player will act on two URL parameters if they are present at page load:

  • t: A timestamp in seconds to start playback at
  • s: Subtitle activation

The s key can be used in two ways. It can simply be some truthy value, in which case the first available subtitle track is activated. The value can also be the name of a subtitle track, in which case that track will be activated. When specifying a track name, all spaces must be replaced with underscores.

S
Description
No description provided
Readme
924 KiB
Languages
JavaScript 100%