nstudio / nativescript-audio

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

isAudioPlaying() static? #101

Open martin-juul opened 6 years ago

martin-juul commented 6 years ago

Hi,

When i query isAudioPlaying() - it's static. So when i pause a currently playing track, it will show up as playing. Is there a reason for this?

  /**
   * Check if the audio is actively playing.
   */
  isAudioPlaying(): boolean; <-- Not a promise
bradmartin commented 6 years ago

Hi @martin-juul - not sure I entirely understand and I'm not aware of any reasoning :) the originals of this source code is ~2 years old.

At any rate, glad to help figure out any issue you have.

I looked at the source and https://github.com/nstudio/nativescript-audio/blob/master/src/ios/player.ts#L301 that method isn't static on the class instance. It's just a simple method to check if the player is playing.

What's your use case utilizing with pause, maybe a small logic/control flow change is all you need. Let me know if you figured it out or still need help.

Thanks