2014-07-10 16:11:09 +02:00
|
|
|
/*
|
|
|
|
* This is the source code of Telegram for iOS v. 1.1
|
|
|
|
* It is licensed under GNU GPL v. 2 or later.
|
|
|
|
* You should have received a copy of the license in this archive (see LICENSE).
|
|
|
|
*
|
|
|
|
* Copyright Peter Iakovlev, 2013.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
|
|
|
|
@class ASQueue;
|
|
|
|
@class TGAudioPlayer;
|
|
|
|
|
|
|
|
@protocol TGAudioPlayerDelegate <NSObject>
|
|
|
|
|
|
|
|
@optional
|
|
|
|
|
2016-02-25 01:03:51 +01:00
|
|
|
- (void)audioPlayerDidPause:(TGAudioPlayer *)audioPlayer;
|
2014-07-10 16:11:09 +02:00
|
|
|
- (void)audioPlayerDidFinishPlaying:(TGAudioPlayer *)audioPlayer;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface TGAudioPlayer : NSObject
|
|
|
|
|
|
|
|
@property (nonatomic, weak) id<TGAudioPlayerDelegate> delegate;
|
|
|
|
|
2016-02-25 01:03:51 +01:00
|
|
|
+ (TGAudioPlayer *)audioPlayerForPath:(NSString *)path music:(bool)music controlAudioSession:(bool)controlAudioSession;
|
|
|
|
|
|
|
|
- (instancetype)init;
|
|
|
|
- (instancetype)initWithMusic:(bool)music controlAudioSession:(bool)controlAudioSession;
|
2014-07-10 16:11:09 +02:00
|
|
|
|
|
|
|
- (void)play;
|
|
|
|
- (void)playFromPosition:(NSTimeInterval)position;
|
2016-02-25 01:03:51 +01:00
|
|
|
- (void)pause:(void (^)())completion;
|
2014-07-10 16:11:09 +02:00
|
|
|
- (void)stop;
|
|
|
|
- (NSTimeInterval)currentPositionSync:(bool)sync;
|
|
|
|
- (NSTimeInterval)duration;
|
|
|
|
|
|
|
|
+ (ASQueue *)_playerQueue;
|
|
|
|
- (void)_beginAudioSession;
|
|
|
|
- (void)_endAudioSession;
|
|
|
|
- (void)_endAudioSessionFinal;
|
|
|
|
- (void)_notifyFinished;
|
2016-02-25 01:03:51 +01:00
|
|
|
- (void)_notifyPaused;
|
2014-07-10 16:11:09 +02:00
|
|
|
|
|
|
|
@end
|