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

Function .currentTime() does not work properly on website #2

Closed
niki-ito opened this issue Aug 5, 2021 · 2 comments
Closed

Function .currentTime() does not work properly on website #2

niki-ito opened this issue Aug 5, 2021 · 2 comments

Comments

@niki-ito
Copy link
Owner

niki-ito commented Aug 5, 2021

Although this issue does not occur when the same code is run in the p5 editor when I run the code in my own development environment, the function .currentTime() does not work properly on Chome and Firefox. (Works fine on Safari)

Here is the p5.js sketch on the editor with .currentTime() properly functioning
Here is my personal development environment (click the thumbnail and hit the play button)

In this project, I use .currentTime() to show a time bar at the bottom and to loop through an array of words for the subtitles. Whenever I first start the audio, the function does not work. The console shows 0 as the .currentTime() regardless of whether the audio is playing.

I have found that if I refresh the browser, the function responds and works but only till I pause the audio. If I play it again, it does not continue to work.

These are the errors in the console:
Chome
-The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page.
-Uncaught TypeError: Cannot read property 'length' of undefined
Firefox
-Use of the orientation sensor is deprecated
-Use of the motion sensor is deprecated
-TypeError: arraySequence[0] is undefined

*The function works fine on Safari

@niki-ito
Copy link
Owner Author

niki-ito commented Aug 5, 2021

It seems like this link shows how to fix this error but I do not understand what I am supposed to do exactly.

@niki-ito
Copy link
Owner Author

This issue was solved by visiting the link above and realizing that I had been using an older version. I was using V 0.3.12 (Jan 6th, 2020). Downloading the newer version V 1.4.0 (Jan 24th, 2021) from the p5 website fixed all the issues with p5.sound.

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

No branches or pull requests

1 participant