react-native-audio-api
Version:
react-native-audio-api provides system for controlling audio in React Native environment compatible with Web Audio API specification
20 lines (19 loc) • 877 B
JavaScript
;
import AudioNode from "./AudioNode.js";
import { InvalidStateError } from "../errors/index.js";
export default class MediaElementAudioSourceNode extends AudioNode {
constructor(context, options) {
const internalHandle = options.mediaElement;
const fileSourceNode = internalHandle.getFileSourceNode();
if (fileSourceNode === null) {
throw new InvalidStateError('Audio tag source is not ready yet. Wait for onLoad before creating MediaElementAudioSourceNode.');
}
if (fileSourceNode.routedThroughMediaElement) {
throw new InvalidStateError('Audio tag source is already routed through MediaElementAudioSourceNode.');
}
const node = context.context.createMediaElementSource(fileSourceNode);
super(context, node);
this.mediaElement = options.mediaElement;
}
}
//# sourceMappingURL=MediaElementAudioSourceNode.js.map