clappr / clappr-level-selector-plugin

Clappr Level Selector Plugin
MIT License
76 stars 56 forks source link

How to append source list dynamically? #24

Open mikeevstropov opened 8 years ago

mikeevstropov commented 8 years ago

like this:

[
    { 'src' : 'http://example.com/playlist1-1/index.m3u8', 'label' : '720p' }
    { 'src' : 'http://example.com/playlist1-2/index.m3u8', 'label' : '1080p' }
]

If you have example please show it. Thank you!

me-vlad commented 8 years ago

ref: https://github.com/clappr/clappr-level-selector-plugin/issues/23

mikeevstropov commented 8 years ago

Now i'm using this way:

var player = new Clappr.Player({
    parentId    : '#player',
    autoplay    : false,
    sources     : [
        'http://example.com/source1/index.m3u8',
        'http://example.com/source2/index.m3u8',
        'http://example.com/source3/index.m3u8'
    ],
    plugins     : { 'core': [LevelSelector] },
    levelSelectorConfig: {
        labels: {
            3 : '1080p',
            2 : '720p',
            1 : '480p',
            0 : '360p'
        }
    },
});

But in bitrate list i see only first src.

gabrielirdeb commented 8 years ago

I have the same issue here, anyone ?

leandromoreira commented 8 years ago

@mikeevstropov and @gabrielirdeb I don't this is a "real" issue, at the best we can see this as a new feature. In theory your variant (master) playlist should be generated in your server, this would provide a smooth playback change.

Besides, this also raises a lot of questions about the expected behavior:

    sources     : [
        'http://example.com/source1/index.m3u8',
        'http://example.com/source2/index.m3u8',
        'http://example.com/source3/index.m3u8'
    ],

How should we handle this sources?

Maybe we could force a list of qualities (this might be very easy to do), what do you think @clappr/core ?

    levelSelectorConfig: {
        levels: {
            [label: '1080p', src: ''http://example.com/source1/index.m3u8''],
            [label: '1080p', src: ''http://example.com/source1/index.m3u8''],
            [label: '1080p', src: ''http://example.com/source1/index.m3u8''],
            [label: '1080p', src: ''http://example.com/source1/index.m3u8'']
        }
    },
me-vlad commented 8 years ago

@leandromoreira , @clappr/core +1 for quality list option May be it helps to define avaliable levels for native HLS? https://github.com/clappr/clappr-level-selector-plugin/issues/23

leandromoreira commented 8 years ago

that's right @me-vlad what do you think @cowai ?

towerz commented 8 years ago

I agree with @leandromoreira, this would fit better as a specific level selector option. Since the sources parameter is handled by a separate plugin, this would cause a number of weird conflicts that we could avoid by handling this separately.

Taking the suggested config, the plugin could switch sources using load() by itself, and providing an initial seek value, thus avoiding conflicts with other plugins.

ariselseng commented 8 years ago

@leandromoreira This seems like a good solution. By defining it in the plugin we can write our own hls parsers to pass to the plugin. Nice and clean.

leandromoreira commented 8 years ago

I made a #30 for it after that we also need to provide the documentation, this also relies at clappr PR (which I'm doing now :P )

    levelSelectorConfig: {
        levels: [
            {id: 0, label: '1080p', src: "http://example.com/source1/index.m3u8"},
            {id: 1, label: '1080p', src: "http://example.com/source1/index.m3u8"},
            {id: 2, label: '1080p', src: "http://example.com/source1/index.m3u8"},
            {id: 3, label: '1080p', src: "http://example.com/source1/index.m3u8"}
        ]
    }
leandromoreira commented 8 years ago

It is not so simple as I thought

ariselseng commented 8 years ago

@leandromoreira Any news on this?

leandromoreira commented 8 years ago

@cowai I tried once but then I saw it's not easy... ;/ I'll try that later, the problems rises while you trying to change container (and it gets worst on mobile)

gabrielirdeb commented 8 years ago

Any news on this?

leandromoreira commented 8 years ago

We didn't have time yet to see =/ I'm sorry