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
Major Refactor reduces complication, increases dependability and solve critical bugs. #1523
Conversation
… store init segments for switching.
…priority for events with same type
…a request, simplifed buffercontroller and schedulecontroller post VB removal
…ntModel to es6 syntax
…a type so I may persist the model through track and period changes. Major es5 cleanup and some notes.
@bbcrddave @LloydW93 or anyone else, Maybe you can check this out would love to get some eyes on it. I am going to run BBC browserstack test soon to see if results are same or better... |
@@ -131,16 +129,15 @@ function BufferController(config) { | |||
eventBus.on(Events.PLAYBACK_RATE_CHANGED, onPlaybackRateChanged, this); | |||
eventBus.on(Events.PLAYBACK_SEEKING, onPlaybackSeeking, this); | |||
eventBus.on(Events.WALLCLOCK_TIME_UPDATED, onWallclockTimeUpdated, this); | |||
eventBus.on(Events.CURRENT_TRACK_CHANGED, onCurrentTrackChanged, this); | |||
eventBus.on(Events.CURRENT_TRACK_CHANGED, onCurrentTrackChanged, this, 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.
EventBus should probably export some consts rather than using magic numbers - it isn't clear what priority 0 is.
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.
If we do something like states of priority CONST the question is, is that scalable? What happens if there are five preset states of priority but then the use of an event type grows to 6 listeners and you need all six in a certain order. I opted for a pure int based system which is limitless so I want to see how we can make this more clear as I do agree this needs some help. However in most other event systems I have used it is the reverse, Higher number holds more priority.
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.
It may be nice to have a few preset priorities that the library uses with plenty of space between them. Then third party developers and others in the library can have flexibility to adjust as needed.
Something like:
const priorities = {
low: 0,
normal: 200,
high: 500
}
Obviously if we have need for more than those we can adjust, but at least that gives people some indication of where we're at.
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.
This also has the benefit of resolving the "is 0 low or high" question by adding some labels to at least a few numbers.
Great effort Dan! |
Thanks Dave! Thanks for the great code review. I’ll fix all the commented items but we should discuss event priority and how to make it most useful and clear. I do want to keep that in. Thanks again for taking the time! Dan From: David Evans notifications@github.com Great effort Dan! — |
if (fragmentModel) { | ||
fragmentModel.reset(); | ||
fragmentModel = null; | ||
} |
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.
Why does the fragmentModel
no longer need to be reset or nulled out? It's still being setup in the initialize
method.
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.
It is cleaned up in FragmentController and persisted over new creations of schedule controller. It is using the same one if it exists in the init of schedule controller.
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.
Gotcha fair enough. I saw the .create
for RepresentationController
above and below this and assume we were creating FragmentModel
... but we're not. So disregard
Gotta love when you remove > 2x the code added and things get better 👍 |
… for priority added default param, refactored a bit and added off for new listener in schedule controller.
@bbcrddave @boushley if you get a chance check out 97673f7 |
This looks good. Much clearer what priority is low and what is high. Looking good 👍 |
Thanks guys. I am going to do some deep browsers os testing today and make sure all is well then merge by end of week hopefully! |
…le controller. Data change / Stream init handlers would allow media type to cross and pollute the representation info usually of audio. Fixed buffer target access for metrics in buffer controller. Removed unused items in buffer controller and fixed in proper init of objects.
👏 |
This is a big change that just all keep creeping due to the original task; which was to solve issue #1365 and remove the Virtual Buffer. This task is complete!
That lead to multi-track changes since multi-track depended on VB. This lead to a refactor of buffer controller and schedule controller. But.....
While doing this @spiterikevin noticed duplicate loading in certain cases so I set out to fix that as well. This changed solved the duplicate issue and should solve #1205 as well!!
Then issue #1514 was reported and this solution for this fit into the current work for fragmentModel and multitrack... so It is also fixed and part of this PR.
Some of the line changes are really just es6 conversion. E.g use of const to improve readability and efficiency.
I have tested this code and reviewed it extensively.! Please review if you have time!