some css changes to w0bmcustom.css and glitch.css, some changes in irc.blade.php regarding the visibility of the page for non logged in users, some minor changes to the upload page and a big change to the video page by adding the first interactive upload with loops to w0bm

This commit is contained in:
noxy
2020-01-29 13:03:40 +00:00
parent 1399b95004
commit 923d9be188
59 changed files with 2316 additions and 4 deletions

87
public/loop/loopify.js Normal file
View File

@@ -0,0 +1,87 @@
(function() {
function loopify(uri,cb) {
var context = new (window.AudioContext || window.webkitAudioContext)(),
request = new XMLHttpRequest();
request.responseType = "arraybuffer";
request.open("GET", uri, true);
// XHR failed
request.onerror = function() {
cb(new Error("Couldn't load audio from " + uri));
};
// XHR complete
request.onload = function() {
context.decodeAudioData(request.response,success,function(err){
// Audio was bad
cb(new Error("Couldn't decode audio from " + uri));
});
};
request.send();
function success(buffer) {
var source;
function play() {
// Stop if it's already playing
stop();
// Create a new source (can't replay an existing source)
source = context.createBufferSource();
source.connect(context.destination);
var gainNode = context.createGain();
gainNode.gain.value = -0.8;
gainNode.connect(context.destination);
source.connect(gainNode);
document.getElementById('volume').addEventListener('change', function() {
gainNode.gain.value = this.value;
});
// Set the buffer
source.buffer = buffer;
source.loop = true;
// Play it
source.start(0);
}
function stop() {
// Stop and clear if it's playing
if (source) {
source.stop();
source = null;
}
}
cb(null,{
play: play,
stop: stop
});
}
}
loopify.version = "0.1";
if (typeof define === "function" && define.amd) {
define(function() { return loopify; });
} else if (typeof module === "object" && module.exports) {
module.exports = loopify;
} else {
this.loopify = loopify;
}
})();