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 sound extension #100

Merged
merged 14 commits into from
Jan 5, 2023
Merged

Add sound extension #100

merged 14 commits into from
Jan 5, 2023

Conversation

softedco
Copy link
Contributor

@softedco softedco commented Dec 27, 2022

image
As suggested in #92
Playing sound from device didn't make it there because chrome blocks it.

@Mickmick21
Copy link

is it possible to add "play sound from url until done" ?

@softedco
Copy link
Contributor Author

is it possible to add "play sound from url until done" ?

Yes

@CST1229

This comment was marked as off-topic.

@GarboMuffin
Copy link
Member

GarboMuffin commented Dec 27, 2022

Change this to use Scratch's AudioContext (Scratch.vm.runtime.audioEngine.audioContext) instead of plain Audio elements. I think there's something like a "media element source". Otherwise this won't be able to reliably play audio in browsers that have autoplay disabled.

Copy link
Member

@GarboMuffin GarboMuffin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

Copy link
Member

@GarboMuffin GarboMuffin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some changes:

  • It will first try to play the sound using Scratch's audio engine, which means it'll integrate with volume, pitch, pan left/right, etc.
  • If the sound can't be played that way (most likely because the URL does not support CORS), it will instead just use an <audio> element, like the original version.

@SIPC
Copy link
Contributor

SIPC commented Jan 2, 2023

Is it possible to add "pause [url]" ?

@softedco
Copy link
Contributor Author

softedco commented Jan 2, 2023

Is it possible to add "pause [url]" ?

From the audio element it is, but I don't know if it is possible with the audioEngine.

@GarboMuffin
Copy link
Member

It will be possible in audio engine, just a good bit more annoying

@GarboMuffin
Copy link
Member

We'll do pausing later

@GarboMuffin GarboMuffin merged commit 7bf9dba into TurboWarp:master Jan 5, 2023
@GarboMuffin
Copy link
Member

GarboMuffin commented Jan 5, 2023

Whoever wants pausing: Open a new issue and describe which exact blocks you would like. There's a lot of ways this could be done and I don't want to have to change it later. Also less likely to be forgotten that way.

@softedco softedco deleted the patch-1 branch January 5, 2023 19:43
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.

5 participants