Merge pull request #2991 from bbonf/fix-audio-mimetype

fix for wrong audio mimetype preventing playback in Safari
This commit is contained in:
Josh de Leeuw 2025-02-12 10:00:12 -05:00 committed by GitHub
commit 7dee88ca01
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
"@jspsych/plugin-html-audio-response": patch
---
uses mimetype of audio recorded for playback instead of defaulting to webm

View File

@ -182,7 +182,7 @@ class HtmlAudioResponsePlugin implements JsPsychPlugin<Info> {
}; };
this.stop_event_handler = () => { 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); this.audio_url = URL.createObjectURL(data);
const reader = new FileReader(); const reader = new FileReader();
reader.addEventListener("load", () => { reader.addEventListener("load", () => {