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

Player not advancing to next block in background mode #22

Closed
gshotwell opened this issue Apr 3, 2017 · 6 comments
Closed

Player not advancing to next block in background mode #22

gshotwell opened this issue Apr 3, 2017 · 6 comments
Labels
Milestone

Comments

@gshotwell
Copy link
Owner

When you lock the device it will play the end of the current gong or contemplation, but not advance to the next block

@gshotwell gshotwell added the bug label Apr 3, 2017
@gshotwell gshotwell modified the milestone: 2.0 Apr 3, 2017
@gshotwell
Copy link
Owner Author

@gshotwell
Copy link
Owner Author

I think this might be doable if I keep a silent sound running throughout the whole timer, so two tracks playing, one of which is a silent sound which repeats and has a volume of zero, the other is the actual session track.

@gshotwell
Copy link
Owner Author

Works! It seems like if I do a console log when the video loads it plays properly. I have no idea why this works but I'll take it.

@gshotwell
Copy link
Owner Author

Doesn't work! Looks like I need to refactor to have everything on RN Sound as they are enabling loading sounds from the network

@gshotwell gshotwell reopened this Apr 10, 2017
@gshotwell
Copy link
Owner Author

@gshotwell
Copy link
Owner Author

gshotwell commented Apr 11, 2017

Boy this is a tough issue. The big issue is that we need to preload each block file, but at the same time we need to make sure that we don't have a hundred sounds loaded up. So we need some process to load sounds a fe blocks ahead of time, so that there aren't any gaps when they play.

Here is my current plan:

  • 1) Load the first block into state state.firstSound on componentWillMount()
  • 2) At the same time load the first four sounds into a stateful array with a key this.state.loadedSounds
  • 3) Load first block into this.state.playingSound()
  • 4) Whenever we finish a block, load the block from the loadedSounds array which matches the next block in the playerArray into this.state.playingSound. At the same time load the i + 4th sound and push it to this.state.loadedSounds. We also need to release the sound which was previously playing.
  • 5) Add a spinner so that whenever this.state.playingSound isn't loaded the player pauses itself, spins, then unpauses itself when the block loads.
  • 6) Keep the firstSound loaded in state, and when the timer is reset move it back to this.state.playingSound and then redo the rest.
  • 7) Release all sounds when component unmounts

Test cases:

  • play one of each block in background
  • play two gongs next to eachother
  • play two contemplations next to eachother
  • play two sitting sessions next to eachother
  • play a session with one block
  • play a session with 10 blocks.

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

No branches or pull requests

1 participant