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.
		
		
		
		
		
			
		
			
	
	
		
			60 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			C
		
	
		
		
			
		
	
	
			60 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			C
		
	
| 
											9 years ago
										 | //
 | ||
| 
											8 years ago
										 | //  Copyright (c) 2018 Open Whisper Systems. All rights reserved.
 | ||
| 
											9 years ago
										 | //
 | ||
|  | 
 | ||
| 
											5 years ago
										 | #import <Foundation/Foundation.h>
 | ||
|  | #import <CoreGraphics/CoreGraphics.h>
 | ||
|  | 
 | ||
| 
											9 years ago
										 | NS_ASSUME_NONNULL_BEGIN | ||
|  | 
 | ||
| 
											8 years ago
										 | typedef NS_ENUM(NSInteger, AudioPlaybackState) { | ||
|  |     AudioPlaybackState_Stopped, | ||
|  |     AudioPlaybackState_Playing, | ||
|  |     AudioPlaybackState_Paused, | ||
|  | }; | ||
| 
											9 years ago
										 | 
 | ||
| 
											8 years ago
										 | @protocol OWSAudioPlayerDelegate <NSObject> | ||
| 
											9 years ago
										 | 
 | ||
| 
											8 years ago
										 | - (AudioPlaybackState)audioPlaybackState; | ||
|  | - (void)setAudioPlaybackState:(AudioPlaybackState)state; | ||
| 
											9 years ago
										 | - (void)setAudioProgress:(CGFloat)progress duration:(CGFloat)duration; | ||
| 
											5 years ago
										 | - (void)showInvalidAudioFileAlert; | ||
| 
											9 years ago
										 | 
 | ||
|  | @end | ||
|  | 
 | ||
|  | #pragma mark -
 | ||
|  | 
 | ||
| 
											7 years ago
										 | typedef NS_ENUM(NSUInteger, OWSAudioBehavior) { | ||
|  |     OWSAudioBehavior_Unknown, | ||
|  |     OWSAudioBehavior_Playback, | ||
|  |     OWSAudioBehavior_AudioMessagePlayback, | ||
|  |     OWSAudioBehavior_PlayAndRecord, | ||
|  |     OWSAudioBehavior_Call, | ||
|  | }; | ||
|  | 
 | ||
| 
											8 years ago
										 | @interface OWSAudioPlayer : NSObject | ||
| 
											9 years ago
										 | 
 | ||
| 
											8 years ago
										 | @property (nonatomic, readonly, weak) id<OWSAudioPlayerDelegate> delegate; | ||
| 
											9 years ago
										 | 
 | ||
|  | // This property can be used to associate instances of the player with view
 | ||
|  | // or model objects.
 | ||
|  | @property (nonatomic, weak) id owner; | ||
| 
											9 years ago
										 | 
 | ||
| 
											8 years ago
										 | @property (nonatomic) BOOL isLooping; | ||
|  | 
 | ||
| 
											7 years ago
										 | - (instancetype)initWithMediaUrl:(NSURL *)mediaUrl audioBehavior:(OWSAudioBehavior)audioBehavior; | ||
| 
											8 years ago
										 | 
 | ||
| 
											7 years ago
										 | - (instancetype)initWithMediaUrl:(NSURL *)mediaUrl | ||
|  |                      audioBehavior:(OWSAudioBehavior)audioBehavior | ||
|  |                         delegate:(id<OWSAudioPlayerDelegate>)delegate; | ||
| 
											8 years ago
										 | 
 | ||
| 
											7 years ago
										 | - (void)play; | ||
| 
											5 years ago
										 | - (void)setCurrentTime:(NSTimeInterval)currentTime; | ||
| 
											9 years ago
										 | - (void)pause; | ||
|  | - (void)stop; | ||
| 
											7 years ago
										 | - (void)togglePlayState; | ||
| 
											9 years ago
										 | 
 | ||
|  | @end | ||
| 
											9 years ago
										 | 
 | ||
|  | NS_ASSUME_NONNULL_END |