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

Sound recording will not work in 2017 with p5.js? #1739

Closed
mmsmodell opened this issue Jan 3, 2017 · 10 comments
Closed

Sound recording will not work in 2017 with p5.js? #1739

mmsmodell opened this issue Jan 3, 2017 · 10 comments

Comments

@mmsmodell
Copy link

Dear Developers,

I have been using this very nice feature of P5.js which allowed me to record sound in browsers. However, it seems some key functions will be removed in 2017.

Chrome displays the following message on the Consol, even using P5 JS Example for Recording sounds -

'MediaStreamTrack.getSources is deprecated and will be removed in M56, around January 2017. See https://www.chromestatus.com/features/4765305641369600 for more details.'

Will there be a workaround to handle this problem? If so, what and how will I have to modify in the code to work again?

Ps. It would also be great that the recording source (Primary Mic, LineIn, Optical In, Webcam Mic, Headset mic), etc, all other such sources would be easily listable-selectable for the Client and there would be a very simple example on how to let the User select the source, maybe included in the 'Recording and Saving / Playing Sound' example on P5 Js's main Examples page.

Awaiting Your kind reply, and appreciate all Your work!
-Gergely Nagy / Hungary

@bmoren
Copy link
Contributor

bmoren commented Jan 4, 2017

It seems like we will need to replace / rewrite the part of the p5.sound lib that uses the getSources, and instead use the enumerateDevices. I'm guessing that this will also need to be executed on secure origins in the future (read: HTTPS instead of HTTP)

https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices

There could be some cross browser issues here too that I'm missing, I'm assuming from your comment that you are using chrome, can you possibly test on some other browsers too to see if you replicate the error? I'm pretty sure getSources wont work in firefox, so this might be a good fix to do anyway.

@mmsmodell
Copy link
Author

Hi, I tested my audio webpage (using p5.js) using Firefox and Microsot Edge as well, and to my surprise, they were working - they recorded the audio and saved it, it was all perfect. Yeah, for Chrome I will need HTTPS, but I guess it's not a developer issue - it's the decision of Chrome, Firefox, etc.

But from the comments left by Google at https://www.chromestatus.com/features/4765305641369600 it seems that there's consent among Chrome Firefox and Ie/Edge to cancel the support for MediaStreamTrack.getSources - so I guess the p5.js recording code will not work in either browsers very soon (Google cite an update expected in January 2017, so pretty much any moment now).

I would wery much like to continue using p5.js, where/hown shoud I address or kindly ask the core developers to handle this issue, if they have the capacity to do so? Really appreciate their efforts.

@bmoren
Copy link
Contributor

bmoren commented Jan 15, 2017

this is the place to address the 'core team' (using that term very loosely here), I'm sure lauren or others have seen this issue. Perhaps you should make a fork and have a try at it? p5 is about inclusiveness and getting everyone on board. It'd be great if you gave it a try!

@lmccart
Copy link
Member

lmccart commented Jan 15, 2017

yep thanks all! I'm aware of this one and hoping to look into it very soon. :)

@mmsmodell
Copy link
Author

mmsmodell commented Jan 17, 2017 via email

lmccart added a commit to processing/p5.js-sound that referenced this issue Jan 19, 2017
@lmccart
Copy link
Member

lmccart commented Jan 19, 2017

fixed with processing/p5.js-sound#160, it will be in the next release of p5.sound.js

@lmccart lmccart closed this as completed Jan 19, 2017
@mmsmodell
Copy link
Author

I am very grateful, thank You very much for the fix! I hope to update my webpage ASAP.

Yours,
-Gergely / Hungary

@lmccart
Copy link
Member

lmccart commented Jan 19, 2017

if you need it sooner than the next release, there's a copy here: https://github.com/processing/p5.js-sound/blob/master/lib/p5.sound.js

@mmsmodell
Copy link
Author

mmsmodell commented Jan 19, 2017 via email

@AdiWeit
Copy link

AdiWeit commented Sep 24, 2018

My recording of the sound volume doesn´t work in chrome on PC, on my smartphone and my normal browser on my phone.
I just evven don´t get a request to use the audio.

So, I tryed it with this code :

<script src="http://adi.nicolaiweitkemper.de/p5.sound.js"></script>

<h2 id="text"></h2>

<script>

var mic;

function setup() {
  mic = new p5.AudioIn();
  mic.start();
}

function draw() {
  var vol = mic.getLevel();
  document.getElementById('text').innerHTML = vol;
}

</script>

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

4 participants