demo UI has "now" support
This commit is contained in:
parent
5bfe52c235
commit
a3dcb0795a
2 changed files with 20 additions and 5 deletions
10
index.html
10
index.html
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<style>
|
||||
#show-info {border: 1px solid gray; max-width: 20em; padding: 0.3em; font-family: monospace;}
|
||||
.info {border: 1px solid gray; max-width: 20em; padding: 0.3em; font-family: monospace;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -11,11 +11,11 @@
|
|||
<script src="dist/radiomanifest-oldstyle.bundle.js"></script>
|
||||
<script src="ui.js"></script>
|
||||
<div id="player">
|
||||
<audio controls>
|
||||
</audio>
|
||||
<audio controls>
|
||||
</audio>
|
||||
<div class="info" id="now-info"></div>
|
||||
</div>
|
||||
<div id="show-info">
|
||||
</div>
|
||||
<div class="info" id="show-info"> </div>
|
||||
<div id="shows">
|
||||
<ul>
|
||||
</ul>
|
||||
|
|
15
ui.js
15
ui.js
|
@ -1,4 +1,15 @@
|
|||
// const radiomanifest = require('radiomanifest.js')
|
||||
|
||||
function updateNow(radio) {
|
||||
var box = document.querySelector('#now-info')
|
||||
const show = radio.getSchedule().getNowShow()
|
||||
try {
|
||||
var text = show.getName()
|
||||
} catch (e) {
|
||||
var text = String(show)
|
||||
}
|
||||
box.textContent = text
|
||||
}
|
||||
async function fai () {
|
||||
const radio = await radiomanifest.get('https://radiomanifest.degenerazione.xyz/v0.2/examples/full-ondarossa')
|
||||
console.log('radio?', radio)
|
||||
|
@ -34,6 +45,10 @@ async function fai () {
|
|||
const info = document.querySelector('#show-info')
|
||||
info.textContent = radio.getShowByName(evt.target.dataset['show']).getFeed()
|
||||
}, true)
|
||||
|
||||
updateNow(radio)
|
||||
console.log(radio.getSchedule())
|
||||
setInterval(function() { updateNow(radio) }, 2000)
|
||||
}
|
||||
|
||||
fai()
|
||||
|
|
Loading…
Reference in a new issue