xref: /MusicFree/src/native/mp3Util/index.ts (revision 3d4d06d97c4d26f92447d0589edfb5b2cfaed4d5)
19cd1998bS猫头猫import {NativeModules} from 'react-native';
29cd1998bS猫头猫
3afb5c234S猫头猫export interface IBasicMeta {
49cd1998bS猫头猫    album?: string;
59cd1998bS猫头猫    artist?: string;
69cd1998bS猫头猫    author?: string;
79cd1998bS猫头猫    duration?: string;
89cd1998bS猫头猫    title?: string;
99cd1998bS猫头猫}
109cd1998bS猫头猫
11bc307175S猫头猫export interface IWritableMeta extends IBasicMeta {
12bc307175S猫头猫    lyric?: string;
13bc307175S猫头猫    comment?: string;
14bc307175S猫头猫}
15bc307175S猫头猫
169cd1998bS猫头猫interface IMp3Util {
179cd1998bS猫头猫    getBasicMeta: (fileName: string) => Promise<IBasicMeta>;
18cd669353S猫头猫    getMediaMeta: (fileNames: string[]) => Promise<IBasicMeta[]>;
1974d0cf81S猫头猫    getMediaCoverImg: (mediaPath: string) => Promise<string>;
207993f90eS猫头猫    /** 读取内嵌歌词 */
217993f90eS猫头猫    getLyric: (mediaPath: string) => Promise<string>;
22bc307175S猫头猫    /** 写入meta信息 */
23*3d4d06d9S猫头猫    setMediaTag: (filePath: string, meta: IWritableMeta) => Promise<void>;
24*3d4d06d9S猫头猫    getMediaTag: (filePath: string) => Promise<IWritableMeta>;
259cd1998bS猫头猫}
269cd1998bS猫头猫
27afb5c234S猫头猫const Mp3Util = NativeModules.Mp3Util;
289cd1998bS猫头猫
29afb5c234S猫头猫export default Mp3Util as IMp3Util;
30