YMAudioPlayer.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // YMAudioPlayer.h
  3. // MSYOUPAI
  4. //
  5. // Created by YoMi on 2024/2/25.
  6. // Copyright © 2024 MS. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "FSAudioStream.h"
  10. #define kAudioPlayer [YMAudioPlayer sharedInstance]
  11. @class YMAudioPlayer;
  12. @protocol YMAudioPlayerDelegate <NSObject>
  13. @optional
  14. - (void)audioPlayerDidPlayMusicCompleted;
  15. - (void)audioPlayer:(YMAudioPlayer *)player stateChangeWithState:(FSAudioStreamState)state;
  16. @end
  17. @interface YMAudioPlayer : NSObject
  18. + (instancetype)sharedInstance;
  19. /** 代理 */
  20. @property (nonatomic, weak) id<YMAudioPlayerDelegate> delegate;
  21. /** 播放地址 */
  22. @property (nonatomic, copy) NSString *playUrlStr;
  23. /** 播放状态 */
  24. @property (nonatomic, readonly) FSAudioStreamState state;
  25. /** 播放进度 */
  26. @property (nonatomic, assign) float progress;
  27. /** AudioStream 播放器 */
  28. @property (nonatomic, strong) FSAudioStream *audioStream;
  29. /** 播放 */
  30. - (void)play;
  31. /** 暂停 */
  32. - (void)pause;
  33. /** 恢复播放 */
  34. - (void)resume;
  35. /** 停止播放 */
  36. - (void)stop;
  37. @end