Skip to content

Commit

Permalink
Fix unexpectedly found nil in swift (#341)
Browse files Browse the repository at this point in the history
* Fix unexpectedly found nil in swift

* Resolve #340

* Release 3.0.12
  • Loading branch information
hyochan authored Jun 28, 2021
1 parent bc99db8 commit 62a50fb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## Changelogs
- **[3.0.12]**
- [iOS] Fix unexpectedly found nil in swift [#341](https://github.com/hyochan/react-native-audio-recorder-player/pull/341).

- **[3.0.11]**
- [Android] Small bugfixes on `println` message [#337](https://github.com/hyochan/react-native-audio-recorder-player/pull/337).

Expand Down
12 changes: 7 additions & 5 deletions ios/RNAudioRecorderPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,13 @@ class RNAudioRecorderPlayer: RCTEventEmitter, AVAudioRecorderDelegate {

timeObserverToken = audioPlayer.addPeriodicTimeObserver(forInterval: time,
queue: .main) {_ in
self.sendEvent(withName: "rn-playback", body: [
"isMuted": self.audioPlayer.isMuted,
"currentPosition": self.audioPlayerItem.currentTime().seconds * 1000,
"duration": self.audioPlayerItem.duration.seconds * 1000,
])
if (self.audioPlayer != nil) {
self.sendEvent(withName: "rn-playback", body: [
"isMuted": self.audioPlayer.isMuted,
"currentPosition": self.audioPlayerItem.currentTime().seconds * 1000,
"duration": self.audioPlayerItem.duration.seconds * 1000,
])
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-audio-recorder-player",
"version": "3.0.11",
"version": "3.0.12",
"description": "React Native Audio Recorder and Player.",
"homepage": "https://github.com/dooboolab/react-native-audio-recorder-player",
"main": "index.ts",
Expand Down

0 comments on commit 62a50fb

Please sign in to comment.