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

Cannot set properties of null (setting 'currentTime'), when transition #15053

Open
Plikard opened this issue Jan 18, 2025 · 6 comments
Open

Cannot set properties of null (setting 'currentTime'), when transition #15053

Plikard opened this issue Jan 18, 2025 · 6 comments

Comments

@Plikard
Copy link

Plikard commented Jan 18, 2025

Describe the bug

When playing audio HTML element with binded currentTime value becomes hidden with transition, the Svelte still tries to set the value of the now missing property (while animated), which results in an error Cannot set properties of null.

Reproduction

Full example: REPL

Press play and then hide the player

Logs

System Info

Chrome 131

Severity

annoyance

@gyzerok
Copy link

gyzerok commented Jan 19, 2025

This is a continuation of #15008

@paoloricciuti perhaps you might want to take a look, since you fixed the first one

@paoloricciuti
Copy link
Member

Yeah I took a quick look, I think I know what's happening but I need to figure that out at the desk

@paoloricciuti
Copy link
Member

Uhm actually...i don't think there's much we can do here. What is happening is that by using a transition you are delaying the unmount of the element from the DOM. So the audio keep playing and the time keeps changing. But since you are binding to a variable that is now null it errors out.

But when you have a transition the element needs to stay, and as long as an element is in the dom the bind needs to still be applied (especially because you could write to an external variable which is not affected by the if).

Imagine for example a situation like this...would you expect the time to not update while the transition is playing?

@gyzerok
Copy link

gyzerok commented Jan 20, 2025

Maybe I am missing something, but the audio shouldn't be playing because we paused it before unmount since we pressed stop

@paoloricciuti
Copy link
Member

Maybe I am missing something, but the audio shouldn't be playing because we paused it before unmount since we pressed stop

You never actually paused the audio...you rely on the removal of the element from the Dom for it to stop but if you are using a transition that happens after the transition

@mrkishi
Copy link
Member

mrkishi commented Jan 20, 2025

They tried to pause through the paused binding, but it does behave a little weird: it seems like the bindings' gets keep running during transitions, but not sets... sometimes.

In this version, try jumping after pausing, while the outro is still playing. It works if you pause through the audio native controls, but not through the <button>—even though both triggered the transition by setting playing = false.

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

5 participants