loadSound pause() method working similarly to stop()
Most appropriate sub-area of p5.js?
- [ ] Accessibility (Web Accessibility)
- [ ] Build tools and processes
- [ ] Color
- [ ] Core/Environment/Rendering
- [ ] Data
- [ ] DOM
- [ ] Events
- [ ] Friendly error system
- [ ] Image
- [ ] IO (Input/Output)
- [ ] Localization
- [ ] Math
- [ ] Unit Testing
- [ ] Typography
- [ ] Utilities
- [ ] WebGL
- [x] Other (specify if possible)
Details about the bug:
- p5.js version: 1.1.9
- Web browser and version: Chrome 86.0.4240.198
- Operating System: Mac OSV
- Steps to reproduce this: Toggling between pause and play for when loading in sound using the loadSound function stops and starts the audio again from the beginning rather than from the place it was paused. If you use createAudio then it works properly. loadSound example not working properly: https://editor.p5js.org/dannewoo/sketches/PBnk-Hg50 createAudio example working properly: https://editor.p5js.org/dannewoo/sketches/WlVwWTGwq
Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.
I'm also experiencing this issue. I've also noticed that currentTime() always returns 0. Here is my example: https://editor.p5js.org/intermodal/sketches/0vNe_x4vZ
This may be a known issue, given line 742 in https://github.com/processing/p5.js-sound/blob/master/src/soundfile.js.
A few additional notes:
- This seems to be browser-specific. I am in Chrome 87.0.4280.88, and play() is restarting from the beginning after a pause(). However, a user in the CodingTrain discord channel tested the sketch i pasted above in Firefox v72, and it worked as is meant to (play() resumes from the point at which it was paused).
- This issue is specific to P5.SoundFile. P5.MediaElement works as expected. I tried loading my mp3 using createAudio(), and play() resumed from the point at which it was paused
hey, @endurance21 is this really a good-first-issue? as the problem is clearly a browser-specific one and it does not seem like a simple issue to fix to me.
Also, I observed that in the example mentioned by @pdmeyer, song.currentTime() is also not being updated from zero in chrome but it's working fine in my safari browser.
Is this is an issue on p5 web editor or p5 sound library?
Please help me understand this.. I am fairly new to this project
Confirmed that the issue is not isolated to the web editor.
When I run this in Chrome, it's posting an error to the console that points to the push function within the RingBuffer class, where it attempts to set sourceLength to arraySequence[0].length. It appears arraySequence is undefined.
This exact line was updated in https://github.com/processing/p5.js-sound/commit/6c54c282c87e8ce122715e3122abe510e0f9ff7e, so it seems to me like this recent version of RingBuffer.js simply needs to be merged into the sound library that is available on the CDN.
@satyasaibhushan these are some important and feature breaking issues and I believe new comers are more enthusiastic , however there are bunch of other GFE .
You can have a look on them as well. @pdmeyer I think, we should really wait for the release and then you can test the same . We are planning to have a new release soon.
ok perfect, thanks @endurance21