nstudio / nativescript-audio

:microphone: NativeScript plugin to record and play audio :musical_note:
Other
149 stars 104 forks source link

Duration metric unit difference between iOS and Android breaks seekTo in iOS #162

Open joshstallnick opened 4 years ago

joshstallnick commented 4 years ago

I currently have an audio example of:

Android duration: 260049 iOS duration: 260.048875

Without realizing, I implemented the seekTo method using the android duration which I assume is in milliseconds. The documentation for the seekTo method states that it is in seconds, which would lead me to believe that seeking by milliseconds would provide incorrect results.

It currently breaks with a calculation of the the iOS duration - which I assume is in seconds since my audio file is roughly 4 mins. This makes sense that it would break if it handles for the android. This calculation is of the effect of (0.15 * 260.048875) to seek to 15% of the duration.

I tried to mutiply the iOS seek to value by 1000 to get it to equal what the android does but that still breaks and ends the recording.