-
Notifications
You must be signed in to change notification settings - Fork 425
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
add an option to ignore player size in selection logic #238
Conversation
💖 Thanks for opening this pull request! 💖 Things that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
src/playlist-selectors.js
Outdated
@@ -217,6 +230,7 @@ export const simpleSelector = function(master, | |||
resolutionPlusOneList = haveResolution.filter( | |||
(rep) => rep.width > playerWidth || rep.height > playerHeight | |||
); | |||
console.log('resolutionPlusOneList', haveResolution, resolutionPlusOneList, playerWidth, playerHeight); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there's logging left over from debugging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep you right. removed it.
Seems reasonable to me, @gesinger thoughts? |
bandwidthBestRep || | ||
enabledPlaylistReps[0] || | ||
sortedPlaylistReps[0] | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll need a newline here to fix linting errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea so like I got a ton of linting errors relating to exceeds the maximum line length of 90
, Don't make functions within a loop
and Unexpected "todo" comment
so I admittedly ignored all of them and just opened a PR... sorry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries, when we update our linter I think it should be more clear which of those is a linter error and just a warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! This is definitely a nice flag to have.
README.md
Outdated
* Type: `boolean` | ||
* can be used as an initialization option | ||
|
||
When `ignorePlayerSize` is set to true, selection logic will ignore the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
selection logic => rendition selection logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
README.md
Outdated
* can be used as an initialization option | ||
|
||
When `ignorePlayerSize` is set to true, selection logic will ignore the | ||
player size and rendition resolutions when making a decision. This should |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The should part here is a bit unclear to me, but I may not fully understand the scenario. Any more details on that part?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am opening this PR because I had a customer using our per-title encoding solution which is marketed at https://mux.com/per-title-encoding/ and described in all kinds of fun technical detail at - https://mux.com/blog/per-title-encoding-scale/ - a specific video was seen to never play anything "reasonably good looking" given the generated rendition set which I put in the unit tests. most people in the industry would look at that ladder and say "what?" so I wrote this comment. but since the comment had a "what?" response, I guess I'll delete it. 😄
README.md
Outdated
@@ -333,6 +333,16 @@ When `enableLowInitialPlaylist` is set to true, it will be used to select | |||
the lowest bitrate playlist initially. This helps to decrease playback start time. | |||
This setting is `false` by default. | |||
|
|||
##### ignorePlayerSize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In terms of naming, I think it might be a bit easier to use a positive and have it be true by default. Also maybe a bit more precise for rendition selection. Maybe something like limitRenditionSelectionByPlayerDimensions
, though that name could be too long.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am more than happy to name this anything the maintainers like. just let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go with limitRenditionByPlayerDimensions
, default to true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe I have updated all of the things!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment wording, but otherwise LGTM
oo there seems to be something wrong according to the tests... taking a look... |
maybe something is wrong in the defaults here, despite the unit tests saying they work, I saw a bunch of behavior that indicated that |
src/videojs-http-streaming.js
Outdated
@@ -335,6 +332,7 @@ class HlsHandler extends Component { | |||
setOptions_() { | |||
// defaults | |||
this.options_.withCredentials = this.options_.withCredentials || false; | |||
this.options_.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions || true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wont this always be true? In which case this option wont take affect if you set this to false in the player options instead of source options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c2f70e0
to
9b24234
Compare
patched the silly mistake that @forbesjo found, fix the test that I misconfigured making be believe it was working correctly when it wasn't, and now I think its ready for another look. thanks!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. @gesinger do you agree?
@@ -261,7 +275,8 @@ export const lastBandwidthSelector = function() { | |||
return simpleSelector(this.playlists.master, | |||
this.systemBandwidth, | |||
parseInt(safeGetComputedStyle(this.tech_.el(), 'width'), 10), | |||
parseInt(safeGetComputedStyle(this.tech_.el(), 'height'), 10)); | |||
parseInt(safeGetComputedStyle(this.tech_.el(), 'height'), 10), | |||
this.limitRenditionByPlayerDimensions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and below, I don't think this value will ever be set, since limitRenditionByPlayerDimensions
is set within the options_
object property and not on the HlsHandler
instance directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really should have spent some more time running the code via the debugger to make sure things were getting passed around. I did some more testing using this m3u8 which I created with Mux per title encoding - https://stream.mux.com/d3dYsgwvtxk101D6ExK3HuoKe3aps9IIA.m3u8 - you can pretty clearly spot the difference on the test page when setting limitRenditionByPlayerDimensions: false
if you use this manifest.
this is my first PR for this repo so I was all like...
I'm going to update your contribution guidelines with some learnings from this process in another PR
Description
Some modern encoding techniques target the best quality at a given bitrate, to some extent irrespective of resolution. In such scenarios, users should be able to tell the player that the player size should be ignored during rendition selection in order to favor a pure bandwidth based decision which will maximize quality for the playback.
Specific Changes proposed
limitRenditionByPlayerDimensions
configuration option which can be set to false to ignore resolutions when doing rendition selection.Requirements Checklist