Closed fvilpoix closed 3 years ago
That is because only the hlsjs plugin provides detailed level information, native HLS does not, the same as there is no native manual quality switch (no JavaScript interface). For the latter you can however query the size of the video element, for the former use the api of the hlsjs plugin. This demo http://demos.flowplayer.org/api/hlsjs.html does exactly that for the VOD example, check the code here: http://demos.flowplayer.org/api/hlsjs.html#javascript-setup
Please consider asking usage questions in our public forum at https://flowplayer.org/forum/ - they are of common interest, and therefore that's only fair towards other users. Thank you.
Thank you for your answer, the trick does the job.
But I still see it as a bug or a feature request. In my opinion, engines are just abstraction layer to handle different video formats, and the public API should provide a unified interface to get data elements regardless of the engine.
var height = api.video.height;
is far better and maintenable than
if (hls) {
// do long stuff
} else if (dash) {
// do a different long stuff
} else {
var height = api.video.height;
}
I agree entirely from the consistency point of view. However, in practice, the progress event is already expensive, it's fired every 250ms, and with the hlsjs (especially, because it does complete remuxing) and dash engines this risks to affact performance imho. Even using less frequent engine specific events for updating comes at a price. That's why we don't point blank replicate all hls.js or dashjs events as player events, see e.g.: https://github.com/flowplayer/flowplayer-hlsjs/issues/29 - I certainly like this from a consistency point of view either.
The consistency of information is limited anyway because the MSE engines by nature can provide much more information due to their required extra work.
Re-opening for comment, @nnarhinen.
Indeed, the hlshjs library is a bit verbose :) Of course it's a bad idea to propagate internal events of sub-libraries threw flowplayer, and it's not its job as long as the engines are accessible.
But for data related directly to the media that are accessible from flowplayer, maybe it worths the event subscription to update it in flowplayer. I think about video width/height/bitrate, which changes on hls/dash quality switch only, but perharps there are others.
bitrate is not available in native HLS ;-)
Leaving aside Flash HLS:
videoWidth
and videoHeight
of the video tag@nnarhinen - what do you prefer:
[1]
For flashls there is HLSEvent.LEVEL_SWITCH
which we could listen to. But for native html5 there is no such event. I think for now the best way would be to query videoWidth
and videoHeight
when needed. The engines can of course update video.height
and video.width
whenever applicable but for html5 engine some timer would be needed and it IMO adds unnecessary overhead as the information is queryable if needed.
@nnarhinen - as per https://github.com/flowplayer/flowplayer/issues/1200#issuecomment-306141914 I agree.
I'll move this to the 7.2 milestone. Let's see if we come with a decent approach for that.
Hi,
I found that when I change the HLS quality (manually or programmatically), the API always returns the very first width/height of the video clip :
I tried on the HLS plugin demo page, with chrome/firefox last version on Ubuntu 16.04
Is there any other way to get the size of the actual file ?
Thanks a lot !