-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Make buffered/played/seekable attributes of media element bindable #819
Make buffered/played/seekable attributes of media element bindable #819
Conversation
Not sure why CI fails. Looks like an unrelated issue. |
Oh, I think the tests are failing because some stuff is out of date, and is fixed in #815. I'll merge that and we can try again. Thanks for the PR! I haven't dealt with media events in a little while, so this is likely a misunderstanding on my part, but is the |
Yes, it's necessary when rendering the supplied time ranges in the UI. Without it, the browser probably can't cope with all the updates and the audio starts cracking. |
I've had some time to look at this a bit more closely. My feeling is that we probably want to avoid We could probably update As for A nice optimisation might be to only update when the time ranges have actually changed (though avoiding The fact that [[0, 201.698]] From there, it would be relatively straightforward to avoid another update if the next set of ranges is also What do you reckon? |
It's already using the progress event for buffered. You probably overlooked that.
Yeah I think that's a good optimization.
Also agreed.
They basically confirmed that in their spec.
Actually I don't do that. Please see this gist for an example. Click on the progressbar to see the
I'm not sure. How do you think we shall go on from here? |
Didn't overlook — just saying you don't need
Yeah, you kind of do 😀 In your updateColor(color) {
this.ranges.forEach((range) => range.set({ color }));
} ...because you can't use <div>
{{#each ranges as range}}
<TimeRange start={{range.start}} end={{range.end}} :color :duration :cursor on:seek/>
{{/each}}
</div>
<style>
div {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
</style>
<script>
import TimeRange from './TimeRange.html';
export default {
components: {
TimeRange,
},
data() {
return {
duration: NaN,
list: [],
cursor: 'auto',
};
}
};
</script> That seems like an unambiguous win.
Let me poke around with this branch locally for a bit. An aside — you don't need to bind observers, they're called with the component as context: // these are equivalent
this.colorObserver = this.observe('color', this.updateColor.bind(this));
this.colorObserver = this.observe('color', this.updateColor); (Though that will be moot once these changes are made.) |
Shit, accidentally merged! Will open a new PR with the changes, once they're done |
remove requestAnimationFrame stuff, convert time ranges to {start, end} objects
Hello ~5 year old thread! I just stumbled across this PR after trying to understand when the svelte I made a REPL to help show what I mean. To me, it looks like updating What ever the case,
can't be said enough, lol |
I need this for a little side project of mine.
It's hard to add tests as these three IDL attributes are readonly (the spec for testing the existing
currentTime
andduration
attributes is skipped for that same reason), but happy to provide a REPL/gist example once it's merged.