-
Notifications
You must be signed in to change notification settings - Fork 3
[Feat] 녹음 관련 QA - 무음모드, 재생 중지 + etc) 검색어 볼드 처리 #144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,6 +46,8 @@ public final class DreamAudioPlayerView: UIView { | |
|
|
||
| private var playStatus = playStatus.notStart | ||
|
|
||
| public let isPauseAudio = PublishRelay<Bool>() | ||
|
|
||
| private lazy var playAndPauseButton: UIButton = { | ||
| let button = UIButton() | ||
| button.setImage(RDDSKitAsset.Images.icnStart.image, for: .normal) | ||
|
|
@@ -80,6 +82,7 @@ public final class DreamAudioPlayerView: UIView { | |
| self.setUI() | ||
| self.setLayout() | ||
| self.bind() | ||
| self.setAudioSession() | ||
| self.initPlay() | ||
| } | ||
|
|
||
|
|
@@ -128,8 +131,8 @@ extension DreamAudioPlayerView { | |
| audioPlayer = try AVAudioPlayer(contentsOf: audioFile) | ||
|
|
||
| audioPlayer.delegate = self | ||
| audioPlayer.prepareToPlay() | ||
| audioPlayer.volume = 1.0 | ||
| audioPlayer.prepareToPlay() | ||
| audioPlayTimeLabel.text = convertNSTimeInterval2String(audioPlayer.duration) | ||
|
|
||
| } catch let error as NSError { | ||
|
|
@@ -180,10 +183,28 @@ extension DreamAudioPlayerView { | |
| } | ||
| }) | ||
| .disposed(by: self.disposeBag) | ||
|
|
||
| isPauseAudio | ||
| .withUnretained(self) | ||
| .subscribe(onNext: { (owner, isPauseAudio) in | ||
| if isPauseAudio { | ||
| owner.setPlayStatus(false) | ||
| owner.audioPlayer.pause() | ||
| } | ||
|
Comment on lines
+187
to
+193
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 현재 사용되는 곳을 보니 Bool타입 중에서 true만 사용하고 있고, public method를 통해서 처리할 수 있을 것 같은데, 메모리 효율을 위해 method를 사용하는 방식으로 사용하는 것은 어떨까요?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @L-j-h-c 넵 ! 리팩과정에서 한번 수정해보겠습니다 :) |
||
| }).disposed(by: self.disposeBag) | ||
| } | ||
| } | ||
|
|
||
| extension DreamAudioPlayerView: AVAudioPlayerDelegate { | ||
| private func setAudioSession() { | ||
| let audioSession = AVAudioSession.sharedInstance() | ||
| do { | ||
| try audioSession.setCategory(AVAudioSession.Category.playback, mode: .default) | ||
| } catch { | ||
| print("audioSession error: \(error.localizedDescription)") | ||
| } | ||
| } | ||
|
Comment on lines
+199
to
+206
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 👍 |
||
|
|
||
| public func audioPlayerDidFinishPlaying(_ player: AVAudioPlayer, successfully flag: Bool) { | ||
| audioTimer.invalidate() | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍👍