diff options
-rw-r--r-- | src/js/arching-kaos-decentralized-radio.js | 42 | ||||
-rw-r--r-- | src/js/arching-kaos-modules-mixtapes.js | 2 | ||||
-rw-r--r-- | src/js/arching-kaos-tools.js | 1 |
3 files changed, 41 insertions, 4 deletions
diff --git a/src/js/arching-kaos-decentralized-radio.js b/src/js/arching-kaos-decentralized-radio.js index 7cec5b1..c8b99d1 100644 --- a/src/js/arching-kaos-decentralized-radio.js +++ b/src/js/arching-kaos-decentralized-radio.js @@ -8,10 +8,46 @@ radio.addEventListener("pause", ()=>{ radioButton.innerHTML = '<svg width="32px" height="32px" viewBox="0 0 33.866666 33.866666" version="1.1" id="svg1" inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)" sodipodi:docname="play-button.svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"> <sodipodi:namedview id="namedview1" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:showpageshadow="2" inkscape:pageopacity="0.0" inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" inkscape:document-units="px" inkscape:zoom="2.56" inkscape:cx="34.960938" inkscape:cy="49.609375" inkscape:window-width="1364" inkscape:window-height="722" inkscape:window-x="1366" inkscape:window-y="22" inkscape:window-maximized="1" inkscape:current-layer="layer1" /> <defs id="defs1" /> <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1"> <path id="rect1" style="fill:#fe3f00;stroke:#000000;stroke-width:4.18075;stroke-dasharray:25.0845, 25.0845" d="M 2.0903761,2.0903745 31.383535,16.963796 2.0903761,31.776288 Z" sodipodi:nodetypes="cccc" /> </g> </svg>'; }) -function radioToggle(){ - if (radio.paused) { +var played = []; +var list = mixtapeIds; +var currentPlaying = 0; + + +function radioLoad() +{ + var elem = document.querySelector('#'+mixtapeIds[0]).firstChild.cloneNode(true); + currentPlaying = 0; + radio.appendChild(elem); + radio.play(); +} + +function radioLoadNextAndPlay() +{ + currentPlaying += 1; + radio.removeChild(radio.firstChild); + var elem = document.querySelector('#'+mixtapeIds[currentPlaying]).firstChild.cloneNode(true); + if ( elem !== null ) + { + radio.appendChild(elem); + radio.load(); radio.play(); - } else { + } + else + { + radioLoad(); + } +} + +radio.addEventListener("ended", radioLoadNextAndPlay); + +function radioToggle() +{ + if (radio.paused) + { + radio.play(); + } + else + { radio.pause(); } } diff --git a/src/js/arching-kaos-modules-mixtapes.js b/src/js/arching-kaos-modules-mixtapes.js index f12e2ea..79efe99 100644 --- a/src/js/arching-kaos-modules-mixtapes.js +++ b/src/js/arching-kaos-modules-mixtapes.js @@ -28,7 +28,7 @@ function akModuleMixtapes(zblockIPFSHash, zblockObject, blockObject, json){ source.src = getIPFSURL(json.ipfs); var rs = source.cloneNode(true); audio.appendChild(source); - radio.appendChild(rs); + //radio.appendChild(rs); art.appendChild(audio); audio.addEventListener( "loadedmetadata", ()=>{ if ( mixtapes[zblockIPFSHash] === undefined ){ diff --git a/src/js/arching-kaos-tools.js b/src/js/arching-kaos-tools.js index 1de38a9..755290c 100644 --- a/src/js/arching-kaos-tools.js +++ b/src/js/arching-kaos-tools.js @@ -157,6 +157,7 @@ function blockRenderAndProceed(json, params){ } } resolveReferences(references); + radioLoad(); } else { console.log("deep in :" +group); if (recursive) seekZblock(json.previous, [group]); |