@nodefinity/react-native-music-library
Version:
Access local music files in React Native with full metadata support.
71 lines (63 loc) • 2.28 kB
JavaScript
;
import MusicLibrary from './NativeMusicLibrary';
import { getOptions } from "./utils.js";
export * from './NativeMusicLibrary';
/**
* Get all tracks from the music library.
* @param assetsOptions - The options for the query.
* @returns A promise that resolves to an array of track info.
*/
export async function getTracksAsync(assetsOptions = {}) {
return MusicLibrary.getTracksAsync(getOptions(assetsOptions));
}
/**
* Get the metadata of a track.
* @param trackId - The ID of the track.
* @returns A promise that resolves to the metadata of the track.
*/
export function getTrackMetadataAsync(trackId) {
return MusicLibrary.getTrackMetadataAsync(trackId);
}
/**
* Get all tracks from a specific album.
* @param albumId - The ID of the album.
* @returns A promise that resolves to an array of tracks in the album.
*/
export function getTracksByAlbumAsync(albumId) {
return MusicLibrary.getTracksByAlbumAsync(albumId);
}
/**
* Get all tracks from a specific artist with pagination.
* @param artistId - The ID of the artist.
* @param assetsOptions - The options for the query (pagination, etc.).
* @returns A promise that resolves to a paginated result of tracks by the artist.
*/
export function getTracksByArtistAsync(artistId, assetsOptions = {}) {
return MusicLibrary.getTracksByArtistAsync(artistId, getOptions(assetsOptions));
}
/**
* Get all albums from the music library.
* @param options - The options for the query.
* @returns A promise that resolves to an array of album info.
*/
export function getAlbumsAsync(assetsOptions = {}) {
return MusicLibrary.getAlbumsAsync(getOptions(assetsOptions));
}
/**
* Get all albums from a specific artist.
* @param artistId - The ID of the artist.
* @returns A promise that resolves to an array of albums by the artist.
*/
export function getAlbumsByArtistAsync(artistId) {
return MusicLibrary.getAlbumsByArtistAsync(artistId);
}
/**
* Get all artists from the music library.
* @param options - The options for the query.
* @returns A promise that resolves to an array of artist info.
*/
export function getArtistsAsync(assetsOptions = {}) {
return MusicLibrary.getArtistsAsync(getOptions(assetsOptions));
}
export default MusicLibrary;
//# sourceMappingURL=index.js.map