-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Fix AudioStreamPlayer get_playback_position()
for web build
#95197
Conversation
0351ebc
to
7312bb8
Compare
This fix is interesting. But it takes for granted that the browser will play the sample without a hitch. Technically, I think that we should rather implement something like mentioned here: WebAudio/web-audio-api#2397 (comment) With that solution, we get a more precise position of the playhead, not just an approximation. |
3a7f95e
to
da56a2a
Compare
get_playback_position()
for web build
7f25773
to
ccb3cae
Compare
Definitely looks like a tricky implementation with how godot-processor works, wondering if this approximation is a good fix for the moment will keep digging into this |
eea927c
to
0d42a13
Compare
@adamscott Gave it a shot... basically constructing a new AudioWorklet for each SampleNode to keep track of its playback by parsing the incoming buffer length. process(inputs, _outputs, _parameters) {
if (inputs.length > 0) {
const input = inputs[0];
if (input.length > 0) {
this.position += input[0].length;
this.port.postMessage({ 'cmd': 'position', 'data': this.position });
return true;
}
}
return true;
} |
e209e46
to
4e1e8fd
Compare
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.
Great work! Didn't test it yet, I'm doing this right now.
If it works well, I'll try to push the fix for 4.3.
There's only a few renames and nitpicks, but globally, it's a great implementation. Thanks!
oh im dumb, i forgot why i moved to manual, audio cant autoplay on web until you click into the page. so thats why i didnt hear yours half the time. but we would still need the this.start() in the setup as it used to be called upon SampleNode creation when you call .play() Give this latest push a try, autoplay / manual appear working. edit: it appears i curse myself anytime i say its working. manual playing isnt in latest.... |
0117ccf
to
aa69645
Compare
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.
Last changes that I can see.
8e2fb6b
to
e4f73d6
Compare
The errors do need separate names. But thank you for the reviews! Made changes :) |
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.
Works for me! Thank you, @yahkr, for your time and effort. Very appreciated.
Thanks! |
Cherry-picked for 4.3.1. |
fixes #95128
get_playback_position was missing a js hookup with audio samples updates