Skip to content
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

Add pause stop and finished event notification #3

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

cymen
Copy link

@cymen cymen commented Aug 11, 2015

This PR adds support for:

  • pause
  • stop
  • unpause (just call play without a filename)
  • event notification when playback has finished

For the event notification, it made sense to register the callback when creating the player which means it made sense to have the player be a class we create an instance of. It doesn't have to be that way but it seemed straight forward. So I did that.

@cymen
Copy link
Author

cymen commented Aug 11, 2015

(it includes PR #2)

@cymen cymen mentioned this pull request Aug 11, 2015
* pause allows us to pause the playback
* play is refactored to allow unpausing (if no filename is passed)
* stop can stop the playback
* add event notification for playback finished
@cymen cymen force-pushed the cymen/add_pause_stop_and_finished_event_notification branch from 3018eef to 77bcc77 Compare August 11, 2015 08:15
@ghost
Copy link

ghost commented Sep 21, 2015

@cymen what are your thoughts on setting the play, pause and stop methods static so there's no need to call new on the class returned by AudioPlayer.js? Here's an example.

@cymen
Copy link
Author

cymen commented Sep 21, 2015

@JHabdas That might make more sense -- I don't recall why I thought it should be an instance. Probably because once you start being able to do more than just play, it seems like it is something that has state and an instance seems more logical. But I could see the argument for putting that behind static methods.

I ended up going native for the project I was using this on due to unrelated memory issues with react-native so I'm no longer using it.

@timhagn
Copy link

timhagn commented Dec 17, 2015

Hi @cymen,
any plans on porting your version to RN 0.16.0?
Am not that fluent in Objective-C (and that's an exaggeration ; )
so would be pleased if you could lend a helping hand.
Have to port my app from Android to iOS soon, so
help'd be very appreciated!

Regards,
Tim.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants