Expose elementSource behind a feature flag

This commit is contained in:
Jordan Eldredge 2017-11-20 16:46:30 -08:00
parent e7d1d0c5e2
commit 3eccf2b927
3 changed files with 9 additions and 4 deletions

View file

@ -18,5 +18,6 @@ export const skinUrl = config.skinUrl === undefined ? skin : config.skinUrl;
export const audioUrl = config.audioUrl === undefined ? audio : config.audioUrl;
export const noMarquee = config.noMarquee || false;
export const hideAbout = config.hideAbout || false;
export const elementSource = config.elementSource || false;
export const initialState = config.initialState || undefined;
export const sentryDsn = SENTRY_DSN;

View file

@ -104,7 +104,9 @@ export default class ElementSource extends Emitter {
}
getSampleRate() {
return null;
// This is a lie. This is the sample rate of the context, not the
// underlying source media.
return this._context.sampleRate;
}
/*

View file

@ -1,7 +1,8 @@
/* Emulate the native <audio> element with Web Audio API */
import { elementSource } from "../config";
import { BANDS } from "../constants";
import BufferSource from "./bufferSource";
//import ElementSource from "./elementSource";
import ElementSource from "./elementSource";
export default class Media {
constructor(fileInput) {
@ -76,8 +77,9 @@ export default class Media {
// |
// <destination>
//this._source = new ElementSource(this._context, this._staticSource);
this._source = new BufferSource(this._context, this._staticSource);
this._source = elementSource
? new ElementSource(this._context, this._staticSource)
: new BufferSource(this._context, this._staticSource);
this._source.on("positionChange", () => {
this._callbacks.timeupdate();