AFSoundPlayback.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //
  2. // AFSoundPlayback.h
  3. // AFSoundManager-Demo
  4. //
  5. // Created by Alvaro Franco on 21/01/15.
  6. // Copyright (c) 2015 AlvaroFranco. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <AVFoundation/AVFoundation.h>
  10. #import <AudioToolbox/AudioToolbox.h>
  11. #import <MediaPlayer/MediaPlayer.h>
  12. #import "AFSoundItem.h"
  13. typedef void (^feedbackBlock)(AFSoundItem *item);
  14. typedef void (^finishedBlock)(void);
  15. @interface AFSoundPlayback : NSObject
  16. extern NSString *const AFSoundPlaybackStatus;
  17. extern NSString *const AFSoundStatusDuration;
  18. extern NSString *const AFSoundStatusTimeElapsed;
  19. extern NSString *const AFSoundPlaybackFinishedNotification;
  20. typedef NS_ENUM(NSInteger, AFSoundStatus) {
  21. AFSoundStatusNotStarted = 0,
  22. AFSoundStatusPlaying,
  23. AFSoundStatusPaused,
  24. AFSoundStatusFinished
  25. };
  26. -(id)initWithItem:(AFSoundItem *)item;
  27. @property (nonatomic, strong) AVPlayer *player;
  28. @property (nonatomic) AFSoundStatus status;
  29. @property (nonatomic, readonly) AFSoundItem *currentItem;
  30. -(void)play;
  31. -(void)pause;
  32. -(void)restart;
  33. -(void)playAtSecond:(NSInteger)second;
  34. -(void)listenFeedbackUpdatesWithBlock:(feedbackBlock)block andFinishedBlock:(finishedBlock)finishedBlock;
  35. -(NSDictionary *)statusDictionary;
  36. @end