单军华
2018-05-04 25f409185a53e5e7beb17518a684298d92d31b3f
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
//
//  CSAudioManager.h
//  MusicVideos
//
//  Created by iOS_Chris on 16/8/8.
//  Copyright © 2016年 kyExpress. All rights reserved.
//
 
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
 
typedef void(^BlockPlayerDidFinishPlaying)(void);
typedef void(^BlockPlayerStartPlay)(void);
typedef void(^BlockPlayerStopPlay)(void);
 
@interface CSAudioManager : NSObject
 
 
@property (nonatomic,copy) BlockPlayerDidFinishPlaying blockPlayerDidFinishPlaying;
@property (nonatomic,copy) BlockPlayerStartPlay blockPlayerStartPlay;
@property (nonatomic,copy) BlockPlayerStopPlay blockPlayerStopPlay;
 
//获取播放语音唯一标识 - 防止音频修改后UniqueID没有变
//+ (NSString *)getPlayIDWithNoticeRecieveModel:(NoticeRecieveModel *)nrModel;
 
-(void)setBlockPlayerStopPlay:(BlockPlayerStopPlay)blockPlayerStopPlay;
-(void)setBlockPlayerStartPlay:(BlockPlayerStartPlay)blockPlayerStartPlay;
-(void)setBlockPlayerDidFinishPlaying:(BlockPlayerDidFinishPlaying)blockPlayerDidFinishPlaying;
 
+ (instancetype)defaultManager;
//播放音乐
//- (AVAudioPlayer *)playingMusicCacheWithPlayID:(NSString *)playID;
- (AVAudioPlayer *)playingMusicWithURL:(NSURL *)url playID:(NSString *)playID;
- (AVAudioPlayer *)playingMusicWithData:(NSData *)musicData playID:(NSString *)playID;
 
- (void)pauseMusicWithPlayID:(NSString *)playID;
- (void)stopMusicWithPlayID:(NSString *)playID;
 
//是否有缓存
//- (BOOL)isHavePlayerCacheWithPlayID:(NSString *)playID;
 
//播放音效
- (void)playSoundWithSoundName:(NSString *)soundName PlayID:(NSString *)playID;
//摧毁音效
- (void)disposeSoundWithPlayID:(NSString *)playID;
- (void)stopAllMusic;
- (BOOL)isPlayingWithPlayID:(NSString *)playID;
@end