UNPKG

@mustafakarali/react-native-audio-stream

Version:

React Native Audio Stream - High-performance audio streaming for React Native

243 lines (240 loc) 4.77 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StreamingProtocol = exports.PlaybackState = exports.LogLevel = exports.ErrorCodes = exports.EQUALIZER_PRESETS = exports.DEFAULT_CONFIG = exports.AudioFormat = void 0; let AudioFormat = exports.AudioFormat = /*#__PURE__*/function (AudioFormat) { AudioFormat["MP3"] = "mp3"; AudioFormat["AAC"] = "aac"; AudioFormat["WAV"] = "wav"; AudioFormat["OGG"] = "ogg"; AudioFormat["FLAC"] = "flac"; AudioFormat["PCM"] = "pcm"; AudioFormat["HLS"] = "hls"; AudioFormat["DASH"] = "dash"; return AudioFormat; }({}); let StreamingProtocol = exports.StreamingProtocol = /*#__PURE__*/function (StreamingProtocol) { StreamingProtocol["HTTP"] = "http"; StreamingProtocol["HTTPS"] = "https"; StreamingProtocol["WEBSOCKET"] = "websocket"; return StreamingProtocol; }({}); let PlaybackState = exports.PlaybackState = /*#__PURE__*/function (PlaybackState) { PlaybackState["IDLE"] = "idle"; PlaybackState["LOADING"] = "loading"; PlaybackState["BUFFERING"] = "buffering"; PlaybackState["PLAYING"] = "playing"; PlaybackState["PAUSED"] = "paused"; PlaybackState["STOPPED"] = "stopped"; PlaybackState["ERROR"] = "error"; PlaybackState["COMPLETED"] = "completed"; return PlaybackState; }({}); let LogLevel = exports.LogLevel = /*#__PURE__*/function (LogLevel) { LogLevel[LogLevel["NONE"] = 0] = "NONE"; LogLevel[LogLevel["ERROR"] = 1] = "ERROR"; LogLevel[LogLevel["WARNING"] = 2] = "WARNING"; LogLevel[LogLevel["INFO"] = 3] = "INFO"; LogLevel[LogLevel["DEBUG"] = 4] = "DEBUG"; LogLevel[LogLevel["VERBOSE"] = 5] = "VERBOSE"; return LogLevel; }({}); // Event callbacks // Main audio stream interface // Native module interface // Error codes const ErrorCodes = exports.ErrorCodes = { NETWORK_ERROR: 'NETWORK_ERROR', DECODE_ERROR: 'DECODE_ERROR', PERMISSION_DENIED: 'PERMISSION_DENIED', UNSUPPORTED_FORMAT: 'UNSUPPORTED_FORMAT', BUFFER_TIMEOUT: 'BUFFER_TIMEOUT', INITIALIZATION_ERROR: 'INITIALIZATION_ERROR', INVALID_STATE: 'INVALID_STATE', CACHE_ERROR: 'CACHE_ERROR', UNKNOWN_ERROR: 'UNKNOWN_ERROR' }; // Default configurations const DEFAULT_CONFIG = exports.DEFAULT_CONFIG = { bufferSize: 64, prebufferThreshold: 16, maxBufferSize: 512, chunkSize: 16, protocol: StreamingProtocol.HTTPS, reconnectAttempts: 3, reconnectDelay: 1000, timeout: 30000, sampleRate: 44100, channels: 2, autoPlay: true, enableBackgroundMode: false, maintainAudioFocus: true, enableCache: false, cacheSize: 100, logLevel: LogLevel.WARNING }; // Equalizer presets const EQUALIZER_PRESETS = exports.EQUALIZER_PRESETS = [{ name: 'Flat', bands: [{ frequency: 60, gain: 0 }, { frequency: 230, gain: 0 }, { frequency: 910, gain: 0 }, { frequency: 3600, gain: 0 }, { frequency: 14000, gain: 0 }] }, { name: 'Bass Boost', bands: [{ frequency: 60, gain: 6 }, { frequency: 230, gain: 4 }, { frequency: 910, gain: 0 }, { frequency: 3600, gain: 0 }, { frequency: 14000, gain: 0 }] }, { name: 'Treble Boost', bands: [{ frequency: 60, gain: 0 }, { frequency: 230, gain: 0 }, { frequency: 910, gain: 0 }, { frequency: 3600, gain: 4 }, { frequency: 14000, gain: 6 }] }, { name: 'Vocal', bands: [{ frequency: 60, gain: -2 }, { frequency: 230, gain: 0 }, { frequency: 910, gain: 4 }, { frequency: 3600, gain: 4 }, { frequency: 14000, gain: 0 }] }, { name: 'Rock', bands: [{ frequency: 60, gain: 5 }, { frequency: 230, gain: 3 }, { frequency: 910, gain: -1 }, { frequency: 3600, gain: 3 }, { frequency: 14000, gain: 5 }] }, { name: 'Pop', bands: [{ frequency: 60, gain: -1 }, { frequency: 230, gain: 2 }, { frequency: 910, gain: 4 }, { frequency: 3600, gain: 3 }, { frequency: 14000, gain: -1 }] }, { name: 'Jazz', bands: [{ frequency: 60, gain: 3 }, { frequency: 230, gain: 0 }, { frequency: 910, gain: -2 }, { frequency: 3600, gain: 2 }, { frequency: 14000, gain: 3 }] }, { name: 'Dance', bands: [{ frequency: 60, gain: 6 }, { frequency: 230, gain: 0 }, { frequency: 910, gain: 2 }, { frequency: 3600, gain: 4 }, { frequency: 14000, gain: 0 }] }, { name: 'Classical', bands: [{ frequency: 60, gain: 0 }, { frequency: 230, gain: 0 }, { frequency: 910, gain: 0 }, { frequency: 3600, gain: -3 }, { frequency: 14000, gain: -3 }] }]; //# sourceMappingURL=types.js.map