[Csnd] CORS errors in csound.js with midiplayer example
Date | 2020-12-04 15:16 |
From | Richard van Bemmelen |
Subject | [Csnd] CORS errors in csound.js with midiplayer example |
Attachments | Screenshot from 2020-12-04 16-13-56.png |
On Linux Mint with Chrome Version 87.0.4280.88, I get CORS errors when loading the page. This happens here: function CopyUrlToLocal(url, name, callback = null) { var xmlHttpRequest = new XMLHttpRequest(); xmlHttpRequest.onload = function() { var data = new Uint8Array(xmlHttpRequest.response); csound.Csound.writeToFS(name, data); callback(); }; xmlHttpRequest.open("get", url, true); xmlHttpRequest.responseType = "arraybuffer"; xmlHttpRequest.send(null); <====error I also include a screen shot |
Date | 2020-12-04 15:24 |
From | Victor Lazzarini |
Subject | Re: [Csnd] [EXTERNAL] [Csnd] CORS errors in csound.js with midiplayer example |
Are you serving your pages from a local http server? I see a file protocol there, maybe that’s the problem. Perhaps some of the web people here might know more. ======================== Prof. Victor Lazzarini Maynooth University Ireland > On 4 Dec 2020, at 15:16, Richard van Bemmelen |
Date | 2020-12-04 15:24 |
From | Steven Yi |
Subject | Re: [Csnd] CORS errors in csound.js with midiplayer example |
Hi Richard, This is normal for web development. You'll need load the site through a webserver rather than opening the html file directly. There's a note about this in the README.md: "You will also need a http-server to serve the WebAudio Csound source files." Easiest solution I use is editing in VS Code and using the Live Server plugin which allows you to click a file and "Open with Live Server". You can also use Python's built-in server (I can't recall the command for Python3 but it should be easy to find online) or install one with npm (i.e., http-server) Steven On Fri, Dec 4, 2020 at 10:16 AM Richard van Bemmelen |
Date | 2020-12-04 15:51 |
From | Rory Walsh |
Subject | Re: [Csnd] CORS errors in csound.js with midiplayer example |
You can also use an online JS editor and bypass the local server stuf. Repl.it is pretty nice, just upload your source there and away you go. CodePen, jsFiddle, the p5Js editor, etc, they can all be used to run and test CsoundWeb. On Fri, 4 Dec 2020 at 15:24, Steven Yi <stevenyi@gmail.com> wrote: Hi Richard, |
Date | 2020-12-04 16:02 |
From | Richard |
Subject | Re: [Csnd] [EXTERNAL] [Csnd] CORS errors in csound.js with midiplayer example |
I did start the supplied Python web server first. It works now, but only in Firefox. Chrome crashes badly... On 04/12/2020 16:24, Victor Lazzarini wrote: > Are you serving your pages from a local http server? I see a file protocol there, maybe that’s the problem. Perhaps some of the web people here might know more. > ======================== > Prof. Victor Lazzarini > Maynooth University > Ireland > >> On 4 Dec 2020, at 15:16, Richard van Bemmelen |
Date | 2020-12-04 16:24 |
From | Richard |
Subject | Re: [Csnd] CORS errors in csound.js with midiplayer example |
Of course Steven, how could I forget. On 04/12/2020 16:24, Steven Yi wrote: > Hi Richard, > > This is normal for web development. You'll need load the site through > a webserver rather than opening the html file directly. There's a note > about this in the README.md: > > "You will also need a http-server to serve the WebAudio Csound source files." > > Easiest solution I use is editing in VS Code and using the Live Server > plugin which allows you to click a file and "Open with Live Server". > You can also use Python's built-in server (I can't recall the command > for Python3 but it should be easy to find online) or install one with > npm (i.e., http-server) > > Steven > > On Fri, Dec 4, 2020 at 10:16 AM Richard van Bemmelen > |
Date | 2020-12-04 16:25 |
From | Richard |
Subject | Re: [Csnd] CORS errors in csound.js with midiplayer example |
Thanks, good to know! On 04/12/2020 16:51, Rory Walsh wrote:
|