@nodefinity/react-native-music-library
Version:
Access local music files in React Native with full metadata support.
82 lines (80 loc) • 1.71 kB
JavaScript
;
const showWebWarning = () => {
if (__DEV__) {
console.warn('MusicLibrary: This library is not supported on web platform. ' + 'Music library access is only available on iOS and Android.');
}
};
// Web fallback implementation
const MusicLibrary = {
async getTracksAsync() {
showWebWarning();
return {
items: [],
hasNextPage: false,
endCursor: undefined,
totalCount: 0
};
},
async getTrackMetadataAsync(trackId) {
showWebWarning();
return {
id: trackId,
duration: 0,
bitrate: 0,
sampleRate: 0,
channels: 0,
format: '',
title: '',
artist: '',
album: '',
year: 0,
genre: '',
track: 0,
disc: 0,
composer: '',
lyricist: '',
lyrics: '',
albumArtist: '',
comment: ''
};
},
async getTracksByAlbumAsync(albumId) {
console.log('getTracksByAlbumAsync', albumId);
showWebWarning();
return [];
},
async getTracksByArtistAsync() {
showWebWarning();
return {
items: [],
hasNextPage: false,
endCursor: undefined,
totalCount: 0
};
},
async getAlbumsAsync() {
showWebWarning();
return {
items: [],
hasNextPage: false,
endCursor: undefined,
totalCount: 0
};
},
async getAlbumsByArtistAsync(artistId) {
console.log('getAlbumsByArtistAsync', artistId);
showWebWarning();
return [];
},
async getArtistsAsync() {
showWebWarning();
return {
items: [],
hasNextPage: false,
endCursor: undefined,
totalCount: 0
};
}
};
export default MusicLibrary;
//# sourceMappingURL=NativeMusicLibrary.web.js.map