sebpiq / WebPd

Run your Pure Data patches on the web.
GNU Lesser General Public License v3.0
932 stars 89 forks source link

Examples don't work with Chrome or Safar #110

Closed batchku closed 7 years ago

batchku commented 7 years ago

Hello, I'm trying to run the examples, using a python http server, but can't get anything going. I'm testing with:

I see errors like this in the terminal:

ali-2017-MBP13:metro ali$ python -m http.server 8001
Serving HTTP on 0.0.0.0 port 8001 ...
127.0.0.1 - - [30/Sep/2017 14:42:24] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [30/Sep/2017 14:42:24] code 404, message File not found
127.0.0.1 - - [30/Sep/2017 14:42:24] "GET /assets/jquery-2.1.0.min.js HTTP/1.1" 404 -
127.0.0.1 - - [30/Sep/2017 14:42:24] code 404, message File not found
127.0.0.1 - - [30/Sep/2017 14:42:24] "GET /assets/pd-fileutils.js HTTP/1.1" 404 -
127.0.0.1 - - [30/Sep/2017 14:42:24] code 404, message File not found
127.0.0.1 - - [30/Sep/2017 14:42:24] "GET /dist/webpd-latest.js HTTP/1.1" 404 -
127.0.0.1 - - [30/Sep/2017 14:42:24] code 404, message File not found
127.0.0.1 - - [30/Sep/2017 14:42:24] "GET /assets/examples.js HTTP/1.1" 404 -
127.0.0.1 - - [30/Sep/2017 14:42:24] code 404, message File not found
127.0.0.1 - - [30/Sep/2017 14:42:24] "GET /assets/examples.css HTTP/1.1" 404 -
127.0.0.1 - - [30/Sep/2017 14:44:04] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [30/Sep/2017 14:44:04] code 404, message File not found
127.0.0.1 - - [30/Sep/2017 14:44:04] "GET /assets/jquery-2.1.0.min.js HTTP/1.1" 404 -
127.0.0.1 - - [30/Sep/2017 14:44:04] code 404, message File not found
127.0.0.1 - - [30/Sep/2017 14:44:04] "GET /assets/pd-fileutils.js HTTP/1.1" 404 -
127.0.0.1 - - [30/Sep/2017 14:44:04] code 404, message File not found

Is anyone succeeding in getting the examples to work?

sebpiq commented 7 years ago

Are the online examples working in the same browsers?

mgsx-dev commented 7 years ago

Do you running the python server in the right folder ?

"GET /dist/webpd-latest.js HTTP/1.1" 404 -

batchku commented 7 years ago

Thanks for your quick response Seb. I was able to get the setup running with your quick instructions; I have this html:

<!doctype HTML>
<html>
  <head>
    <script src="js/jquery.js"></script>
    <script src="js/webpd-latest.js"></script>
    <script>
        var patch
        $.get('patches/myPatch.pd', function(patchStr) {
          patch = Pd.loadPatch(patchStr)
          Pd.start()
        })
    </script>
  </head>

  <body></body>
</html>

Put the WebPd.js and thejquery.js in a folder called js and my patch my patches, called myPatch.pd. Makes sound!

Am I correct in thinking that the browser can also render the patch diagram for me? Something special i need to do to make that happen?

sebpiq commented 7 years ago

Yes! You need to use that library : https://github.com/sebpiq/pd-fileutils

You can see how I use to render a patch it in the examples : https://github.com/sebpiq/WebPd/blob/master/examples/assets/examples.js