mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
c646f76335
- sync speakerphone state manipulated from system call screen - Revert audio session after call failure, ensures media plays out of speaker after placing a failing call. - Replace notification with delegate pattern since we're already using delegate pattern here. - Fixes voiceover accessibility after voice memo - Avoid audio blip after pressing hangup - Rename CallAudioSession -> OWSAudioSession Going to start using it for other non-call things since we want to gather all our audio session concerns. - Resume background audio when done playing video - Extract OWSVideoPlayer which ensures audio is in proper state before playback - Move recording session logic to shared OWSAudioSession - Deactivate audio session when complete // FREEBIE
45 lines
1 KiB
Objective-C
45 lines
1 KiB
Objective-C
//
|
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@class TSVideoAttachmentAdapter;
|
|
|
|
typedef NS_ENUM(NSInteger, AudioPlaybackState) {
|
|
AudioPlaybackState_Stopped,
|
|
AudioPlaybackState_Playing,
|
|
AudioPlaybackState_Paused,
|
|
};
|
|
|
|
@protocol OWSAudioAttachmentPlayerDelegate <NSObject>
|
|
|
|
- (AudioPlaybackState)audioPlaybackState;
|
|
- (void)setAudioPlaybackState:(AudioPlaybackState)state;
|
|
|
|
- (void)setAudioProgress:(CGFloat)progress duration:(CGFloat)duration;
|
|
|
|
@end
|
|
|
|
#pragma mark -
|
|
|
|
@interface OWSAudioAttachmentPlayer : NSObject
|
|
|
|
@property (nonatomic, readonly, weak) id<OWSAudioAttachmentPlayerDelegate> delegate;
|
|
|
|
// This property can be used to associate instances of the player with view
|
|
// or model objects.
|
|
@property (nonatomic, weak) id owner;
|
|
|
|
// An generic initializer.
|
|
- (instancetype)initWithMediaUrl:(NSURL *)mediaUrl delegate:(id<OWSAudioAttachmentPlayerDelegate>)delegate;
|
|
|
|
- (void)play;
|
|
- (void)pause;
|
|
- (void)stop;
|
|
- (void)togglePlayState;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|