xref: /MusicFree/src/native/mp3Util/index.ts (revision bc3071751dde42f2310c1d49bc94e1362e2a4aa1)
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猫头猫
11*bc307175S猫头猫export interface IWritableMeta extends IBasicMeta {
12*bc307175S猫头猫    lyric?: string;
13*bc307175S猫头猫    comment?: string;
14*bc307175S猫头猫}
15*bc307175S猫头猫
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>;
22*bc307175S猫头猫    /** 写入meta信息 */
23*bc307175S猫头猫    setMediaMeta: (filePath: string, meta: IWritableMeta) => Promise<void>;
249cd1998bS猫头猫}
259cd1998bS猫头猫
26afb5c234S猫头猫const Mp3Util = NativeModules.Mp3Util;
279cd1998bS猫头猫
28afb5c234S猫头猫export default Mp3Util as IMp3Util;
29