/// /** * Default values for durations. */ export declare const defaults: { /** * The duration of fade in or out, in milliseconds * * @default 1000 */ fadeDuration: number; /** * How long to pause between music tracks, in milliseconds * * @default 1000 */ pauseBetweenTracks: number; }; /** * Clears the playlist and the music queue. Does not stop music that's * currently playing. */ export declare function clearPlaylist(): void; /** * @returns Returns the name of the currently playing music file, or null if nothing * is playing. If music has been asked to stop, returns the name of the music file * that will play next. */ export declare function currentMusicPlaying(): string | null; /** * Fades out sound. * * @param element The audio element that should fade out * @param [duration=1000] The duration of the fade in milliseconds, * default 1000 ms (1 second) or the value set in * vorple.defaults.fadeDuration. Note that the duration is calculated from * 100% volume, even if the current volume of the sound is less than that. * @param callback Function that is called when the audio has * stopped completely with a boolean as the first parameter that matches * what this function returned * * @returns Returns false if the element doesn't exist or is not an audio element, true otherwise. */ export declare function fadeOut(element: string | JQuery.PlainObject, duration?: number | null, callback?: (success: boolean) => void): boolean; /** * Checks if any audio is playing. Note that sound that is being loaded or * has received a play command but isn't playing for some other reason * isn't considered as playing, even though it's about to start. * * @returns Returns true if audio is playing, false otherwise. */ export declare function isAudioPlaying(): boolean; /** * Checks if any sound effect is playing. * * @returns Returns true if a sound effect is playing, false otherwise. */ export declare function isEffectPlaying(): boolean; /** * Checks if an audio element is playing. * * @param audioElement DOM element, jQuery object or jQuery selector of the audio element * @returns Returns true if audio element exists and is playing, false otherwise. */ export declare function isElementPlaying(audioElement: string | JQuery.PlainObject): boolean; /** * Checks if music is playing. * * @returns Returns true if music is actually playing and it isn't fading out at the moment. */ export declare function isMusicPlaying(): boolean; export interface PlayMusicOptions { /** * If true, the track keeps repeating. * * @default false */ looping?: boolean; /** * If true, always starts playing from the start, even when this track is already playing. * * @default false */ restart?: boolean; } /** * Starts playing music. If the same music file is already playing, does nothing * except sets the looping property. If another music file is playing, * fades out the old one before playing the new one. * * @param url The URL of the audio file * @param options An optional options object */ export declare function playMusic(url: string, options?: PlayMusicOptions): void; export interface PlaySoundOptions { /** * The id to attach to the audio element. If empty, no id is added. * * @default undefined */ id?: string; /** * If true, the sound effect keeps repeating. * * @default false */ looping?: boolean; } /** * Starts playing a sound effect. * * @param url The URL of the audio file * @param options An optional options object * @returns Returns the audio DOM element. */ export declare function playSound(url: string, options?: PlaySoundOptions): HTMLAudioElement; export interface SetPlaylistOptions { /** * If true, the playlist starts playing again from the start when it ends. */ looping?: boolean; /** * If true, always play from the start even when a track in the playlist is already playing. */ restart?: boolean; /** * If true, shuffles the playlist in random order before playing it. */ shuffled?: boolean; } /** * Sets a playlist and starts playing it. * * @param list An array of music file URLs * @param options An optional options object */ export declare function setPlaylist(list: string[], options?: SetPlaylistOptions): void; /** * Stops playing music. Clears the music queue and the playlist. * * @param fadeoutDuration The duration of the fadeout in milliseconds. * Set to 0 to stop immediately. */ export declare function stopMusic(fadeoutDuration?: number): void;