JCHATAudioPlayerHelper.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //
  2. // JCHATAudioPlayerHelper.h
  3. // MessageDisplayKit
  4. //
  5. // Created by Aevitx on 14-1-22.
  6. // Copyright (c) 2014年 Aevitx. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <AVFoundation/AVAudioPlayer.h>
  10. #import "XHMacro.h"
  11. @protocol XHAudioPlayerHelperDelegate <NSObject>
  12. @optional
  13. - (void)didAudioPlayerBeginPlay:(AVAudioPlayer*)audioPlayer;
  14. - (void)didAudioPlayerStopPlay:(AVAudioPlayer*)audioPlayer;
  15. - (void)didAudioPlayerPausePlay:(AVAudioPlayer*)audioPlayer;
  16. @end
  17. @interface JCHATAudioPlayerHelper : NSObject <AVAudioPlayerDelegate>
  18. @property (nonatomic, strong) AVAudioPlayer *player;
  19. @property (nonatomic, copy) NSString *playingFileName;
  20. @property (nonatomic, assign) id <XHAudioPlayerHelperDelegate> delegate;
  21. @property (nonatomic, strong) NSIndexPath *playingIndexPathInFeedList;//给动态列表用
  22. + (id)shareInstance;
  23. - (AVAudioPlayer*)player;
  24. - (BOOL)isPlaying;
  25. - (void)managerAudioWithFileName:(NSString*)amrName toPlay:(BOOL)toPlay;
  26. - (void)managerAudioWithData:(NSData *)data toplay:(BOOL)toPlay;
  27. - (void)pausePlayingAudio;//暂停
  28. - (void)stopAudio;//停止
  29. @end