UNPKG

ngx-audio-control

Version:

Audio Player control for angular projects with speed control by native player in browser (HTML5)

121 lines (112 loc) 4.37 kB
import * as i0 from '@angular/core'; import { OnInit, ElementRef } from '@angular/core'; import * as i2 from '@angular/common'; declare class NgxAudioControlService { constructor(); static ɵfac: i0.ɵɵFactoryDeclaration<NgxAudioControlService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<NgxAudioControlService>; } declare class PlayList { title: string; fileAddress: string; } declare class NgxAudioControlComponent implements OnInit { private _doc; /** * Show play list button */ showList: boolean; /** * Show download button */ download: boolean; /** * Display filename in header */ showFileName: boolean; /** * Show speed control */ showSpeed: boolean; /** * Show volume control */ showVolume: boolean; /** * Display vertically or horizontally between control buttons and range seeker */ linear: boolean; /** This enumerated attribute is intended to provide a hint to the browser about what the author thinks will lead to the best user experience. It may have one of the following values: * #### `none`: Indicates that the audio should not be preloaded. #### `metadata`: Indicates that only audio metadata (e.g. length) is fetched. #### `auto`: Indicates that the whole audio file can be downloaded, even if the user is not expected to use it. ## Usage notes: The autoplay attribute has precedence over preload. If autoplay is specified, the browser would obviously need to start downloading the audio for playback. The browser is not forced by the specification to follow the value of this attribute; it is a mere hint. ## Default value is `metadata` */ preload: 'none' | 'metadata' | 'auto'; /** * set header when duration is inifinity and require call fetch request for get duration */ fetchHeaders: HeadersInit | undefined; /** * An array list of file addresses in the form of strings */ set fileList(val: string[]); downloading: boolean; fineName: string; speedDisplay: string; audioFiles: PlayList[]; currentTime: string; totalTime: string; options: { emptyListMessage: string; }; togglePlayList: boolean; currentAudioIndex: number; currentFileAddress: string; audio: ElementRef<HTMLAudioElement>; seekSlider: { min: number; max: number; value: number; }; buffering: boolean; errorLoad: boolean; constructor(_doc: Document); ngOnInit(): void; private initialize; playPause(): void; play(offset?: number): void; stop(): void; muteUnmute(): void; seekAudio(ev: Event): void; increaseSpeed(): void; decreaseSpeed(): void; changeVolume(ev: Event): void; previous(): void; next(): void; playNext(): void; onClickPlayList(index: number): void; downloadCurrentFile(): void; private getDuration; static ɵfac: i0.ɵɵFactoryDeclaration<NgxAudioControlComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<NgxAudioControlComponent, "ngx-audio-control", never, { "showList": { "alias": "showList"; "required": false; }; "download": { "alias": "download"; "required": false; }; "showFileName": { "alias": "showFileName"; "required": false; }; "showSpeed": { "alias": "showSpeed"; "required": false; }; "showVolume": { "alias": "showVolume"; "required": false; }; "linear": { "alias": "linear"; "required": false; }; "preload": { "alias": "preload"; "required": false; }; "fetchHeaders": { "alias": "fetchHeaders"; "required": false; }; "fileList": { "alias": "fileList"; "required": false; }; }, {}, never, never, false, never>; } declare class NgxAudioControlModule { static ɵfac: i0.ɵɵFactoryDeclaration<NgxAudioControlModule, never>; static ɵmod: i0.ɵɵNgModuleDeclaration<NgxAudioControlModule, [typeof NgxAudioControlComponent], [typeof i2.CommonModule], [typeof NgxAudioControlComponent]>; static ɵinj: i0.ɵɵInjectorDeclaration<NgxAudioControlModule>; } /** * Format time in seconds as MM:SS * @param seconds number * @returns MM:SS */ declare function formatTime(seconds: number): string; export { NgxAudioControlComponent, NgxAudioControlModule, NgxAudioControlService, PlayList, formatTime };