Parsedown Viewer: README.md |
If you are just looking to play your own loop, contact me (see contact section). Be prepared to provide me the audio file, and which section you want looped. As this is a free service, there is no guarantee of how quickly I will get to your request. I may add your loop to the player, or add it as a hidden option just for you, depending on how I like it.
This section is for if you would like to use your own loop using my existing player, without setting it up on your own site.
If you have already made a loop yourself, there is an external= option now. You can put the URL to your loop as ?external=https://your.site/yourfile.mp3
You can pass the parameter flags to it with externalflags=
Here is a working example:
Hopefully that will give you an idea.
Two things to note about this:
We use HTTPS, which means your external URL needs to also be HTTPS, or the browser will likely refuse to load it (insecure element on secure page).
This script is affected by Browser CORS Support. Meaning, you need to authorize "https://loops.planeptune.org" to access your site via a header that can be added to .htaccess with the following line:
Header set Access-Control-Allow-Origin "*"
OR, to allow JUST my site:
Header set Access-Control-Allow-Origin "https://loops.planeptune.org"
This needs to be added to your website. If you do not own the website your loop is hosted on, the best I can say is try it, if it doesn't work, they dont allow external sites.
This section is for if you clone the loop player code to your own server, and are trying to set it up.
The player is designed to support loops provided in up to 6 formats.
The player will look on the server for .opus, .webm (encoded in vorbis), .m4a (aac), and/or .mp3 files. If lossless == true in the audio config file for that loop, it also expects a .wav and/or .flac file. Optimally, you would provide all 6 formats (or at least the 4 lossy) to the server, and let the player choose which one to load.
The player will search in order of the highest quality the browser supports, in the following order (depending on codec support):
We do this by sending a HEAD request to the server to see if the file exists, and if it does not, we move on to try the next. This may, in some cases, cause user lag if it has to search a few files before finding one.
Note that this does not apply to external loops passed via external=. We only load the file passed in that case, and do not care about other formats. Be sure the file you pass via external= is cross-compatible. AAC or MP3 is recommended.
Unlike my old flash loop player, the bit rate does not matter. The sample rate no longer matters either. In fact, gone is the old method of calculating samples. Now we use milliseconds. Mono and stereo are both supported as well.
Please keep in mind this so-called documentation, and the source code are provided as a courtesy for developers. This not meant to be user-friendly. Knowledge of JavaScript/ECMAScript, and even some WebAudio may be required.
This code is licensed under the CC BY-SA 4.0 license. This means you can basically do whatever you want with it, even commercially. But you have to share any changes you make to it. Don't be a dick and just copy it and sell it. And if you do modify it, don't be a dick and violate the license, like many companies like to do.
Is it really that hard to give credit?
Also, if you contact me to add your loop, you authorize me to distribute it and use it as I see fit.
You can reach me on Twitter, via @zefie. Feel free to send a thanks, or bug report, or tell me how much my player sucks on your Windows XP IE8 machine. I don't care ;)
If you are a dev and found my work useful to you, feel free to send me a kudos on Twitter, or if you are really feeling generous, you can donate :)
Donations are not required, but gladly accepted. I have spent many sleepless nights working on this code to make sure it is the best experience across the most platforms. If you wish to buy me a drink, you can do so here.