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

Add AudioPlayer class that handles both WebAudio and HTML5 audio #3179

Merged
merged 14 commits into from
Jul 16, 2024

Conversation

jodeleeuw
Copy link
Member

This implements #341 by creating an AudioPlayer class to handle the basic audio functions (load, play, stop, event handling) required by most uses of audio in jsPsych.

This will allow us to clean up the code in the audio plugins to avoid checking whether the audio engine is HTML5 or web audio.

Remaining tasks include:

  • change all plugins to use AudioPlayer
  • update documentation
  • implement new tests for audio plugins now that there is a mocked audio player

@jodeleeuw jodeleeuw added this to the 8.0 milestone Nov 8, 2023
@jodeleeuw jodeleeuw self-assigned this Nov 8, 2023
Copy link

changeset-bot bot commented Nov 8, 2023

🦋 Changeset detected

Latest commit: bbaddbe

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
jspsych Major
@jspsych/plugin-audio-button-response Minor
@jspsych/plugin-audio-keyboard-response Minor
@jspsych/plugin-audio-slider-response Minor
@jspsych/test-utils Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jodeleeuw jodeleeuw requested a review from bjoluc November 8, 2023 14:58
Copy link
Member

@bjoluc bjoluc left a comment

Choose a reason for hiding this comment

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

Wonderful, especially the use of Jest's auto mocking! Have you thought about using howler.js internally? We could defer some edge case handling responsibility that way...

@jodeleeuw jodeleeuw marked this pull request as ready for review July 15, 2024 21:15
Bankminer78 and others added 2 commits July 16, 2024 11:29
…for enable_button_after for audio_button_response.
Updates to the AudioPlayer class and audio-button-response plugin
@jodeleeuw jodeleeuw merged commit 3f06cfa into v8 Jul 16, 2024
4 checks passed
@jodeleeuw jodeleeuw deleted the audio-player branch July 16, 2024 15:53
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.

3 participants