mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			56 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Objective-C
		
	
			
		
		
	
	
			56 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Objective-C
		
	
| //
 | |
| //  Copyright (c) 2018 Open Whisper Systems. All rights reserved.
 | |
| //
 | |
| 
 | |
| NS_ASSUME_NONNULL_BEGIN
 | |
| 
 | |
| typedef NS_ENUM(NSInteger, AudioPlaybackState) {
 | |
|     AudioPlaybackState_Stopped,
 | |
|     AudioPlaybackState_Playing,
 | |
|     AudioPlaybackState_Paused,
 | |
| };
 | |
| 
 | |
| @protocol OWSAudioPlayerDelegate <NSObject>
 | |
| 
 | |
| - (AudioPlaybackState)audioPlaybackState;
 | |
| - (void)setAudioPlaybackState:(AudioPlaybackState)state;
 | |
| 
 | |
| - (void)setAudioProgress:(CGFloat)progress duration:(CGFloat)duration;
 | |
| 
 | |
| @end
 | |
| 
 | |
| #pragma mark -
 | |
| 
 | |
| typedef NS_ENUM(NSUInteger, OWSAudioBehavior) {
 | |
|     OWSAudioBehavior_Unknown,
 | |
|     OWSAudioBehavior_Playback,
 | |
|     OWSAudioBehavior_AudioMessagePlayback,
 | |
|     OWSAudioBehavior_PlayAndRecord,
 | |
|     OWSAudioBehavior_Call,
 | |
| };
 | |
| 
 | |
| @interface OWSAudioPlayer : NSObject
 | |
| 
 | |
| @property (nonatomic, readonly, weak) id<OWSAudioPlayerDelegate> delegate;
 | |
| 
 | |
| // This property can be used to associate instances of the player with view
 | |
| // or model objects.
 | |
| @property (nonatomic, weak) id owner;
 | |
| 
 | |
| @property (nonatomic) BOOL isLooping;
 | |
| 
 | |
| - (instancetype)initWithMediaUrl:(NSURL *)mediaUrl audioBehavior:(OWSAudioBehavior)audioBehavior;
 | |
| 
 | |
| - (instancetype)initWithMediaUrl:(NSURL *)mediaUrl
 | |
|                      audioBehavior:(OWSAudioBehavior)audioBehavior
 | |
|                         delegate:(id<OWSAudioPlayerDelegate>)delegate;
 | |
| 
 | |
| - (void)play;
 | |
| - (void)pause;
 | |
| - (void)stop;
 | |
| - (void)togglePlayState;
 | |
| 
 | |
| @end
 | |
| 
 | |
| NS_ASSUME_NONNULL_END
 |