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

OfflineAudioContext event handlers #456

Merged
merged 3 commits into from
Feb 23, 2024
Merged

OfflineAudioContext event handlers #456

merged 3 commits into from
Feb 23, 2024

Conversation

orottier
Copy link
Owner

Fixes #411

Previously this was not emitted because the OfflineAudioContext has no
event loop running. By overriding the trait we do make this happen.

TODO: if you call offline_context.base().set_onstatechange we run the
wrong handler code stil..
It is not necessary to expose it because the BaseAudioContext methods
are available on the object itself, plus it causes issues for the
`set_onstatechange` handler, see b0b03a6
@@ -21,6 +21,7 @@ use crate::{node, AudioListener};
#[allow(clippy::module_name_repetitions)]
pub trait BaseAudioContext {
/// Returns the [`BaseAudioContext`] concrete type associated with this `AudioContext`
#[doc(hidden)] // we'd rather not expose the ConcreteBaseAudioContext
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not pub(crate) then?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe a pub trait must have all items pub. Will check later

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, didn't realise it was a trait

@b-ma
Copy link
Collaborator

b-ma commented Feb 23, 2024

Nice!

@orottier orottier merged commit 124fa4f into main Feb 23, 2024
3 checks passed
@orottier orottier deleted the feature/offline-events branch February 23, 2024 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Emit oncomplete event for OfflineAudioContext
2 participants