Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlowPlayer - Quality Level Selection #124

Open
balderys opened this issue Oct 30, 2014 · 16 comments
Open

FlowPlayer - Quality Level Selection #124

balderys opened this issue Oct 30, 2014 · 16 comments

Comments

@balderys
Copy link

Hi mangui,

could you please confirm that automatic bitrate switching is done after the current HLS segment is played and the next segment is from new bitrate? Or the algorithm is waiting while the buffer is empty?

@mangui
Copy link
Owner

mangui commented Oct 30, 2014

automatic bitrate selection is performed each time a new segment needs to be downloaded, based on different params : current level, last dl bw, current buffer size, ...
it does not wait for the buffer to be empty to switch down

@balderys
Copy link
Author

Thank you a lot.

Another question is what is the best way how to manually force switch to another bitrate? And if I switch manually, will be the behaviour the same as automatic switch -> switch is performed at next segment? Can I force the switch (does not matter if there is rebuffering) and continue from the same position in live stream (I expect that no)?

@mangui
Copy link
Owner

mangui commented Oct 30, 2014

when manually switching (using hls.level = manual_level), switch will happen at next segment load, i.e. it will not interrupt any loading in progress.
if you want to force the switch at current pos, best is to force a seek after manually setting the level:

_hls.level = new_level;
_hls.stream.seek(current_pos);

@balderys
Copy link
Author

Actually what does it mean "each time a new segment needs to be downloaded"? Does it mean next segment which is going to be played or in terms of HLS is it fourth segment because I have to have at least 3 segments in playlist prepared in advance?

@balderys
Copy link
Author

Ok, but there is no current position in live stream if I'am correct?

@mangui
Copy link
Owner

mangui commented Oct 30, 2014

hls.position will return the current media position (relative to playlist start)
it is also valid for live stream with flashls

@remizovvv
Copy link

Hello, mangui!
Could you tell about the manual switch mod of your plugin? And can I switch bitrate by clicking on the html element?
'Bitrateselect' plugin has onStreamSwitch method, which I can initialize by custom function. But does your plugin has a similar methods?

@mangui
Copy link
Owner

mangui commented Nov 18, 2014

Hi @remizovvv
flashls provides API to trigger manual level switching, it is up to the player to use them.
if you are referring to FlowPlayer 'bitrateselect' plugin, it does not support flashls, a dedicated bitrate selection plugin would have to be written.

@remizovvv
Copy link

Thanks for the quick answer!
Yes, I use flowplayer) How can I use flashls API? Or this API for only connection between flashls and player ?

@mangui
Copy link
Owner

mangui commented Nov 18, 2014

it is an ActionScript API, so obviously you need to do some Flash/AS3 coding to interface with it

@remizovvv
Copy link

I mean, can I call javascript function which applies directly to flashls and switches bitrate?
If no, and I must call only flowplayer API function, could you tell me what I should do in this case:

Flowplayer (in my project) gets stream link (.m3u8 file) from third-party-server (I can't influence on the formation of this file). This file contains three stream links (.m3u8 too) with the different bitrates. Flowplayer allows manual switch the bitrate with the 'bitrateselect' plugin, but your plugin doesn't work with it. What should I do to manual switch bitrate in this situation?

Thank you for explanation!

@mangui
Copy link
Owner

mangui commented Nov 19, 2014

Hi @remizovvv
after relooking into it, it might be possible to use bitrateselect plugin straightaway, but it would require some modifications in flashlsFlowplayer.swf

basically flashlsFlowPlayer would have to report all available bitrates to FlowPlayer (it should fill bitrate info in Clip Object) , and also implement switchStream() method

@remizovvv
Copy link

Thanks for the answers, @mangui !
Now I know in what direction to think to solve my problem.

mangui added a commit that referenced this issue Nov 20, 2014
commented for now, just to give some hints
related to #124
@mangui
Copy link
Owner

mangui commented Nov 20, 2014

I dont have the bw to work on this now, but I just commited some commented codes that is reporting available bitrates to FlowPlayer.

with this code, FlowPlayer should in theory be able to detect available bitrates, and request bitrate switch,
then you need to implement switchStream()

https://github.com/mangui/flashls/blob/master/src/org/mangui/flowplayer/HLSStreamProvider.as#L468

NetStreamPlayOptions should indicate you the level on which you need to switch, through
NetStreamPlayOptions.streamName

see code triggering the level switch here : https://github.com/flowplayer/flash/blob/1caea54d3e7fa66b6496d556998052507a6d05a4/lib/common/src/actionscript/org/flowplayer/net/StreamSwitchManager.as#L73-L76

Cheers,
Mangui

@remizovvv
Copy link

What a surprise! Thank you very much!
Unfortunately, I'm not an expert on action script, but I'll try to understand.

@lerivin
Copy link

lerivin commented Feb 18, 2015

What are the parameters for bitrate switching? Our current player is always selecting the highest bitrate no matter the bandwidth available. Is there a previous setting that is remembered and always used?

my testing is done with Chrome's throttling and I've tried a few setting with no luck.

HLSSettings.capLevelToStage = true;
HLSSettings.startFromLevel = -1;

Any help/advice would be appreciative!

stevemayhew pushed a commit to stevemayhew/flashls that referenced this issue May 18, 2015
commented for now, just to give some hints
related to mangui#124
@mangui mangui changed the title Bitrate switching FlowPlayer - Quality Level Selection Jun 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants