| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- //
- // AudioEnginePlayer.h
- // KulexiuForStudent
- //
- // Created by 王智 on 2024/6/4.
- //
- #import <Foundation/Foundation.h>
- @class AudioEnginePlayer;
- @protocol AudioEnginePlayerDelegate <NSObject>
- - (void)updatePlayProgress:(NSInteger)playTime andTotalTime:(NSInteger)totalTime andProgress:(CGFloat)progress currentInterval:(NSTimeInterval)currentInterval inPlayer:(AudioEnginePlayer *_Nonnull)player;
- @optional
- - (void)enginePlayFinished:(AudioEnginePlayer *_Nonnull)player;
- - (void)enginePlayerIsReadyPlay:(AudioEnginePlayer *_Nonnull)player;
- - (void)enginePlayerDidError:(AudioEnginePlayer *_Nonnull)player error:(NSError *_Nonnull)error;
- @end
- NS_ASSUME_NONNULL_BEGIN
- @interface AudioEnginePlayer : NSObject
- @property (nonatomic, weak) id <AudioEnginePlayerDelegate>delegate;
- @property (nonatomic, assign) float rate; // 播放速度
- @property (nonatomic, assign) BOOL isReady;
- @property (nonatomic, assign) BOOL isPlaying;
- @property (nonatomic, assign) BOOL isMute; // 是否禁音
- - (void)prepareNativeSongWithUrl:(NSURL *)nativeMusicUrl;
- - (void)startPlay;
- - (void)stopPlay;
- - (void)freePlayer;
- // 从某个位置开始播放 ms
- - (void)seekToTimePlay:(NSInteger)time;
- - (NSTimeInterval)getCurrentPlayTime;
- @end
- NS_ASSUME_NONNULL_END
|