@meisterplayer/plugin-multisource

5.3.0 • Public • Published

MultiSource plugin for Meister

This plugin allows you to set multiple media types as one item. MultiSource automaticly choses the correct media type to play. It will start at the first item in the array and work it's way through the list until it finds an item that it can play.

MultiSource supports the standard item format so you can use any media item plugin with this plugin.

Getting started

Simply configure the plugin and use it in the setItem

Example:

var meisterPlayer = new Meister('#player', {
    MultiSource: {},
});

meisterPlayer.setItem({
    sources: [
        // We first want to try playing the Dash stream
        {
            src: 'INSERT_MPD_LINK_HERE',
            type: 'mpd',
        },

        // If that doesn't work on the current browser try HLS
        {
            src: 'INSERT_HLS_LINK_HERE',
            type: 'm3u8',
        },

        // Our last resort is to give the user a mp4 stream
        {
            src: 'INSERT_MP4_LINK_HERE',
            type: 'mp4',
        },
    ],
    type: 'multi-source'
});

meisterPlayer.load();

Item options

The following options are available for per item configuration.

drmConfig [Object] (default: undefined)

This plugin apply's the drm config on every item in sources so you don't have to configure each item stand alone. This plugin depend on the Drm plugin for Meister to work. Also see the README there for config options.

Example:

var meisterPlayer = new Meister('#player', {
    MultiSource: {},
});

meisterPlayer.setItem({
    sources: [
        // We first want to try playing the Dash stream
        {
            src: 'INSERT_MPD_LINK_HERE',
            type: 'mpd',
        },

        // If that doesn't work on the current browser try HLS
        {
            src: 'INSERT_HLS_LINK_HERE',
            type: 'm3u8',
        },
    ],
    drmConfig: {
        widevine: { ... }
        playready: { ... }
        fairplay: { ... }
    },
    type: 'multi-source'
});

meisterPlayer.load();

switchItemOnError [Boolean] (default: true)

Goes to the next item in the 'sources' array when the current item has thrown an error. (NOT_FOUND, CODEC_ERRORS, etc) This can be usefull for codecs that cannot be determined if it can play on the current device. Multisource will switch out the item with a new item so playback can continue.

Example:

meisterPlayer.setItem({
    sources: [ ... ],
    type: 'multi-source',
    switchItemOnError: false, // Will stop playback after an fatal error occured.
});

Readme

Keywords

Package Sidebar

Install

npm i @meisterplayer/plugin-multisource

Weekly Downloads

4

Version

5.3.0

License

Apache-2.0

Unpacked Size

45.3 kB

Total Files

16

Last publish

Collaborators

  • edwinmeijne
  • stefkampen
  • licensetriple
  • thomasvdam
  • i.toby
  • kajb
  • smashingpat
  • rtl-video