-
-
Notifications
You must be signed in to change notification settings - Fork 271
Lily/Video: Update volume functions to interact with the project volume #2034
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
base: master
Are you sure you want to change the base?
Conversation
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. |
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 |
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 |
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 |
The situation I described does not involve the addon at all |
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 |
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. |
!format |
yes that solves the project i was talking about once you remove the leftover console.log |
!format |
!format |
extensions/Lily/Video.js
Outdated
@@ -31,6 +31,17 @@ | |||
elementContainer.ariaHidden = "true"; | |||
document.body.appendChild(elementContainer); | |||
|
|||
// Updated code to apply the project's volume to that of the video. | |||
// This allows the volume to interact with Scratch Addons and Sound Expanded. | |||
const updateAudio = function() { |
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.
iterating every time even when you have the skin seems kinda of wasteful but other than that it looks "good" I guess. I still think an even should be made for this instead
Resolves #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.
2025-03-13.17-42-14.mp4