-
Notifications
You must be signed in to change notification settings - Fork 1
/
FeaturedAudioStreamer.h
58 lines (45 loc) · 1.76 KB
/
FeaturedAudioStreamer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// FeaturedAudioStreamer.h
// PlayMusic
//
// Created by 王落凡 on 2016/12/28.
// Copyright © 2016年 王落凡. All rights reserved.
//
#import <Foundation/Foundation.h>
#define FeaturedAudioStreamerStateChangedNotification @"FeaturedAudioStreamerStateChangedNotification"
typedef NS_ENUM(NSUInteger, FeaturedAudioStreamerPlayState) {
FeaturedAudioStreamerPlayStateInitialized,
FeaturedAudioStreamerPlayStatePlaying,
FeaturedAudioStreamerPlayStateWaitingForData,
FeaturedAudioStreamerPlayStatePaused,
FeaturedAudioStreamerPlayStateStopped,
FeaturedAudioStreamerPlayStateSeeking,
};
@interface FeaturedAudioStreamerCacheSystem : NSObject
@property(nonatomic, copy) NSString* audioCachedDataFilePath;
@property(nonatomic, copy) NSString* audioCachedDescFilePath;
-(NSUInteger)queryDataBytesCachedCountByOffset:(NSUInteger)offset;
-(void)createOrOpenCacheRelatedFileWithFileLength:(NSUInteger)fileLength;
-(BOOL)isCachedFileAlreadyExists;
-(void)markDataCachedWithExpectedBytes:(NSUInteger)bytes offset:(NSUInteger)offset;
-(void)finishedAudioCache;
-(void)clearCurrentCache;
-(void)clearAllCache;
@end
@interface FeaturedAudioStreamer : NSObject
@property(nonatomic, assign, readonly) double duration;
@property(nonatomic, assign, readonly) double progress;
@property(nonatomic, assign, readonly) BOOL isPlaying;
@property(nonatomic, assign, readonly) BOOL isPaused;
@property(nonatomic, assign, readonly) BOOL isStopped;
@property(nonatomic, assign, readonly) BOOL isWaiting;
-(instancetype)initWithAudioURL:(NSURL*)audioURL;
-(instancetype)initWithAudioURL:(NSURL *)audioURL useCache:(BOOL)bUseCache;
-(void)play;
-(void)pause;
-(void)stop;
-(void)seek:(NSTimeInterval)time;
-(NSString*)GetLastError;
-(void)destroyAudioStreamer;
-(void)clearCaches;
@end