SRGSSR / pillarbox-web-suite

A suite of plugins, themes, and components for pillarbox-web
https://srgssr.github.io/pillarbox-web-suite/
MIT License
4 stars 0 forks source link

feat(playlist): add optional ui for the playlist plugin #9

Closed jboix closed 4 months ago

jboix commented 4 months ago

Description

Resolves #8 by adding an optional a modal that contains a simple playlist with controls such as enable/disable repeat, previous and next buttons, and the ability to select items from the list directly.

How to Activate the UI

To activate the optional UI for the playlist plugin, you need to add the PillarboxPlaylistButton to the control bar of your Video.js player. Here’s an example:

import videojs from 'video.js';
import '@srgssr/pillarbox-playlist';
import '@srgssr/pillarbox-playlist/ui';

// Initialize the Video.js player
const player = videojs('my-video', {
  plugins: {
    pillarboxPlaylist: { autoadvance: true, repeat: true },
     // Add the PillarboxPlaylistButton just before the fullscreenToggle button
    pillarboxPlaylistUI: { insertChildBefore: 'fullscreenToggle' }
  }
});

// Define your video sources
const playlist = [
  {
    sources: [{ src: 'https://www.w3schools.com/html/mov_bbb.mp4', type: 'video/mp4' }],
    data: { title: 'Big Buck Bunny', duration: 10 }
  },
  {
    sources: [{ src: 'https://www.w3schools.com/html/movie.mp4', type: 'video/mp4' }],
    data: { title: 'Sample Video', duration: 12 }
  }
];

// Load the playlist into the player
player.pillarboxPlaylist().load(playlist);

Changes Made

Checklist

github-actions[bot] commented 4 months ago

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 93.81% 850 / 906
🔵 Statements 93.81% 850 / 906
🔵 Functions 93.75% 60 / 64
🔵 Branches 92.3% 84 / 91
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
packages/pillarbox-playlist/src/pillarbox-playlist-button.js 100% 100% 100% 100%
packages/pillarbox-playlist/src/pillarbox-playlist-menu-item.js 100% 100% 100% 100%
packages/pillarbox-playlist/src/pillarbox-playlist-modal.js 96.8% 96.15% 95.23% 96.8% 223, 241-247
packages/pillarbox-playlist/src/pillarbox-playlist-ui.js 0% 0% 0% 0% 1-43
packages/pillarbox-playlist/src/pillarbox-playlist.js 98.52% 89.18% 95.23% 98.52% 82-85, 300
packages/pillarbox-playlist/src/lang/index.js 100% 100% 100% 100%
Generated in workflow #47
github-actions[bot] commented 4 months ago

PR Preview Action v1.4.7 :---: Preview removed because the pull request was closed. 2024-05-28 13:01 UTC

github-actions[bot] commented 4 months ago

:tada: This PR is included in version @srgssr/pillarbox-playlist-v1.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] commented 4 months ago

:tada: This PR is included in version @srgssr/skip-button-v1.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: