Skip to content

Commit

Permalink
fix: solve compatibility issues with older browser versions
Browse files Browse the repository at this point in the history
- Firefox 52 does not support the OfflineAudioContext constructor
- versions before Chrome 62, Firefox 57, and Opera 42 do not support
passing OfflineAudioContext parameters as a single object

Closes #3.
  • Loading branch information
dessant committed Dec 6, 2018
1 parent b047efd commit 8be3007
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"browserslist": [
"Chrome >= 55",
"Firefox >= 52",
"Firefox >= 53",
"FirefoxAndroid >= 57",
"Opera >= 42"
],
Expand Down
10 changes: 5 additions & 5 deletions src/solve/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ async function prepareAudio(audio) {
const data = await ctx.decodeAudioData(audio);
await ctx.close();

const offlineCtx = new OfflineAudioContext({
const offlineCtx = new OfflineAudioContext(
// force mono output
numberOfChannels: 1,
length: 16000 * data.duration,
sampleRate: 16000
});
1,
16000 * data.duration,
16000
);
const source = offlineCtx.createBufferSource();
source.buffer = data;
source.connect(offlineCtx.destination);
Expand Down

0 comments on commit 8be3007

Please sign in to comment.