@oplayer/plugins
Playlist

Playlist

requirement @oplayer/ui

npm i @oplayer/ui @oplayer/plugins
import Player from '@oplayer/react'
import ui from '@oplayer/ui'
import { PlaylistPlugin } from '@oplayer/plugins'
 
Player.make('#player')
  .use([
    ui(),
    new PlaylistPlugin({
      initialIndex: 0,
      autoNext: true,
      sources: [
        {
          title: '君の名は - MP4',
          src: '/君の名は.mp4',
          poster: '/poster.png',
          duration: '01:32',
          thumbnails: {
            src: '/thumbnails.jpg',
            number: 100
          },
          subtitles: [
            {
              name: 'Default',
              default: true,
              src: '/君の名は.srt',
              offset: 2
            }
          ],
          highlight: [
            {
              time: 12,
              text: '谁でもいいはずなのに'
            },
            {
              time: 34,
              text: '夏の想い出がまわる'
            },
            {
              time: 58,
              text: 'こんなとこにあるはずもないのに'
            },
            {
              time: 88,
              text: '--终わり--'
            }
          ]
        },
        {
          title: 'Big Buck Bunny - HLS',
          src: 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8',
          duration: '10:34'
        },
        {
          title: 'DASH',
          src: 'https://dash.akamaized.net/akamai/bbb_30fps/bbb_30fps.mpd',
          duration: '10:34'
        },
        {
          title: 'FLV',
          src: '/op.flv',
          duration: '00:17'
        }
      ]
    })
  ])
  .create()