Skip to content

Commit

Permalink
Merge pull request #2991 from bbonf/fix-audio-mimetype
Browse files Browse the repository at this point in the history
fix for wrong audio mimetype preventing playback in Safari
  • Loading branch information
jodeleeuw authored Feb 12, 2025
2 parents ce30fca + 5ab4cc7 commit 7dee88c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/pink-ducks-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@jspsych/plugin-html-audio-response": patch
---

uses mimetype of audio recorded for playback instead of defaulting to webm
2 changes: 1 addition & 1 deletion packages/plugin-html-audio-response/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class HtmlAudioResponsePlugin implements JsPsychPlugin<Info> {
};

this.stop_event_handler = () => {
const data = new Blob(this.recorded_data_chunks, { type: "audio/webm" });
const data = new Blob(this.recorded_data_chunks, { type: this.recorded_data_chunks[0].type });
this.audio_url = URL.createObjectURL(data);
const reader = new FileReader();
reader.addEventListener("load", () => {
Expand Down

0 comments on commit 7dee88c

Please sign in to comment.