extensions icon indicating copy to clipboard operation
extensions copied to clipboard

Lily/Video: Update volume functions to interact with the project volume

Open NexusKitten opened this issue 10 months ago • 13 comments

Resolves https://github.com/TurboWarp/extensions/issues/2033

Let the video's volume be affected by the project's volume (which can be manipulated through Scratch Addons and Sound Expanded).

The "volume of video" reporter has been updated to only return the video's personal volume, and does not take into account the project's volume.

https://github.com/user-attachments/assets/31dc0dca-23c2-488e-8ca0-a4725315e845

NexusKitten avatar Mar 13 '25 21:03 NexusKitten

I feel like it would be more efficient to iterate through all created videos rather than all skins

SharkPool-SP avatar Mar 13 '25 22:03 SharkPool-SP

I feel like it would be more efficient to iterate through all created videos rather than all skins

I wrote it the way I did because I was copying the above and below events-- I'm not really familiar with this extension, and so I don't want to mess around with it too much. I know you've worked on this one in the past, though, so if you know how to do what you're suggesting, help would be appreciated.

NexusKitten avatar Mar 13 '25 22:03 NexusKitten

It looks like in this pull request the video element's volume doesn't actually change until end of frame. If the project's scripts get stuck for a while that might mean the volume blocks are now noticeably delayed, until the scripts are unstuck

GarboMuffin avatar Mar 14 '25 03:03 GarboMuffin

It looks like in this pull request the video element's volume doesn't actually change until end of frame. If the project's scripts get stuck for a while that might mean the volume blocks are now noticeably delayed, until the scripts are unstuck

wouldnt before execute work

SharkPool-SP avatar Mar 14 '25 04:03 SharkPool-SP

No that would another frame of delay

Old version would update element volume in middle of frame, not on either end. Not sure if browsers actually process those changes mid frame or if they end up waiting until the end anyways

GarboMuffin avatar Mar 14 '25 05:03 GarboMuffin

It looks like in this pull request the video element's volume doesn't actually change until end of frame. If the project's scripts get stuck for a while that might mean the volume blocks are now noticeably delayed, until the scripts are unstuck

You could emit an event from the addon similar to the pause addon, that can be listened to instead, this is how Unsandboxed (the mod) does it and it works perfectly fine

yuri-kiss avatar Mar 14 '25 14:03 yuri-kiss

The situation I described does not involve the addon at all

GarboMuffin avatar Mar 14 '25 15:03 GarboMuffin

Although yes without an event the slider will always be a tiny bit delayed

Another option is a making media source node and connecting it to the audio engine. That could help make autoplay more reliable

GarboMuffin avatar Mar 14 '25 15:03 GarboMuffin

The situation I described does not involve the addon at all

I know. The point of using a event would mean you are not waiting for a frame to finish or start, and only when the volume actually updates.

yuri-kiss avatar Mar 14 '25 17:03 yuri-kiss

!format

NexusKitten avatar Mar 14 '25 21:03 NexusKitten

yes that solves the project i was talking about once you remove the leftover console.log

GarboMuffin avatar Mar 14 '25 21:03 GarboMuffin

!format

NexusKitten avatar Apr 18 '25 20:04 NexusKitten

!format

NexusKitten avatar Apr 18 '25 21:04 NexusKitten

this is insanely resource in-effecient but since the idea for volume changes to become an event is not happening we may aswell merge this in its current state.

yuri-kiss avatar May 21 '25 04:05 yuri-kiss

yes its not ideal but we already have this O(n) loop so its not regressing much

GarboMuffin avatar May 21 '25 04:05 GarboMuffin