Jekyll One

Fulltext Search

xVideo (spoken: Cross Video) is a complete multi-media engine built on top of VideoJS. It gives every audio and video the same good-looking, skinnable player, and it adds a full playlist on top: a searchable, sortable list of media items that the viewer can play, rate, and continue from where they left off. It plays native mp3 audio files, three kinds of video: native video (mp4), YouTube video and HLS for streaming video data.

10-15 Minutes to read

Creator Instance

A creator instance of xVideo lets you create, load, and edit playlists with all available features. Usually, you set up only one xVideo creator (read-write instance) per website to handle playlist management.

The Creator starts out empty. Everything you add appears in the browser and stays there using the browser’s localStorage, not in the site’s YAML files. This makes it a good place to try out the module without changing any files.

Viewer instances

In contrast, all other xVideo instances are set up as read-only viewers. They can play video sources but cannot make any changes.

Creator Instance

Setup Guide

You do not write the player’s HTML — J1 generates it from your configuration. Still, it helps to know the parts a viewer sees, because the settings above map onto them.

The idea in one minute

A J1 xVideo instance is made of three things:

A player

Described in a YAML file. It has a short name (the id), and settings for how it looks and behaves.

A playlist

The list of media the player offers. Each player has its own. It can be filled from a file on your server, or by the viewer in the browser.

A page

One line on a content page puts the player there.

The settings come from three files. Each file only needs what it changes; everything else is taken from the file before it.

Table 1. The three configuration files
File Use it for

_data/modules/defaults/xVideo.yml

Reading only. Every setting with its default value and an explanation.

_data/modules/xVideo.yml

Switching the module on, and settings for all players of your site.

_data/modules/xVideo_control.yml

Your players: one entry per player.

Your first player in five steps

A short, practical guide to J1 xVideo: switch the module on, create a player, fill it with audio, video, YouTube and HLS streams, and place it on a page - all with a few lines of YAML.

Step 1: Switch the module on

In _data/modules/xVideo.yml:

settings:
  enabled:                              true

Step 2: Create a player

Add an entry to the players list in data/modules/xVideo_control.yml. Choose a unique id — letters, digits, and - only.

settings:
  players:
    - player:
      enabled:                          true
      id:                               my_first_player
      description:                      My first player
      playlist:
        preload:                        [ my-first-list.json ]
        type:                           cards
        cards:
          perRow:                       3

Step 3: Write a playlist file

Save a file my-first-list.json in the playlist folder /assets/data/apps/xVideo/playlists/lists. Each item needs a unique videoId and the address of the media in videoSrc. Everything else is optional.

[
  {
    "videoId":   "abcXYZ12345",
    "title":     "A YouTube video",
    "author":    "Some Channel",
    "videoSrc":  "https://www.youtube.com/watch?v=abcXYZ12345"
  },
  {
    "videoId":   "product-tour",
    "title":     "Product Tour",
    "author":    "Our Team",
    "videoSrc":  "/assets/video/product-tour.mp4"
  },
  {
    "videoId":   "podcast-ep-07",
    "title":     "Episode 7",
    "author":    "Our Team",
    "type":      "audio",
    "videoSrc":  "/assets/audio/podcast-07.mp3",
    "poster":    "/assets/image/podcast/cover-07.jpg"
  }
]

Step 4: Put the player on a page

On any AsciiDoc page, write the macro xVideo:: followed by the player id:

.My first player
xVideo::my_first_player[role="mb-4"]

Step 5: Build and look

Rebuild the site and open the page. You see the poster of the first item. Press play, or open the playlist with the button on the left of the header bar.

If you only see an empty box: check that the id in the macro is exactly the id in xVideo_control.yml, and that this player has enabled: true. The browser console names the missing player.

What xVideo can play

Table 2. Kinds of media
Kind What to put into videoSrc Good to know

Audio

The address of an mp3 file, for example /assets/audio/song.mp3.

Give it a poster (album cover). It stays on screen while the audio plays.

Video

The address of an mp4 file, for example /assets/video/clip.mp4.

Without a poster, xVideo grabs a frame from the video for you.

YouTube

A YouTube link, for example https://youtu.be/abcXYZ12345.

The poster comes from YouTube. Can be played as audio only.

HLS stream

The address of an .m3u8 file, for example https://example.com/live/master.m3u8.

Live TV and long films. Offers a quality menu when switched on.

All four kinds can be mixed in one playlist.

Four ways to fill a playlist

Preload a file

List one or more playlist files under playlist.preload of a player. They are loaded on every visit. This is safe: items the viewer already has — with their ratings and stop positions — are never overwritten or doubled.

Paste a link

Open the edit panel (the button on the right of the header bar) and paste a YouTube link, the address of a media file, or the address of a stream.

Drag and drop

Drop media files, a whole folder, a link from another web page, or a playlist file onto the dashed drop area at the top of the edit panel.

Import

In the edit panel, pick a playlist from your server (Import), or load a .json file from your computer (Import Playlist).

Dropped local files are not uploaded. A browser cannot copy a file to your web server. xVideo uses the name of a dropped file to point to the same file on your server, below an address you set in the drop block (or in the …​ menu of the drop area). The file must already be there. With the default settings, only links and playlist files are taken from a drop.

drop:
  media_base:                           /assets
  base_path:                            /video

Everything a viewer adds, rates or edits is stored in their browser only. To share a playlist with all visitors, build it in the browser, press Export Playlist, and put the exported file into your playlist folder.

Common recipes

Copy the keys you need into a player entry of xVideo_control.yml (for one player) or into xVideo.yml (for all players).

A read-only player (viewer)

The viewer can watch and browse, but not change anything.

ui_elements:
  edit_playlist_button:                 false
  playlist_edit_button:                 false
  playlist_delete_button:               false
  playlist_rate_button:                 false

YouTube as audio only

For music and podcasts on YouTube. Either offer a switch to the viewer:

audio_only:                             true
ui_elements:
  audioOnlySwitch:                      true

or play every YouTube item as audio, without a switch:

set_audio_only:                         true
ui_elements:
  audioOnlySwitch:                      false

Play only a part of each item

Start 12 seconds in, stop at 4:45, keep the picture dark until the start point, and fade the sound in:

startAt:                                00:00:12
endAt:                                  00:04:45
startAtDarkCheck:                       true
audioFadeIn:                            slow

The same values can be set for a single item in its playlist record, or by the viewer in the Edit Media Settings dialog. A value on the item always wins.

Let viewers download files

ui_elements:
  playlist_download_button:             true
  playlist_download_all_button:         true

Only plain mp3 and mp4 files can be downloaded. YouTube items and streams never show a download button.

Streams with a quality menu

videoJS:
  players:
    native:
      crossOrigin:                      anonymous
  plugins:
    qualityMenu:
      enabled:                          true

The quality menu appears only for HLS streams that offer more than one quality. Safari chooses the quality by itself and shows no menu.

Extra buttons in the control bar

videoJS:
  playbackRates:
    enabled:                            true
    values:                             [ 0.5, 1, 1.5, 2 ]
  plugins:
    skipButtons:
      enabled:                          true
    nextPrevButtons:
      enabled:                          true
    videoFilters:
      enabled:                          true

Several players on one page

Give every player its own entry and its own id, and place each one with its own xVideo:: line. The players do not share anything. Add this once to xVideo.yml, so the players do not compete for the keyboard:

settings:
  videoJS:
    plugins:
      hotKeys:
        enableInactiveFocus:            false

Only one browser tab plays at a time

settings:
  cross_page_sync:
    enabled:                            true

What the viewer gets

  • A header bar with the title of the current item, a button to open the playlist (left) and a button to open the edit panel (right).

  • A playlist as compact rows or as a grid of cards, with a search box and a sort control. Pointing at a poster shows the description of the item.

  • Star ratings, and a dialog to edit the details of an item.

  • Resume: an item continues where the viewer stopped last time.

  • Expiry dates: an item can be blocked from a set day on (field expiryDate), for example when a licence ends.

  • Short notifications for imports, exports and errors.

Good to know

Keep the nesting

A key at the wrong level is ignored without any message. Copy keys together with the lines above them, exactly as in the examples.

Lists are replaced

A list such as values: [ 1, 2 ] replaces the list of the defaults completely. It is never mixed with it.

Files from other servers

Media, streams and downloads from another server only work when that server allows it (CORS). Files on your own site always work.

The browser remembers

Ratings, stop positions and the viewer’s choices (list or cards, audio only, loop) are kept in the browser, per player.

Read more

The full manual xVideo User Guide describes every setting, the playlist fields, all playback features, and the JavaScript methods for advanced use.