Skip to content

Commit ae43c8b

Browse files
Merge pull request #205 from SimformSolutionsPvtLtd/develop
Release v2.1.6
2 parents b128b09 + 7c53377 commit ae43c8b

File tree

5 files changed

+11
-14
lines changed

5 files changed

+11
-14
lines changed

android/src/main/java/com/audiowaveform/AudioWaveformModule.kt

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,19 @@ class AudioWaveformModule(context: ReactApplicationContext): ReactContextBaseJav
5959

6060
@ReactMethod
6161
fun checkHasAudioRecorderPermission(promise: Promise) {
62-
audioRecorder.checkPermission(currentActivity, promise)
62+
audioRecorder.checkPermission(reactApplicationContext.currentActivity, promise)
6363
}
6464

6565
@ReactMethod
6666
fun getAudioRecorderPermission(promise: Promise) {
67-
audioRecorder.getPermission(currentActivity, promise)
67+
audioRecorder.getPermission(reactApplicationContext.currentActivity, promise)
6868
}
6969

7070
@ReactMethod
7171
fun initRecorder(obj: ReadableMap?, promise: Promise) {
7272
checkPathAndInitialiseRecorder(encoder, outputFormat, sampleRate, bitRate, promise, obj)
7373
}
7474

75-
@ReactMethod
76-
fun getDecibel(): Double? {
77-
return audioRecorder.getDecibel(recorder)
78-
}
79-
8075
@ReactMethod
8176
fun startRecording(obj: ReadableMap?, promise: Promise) {
8277
initRecorder(obj, promise)
@@ -379,7 +374,7 @@ class AudioWaveformModule(context: ReactApplicationContext): ReactContextBaseJav
379374
Log.e(Constants.LOG_TAG, "Failed to initialise Recorder")
380375
}
381376
if (path == null) {
382-
val outputDir = currentActivity?.cacheDir
377+
val outputDir = reactApplicationContext.currentActivity?.cacheDir
383378
val outputFile: File?
384379
val dateTimeInstance = SimpleDateFormat(Constants.fileNameFormat, Locale.US)
385380
val currentDate = dateTimeInstance.format(Date())
@@ -413,7 +408,7 @@ class AudioWaveformModule(context: ReactApplicationContext): ReactContextBaseJav
413408

414409
private val emitLiveRecordValue = object : Runnable {
415410
override fun run() {
416-
val currentDecibel = getDecibel()
411+
val currentDecibel = audioRecorder.getDecibel(recorder)
417412
val args: WritableMap = Arguments.createMap()
418413
if (currentDecibel == Double.NEGATIVE_INFINITY) {
419414
args.putDouble(Constants.currentDecibel, 0.0)

example/ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1946,4 +1946,4 @@ SPEC CHECKSUMS:
19461946

19471947
PODFILE CHECKSUM: 6f704d99bbe3053bd858eef7cb4caed0084ae50b
19481948

1949-
COCOAPODS: 1.15.2
1949+
COCOAPODS: 1.16.2

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"react-native": "0.77.0",
1616
"react-native-fast-image": "^8.6.3",
1717
"react-native-fs": "^2.20.0",
18-
"react-native-gesture-handler": "^2.23.1",
18+
"react-native-gesture-handler": "2.25.0",
1919
"react-native-safe-area-context": "^5.2.0",
2020
"rn-fetch-blob": "^0.12.0"
2121
},

ios/AudioPlayer.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ class AudioPlayer: NSObject, AVAudioPlayerDelegate {
3939
}
4040

4141
do {
42+
try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: [])
43+
try AVAudioSession.sharedInstance().setActive(true)
4244
player = try AVAudioPlayer(contentsOf: audioUrl!)
4345
player?.prepareToPlay()
4446
player?.volume = Float(volume ?? 100.0)
@@ -134,8 +136,8 @@ class AudioPlayer: NSObject, AVAudioPlayerDelegate {
134136
}
135137

136138
func seekTo(_ time: Double?, _ result: @escaping RCTPromiseResolveBlock) {
137-
if(time != 0 && time != nil) {
138-
player?.currentTime = Double(time! / 1000)
139+
if let time = time {
140+
player?.currentTime = Double(time / 1000)
139141
result(true)
140142
} else {
141143
result(false)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@simform_solutions/react-native-audio-waveform",
3-
"version": "2.1.5",
3+
"version": "2.1.6",
44
"description": "A React Native component to show audio waveform with ease in react native application",
55
"main": "lib/index",
66
"types": "lib/index.d.ts",

0 commit comments

Comments
 (0)