Comments (5)
This is not a proposal to get rid of module loading AudioWorklet
, only to provide alternative methods of initiating AudioWorklet
- the inline code will still be in, or create AudioWorkletGlobalScope
- just not using (Ecmascript/JavaScript) modules.
from web-audio-api-v2.
This should be talked about at the EcmaScript and Worklet level before considering using it in Web Audio, this is not really a Web Audio API issue.
Using AudioWorklet
without multiple source file and without doing any fetch is possible today however:
<script type="worklet">
registerProcessor('test-param', class param extends AudioWorkletProcessor {
constructor() {
super();
console.log("ctor");
}
process(input, output, parameters) {
return true;
}
});
</script>
<script>
var ac = new AudioContext;
var source = document.querySelector("script[type=worklet]")
var text = source.innerText;
const blob = new Blob([text], {type: "application/javascript"});
var url = URL.createObjectURL(blob);
ac.audioWorklet.addModule(url).then(() => {
var node = new AudioWorkletNode(ac, 'test-param');
});
</script>
Here I'm using a separate script tag, with a type
of "worklet"
. If it's not a JavaScript MIME type (or is not omitted, like here), it's treated as a simple data block that is not executed, but using a simple string also works well.
from web-audio-api-v2.
This should be talked about at the EcmaScript and Worklet level before considering using it in Web Audio
@padenot I am banned from both WHATWG/HTML and TC39 so I will not be able to file issues at those entities.
Using AudioWorklet without multiple source file and without doing any fetch is possible today however:
If you run the code you posted at console
at this page or any on github.com you will get CSP errors. I used Chromium DevTools Local Overrides to workaround the issue. However, there should be a means to load AudioWorklet
without making a fetch request if we have the inline code already.
It is a Web Audio issue because in this case using Ecmascript module restricts the ability of AudioWorklet
usage at the outset.
from web-audio-api-v2.
This should be talked about at the EcmaScript and Worklet level
I do not see how those specifications are controlling as to Web Audio.
Using
AudioWorklet
without multiple source file and without doing any fetch
A fetch request is made in the code example you posted at
var url = URL.createObjectURL(blob);
ac.audioWorklet.addModule(url)
what I propose is that an option exist to initiate AudioWorklet
using inline code, without making any request.
from web-audio-api-v2.
What happens when a user tries to create an AudioWorklet
instance on github.com for example this page using the code at #109 (comment)?
from web-audio-api-v2.
Related Issues (20)
- V2 documentation logistics HOT 2
- interaction between audio elements and the Web Audio API HOT 2
- Add ability to pause/resume AudioBufferSourceNode HOT 11
- AudioOutputContext HOT 21
- AnalyserNode: provide access to complex FFT result HOT 15
- AnalyserNode: efficiency improvements to FFT post-processing HOT 3
- Should 'Atomics.wait' be available in AudioWorklets associated with an OfflineAudioContext? HOT 8
- Request to Expose AudioBuffer to DedicatedWorker HOT 29
- Rename master branch to main HOT 2
- Set up to display the spec. HOT 10
- AudioWorklet should have a 'oversample' and a 'bufferSize' property HOT 5
- cancelScheduledValues and cancelAndHoldAtTime throws RangeError for non-finite
- Switching between 2 Microphones HOT 1
- No way to convert data from WebCodecs AudioData to AudioBuffer HOT 7
- Add frequency of one oscillator to be based on another HOT 1
- Define TextEncoderStream(), and TextDecoderStream() in AudioWorkletGlobalScope HOT 1
- Add Travis CI HOT 1
- RawPCMStreamNode (StreamNode, or InputStreamNode) HOT 8
- Set up PR review HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from web-audio-api-v2.