react-native-audio-api
Version:
react-native-audio-api provides system for controlling audio in React Native environment compatible with Web Audio API specification
33 lines (32 loc) • 1.34 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _AudioScheduledSourceNode = _interopRequireDefault(require("./AudioScheduledSourceNode"));
var _errors = require("../errors");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* StreamerNode is an AudioNode that allows you to stream audio from a file or
* URL. It uses FFmpeg to decode the audio data and provides it as an audio
* source. Note: This node requires the build to use FFmpeg, and will throw an
* error if FFmpeg is not available.
*
* @deprecated Use the `<Audio>` element with MediaElementAudioSourceNode for
* streaming audio instead to achieve the same functionality.
*/
class StreamerNode extends _AudioScheduledSourceNode.default {
constructor(context, options) {
if (__DEV__) {
console.warn('StreamerNode is deprecated and will be removed in a future version. ' + 'Please migrate to using the <Audio> element for streaming audio.');
}
const node = context.context.createStreamer(options);
if (!node) {
throw new _errors.NotSupportedError('StreamerNode requires FFmpeg build');
}
super(context, node);
this.streamPath = options.streamPath;
}
}
exports.default = StreamerNode;
//# sourceMappingURL=StreamerNode.js.map