Skip to content

Commit

Permalink
add play/pause button, misc improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
agnaite committed Oct 26, 2023
1 parent b32046e commit 93dbef4
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 11 deletions.
67 changes: 56 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,65 @@
</head>

<body>
<h2 class="title">untz untz untz</h2>
<audio class="audio" autoplay src="https://stream-relay-geo.ntslive.net/stream">
<h2 class="title" id="title">untz untz untz</h2>

<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<div id="loading"></div>
<div class="btn" id="playBtn"></div>
<div class="btn" id="pauseBtn"></div>

<!-- Google analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
<script type="jquery" src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/howler/2.2.4/howler.min.js"></script>

ga('create', 'UA-53076324-1', 'auto');
ga('send', 'pageview');
<script>
playBtn = document.getElementById('playBtn');
pauseBtn = document.getElementById('pauseBtn');
title = document.getElementById('title');
loading = document.getElementById('loading');

var sound = new Howl({
src: ['https://stream-relay-geo.ntslive.net/stream'],
html5: true,
preload: true,
onload: function() {
loading.style.display = 'none';
pauseBtn.style.display = 'block';
title.style['-webkit-animation-play-state'] = 'running';
title.style['animation-play-state'] = 'running';
},
onplay: function() {
loading.style.display = 'none';
pauseBtn.style.display = 'block';
title.style['-webkit-animation-play-state'] = 'running';
title.style['animation-play-state'] = 'running';
},
onpause: function() {
playBtn.style.display = 'block';
pauseBtn.style.display = 'none';
title.style['-webkit-animation-play-state'] = 'paused';
title.style['animation-play-state'] = 'paused';
}
});

playBtn.addEventListener('click', function() {
playBtn.style.display = 'none';
loading.style.display = 'block';
sound.play();
});

pauseBtn.addEventListener('click', function() {
sound.pause();
});
</script>

<!-- Google analytics -->
<script type="google-analytics">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-53076324-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>
67 changes: 67 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ body {
padding-top: 5px;
line-height: 1.7;

}

#title {
-webkit-animation: colour 1s linear;
-webkit-animation-iteration-count: infinite;
-webkit-animation-play-state: paused;

animation: colour 1s linear;
animation-iteration-count: infinite;
animation-play-state: paused;

}


Expand Down Expand Up @@ -74,5 +80,66 @@ body {
}
}

.btn {
position: absolute;
cursor: pointer;
opacity: 0.9;
-webkit-filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.33));
filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.33));
-webkit-user-select: none;
user-select: none;
}
.btn:hover {
opacity: 1;
}
#playBtn {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEUAAABGCAYAAACaGVmHAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTExIDc5LjE1ODMyNSwgMjAxNS8wOS8xMC0wMToxMDo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AcSyhgOBZRhnEso3TjeEBpxvGEUo3jEeUWxzPKKU6gFHACpYATKMfegbLDWOcRl/Jr2X7JHI+2gOEZ5RTDI8othieUagwPKM0YllG6MSyiDGNYQgHDsIACjqEZBQ1DIwo6hiYUMgwNKOQYklHYMCSisGNIQhGDIQFFHAYnilgMDhTxGJQoajAoUNRhYKKoxcBAUY8BiWIGAwLFHMYIilmMHhTzGC0objBqUNxhXKG4xSihuMfYo8yB8d9HgAEATyefBJWpw70AAAAASUVORK5CYII=');
width: 69px;
height: 70px;
left: 0%;
top: 0%;
margin-left: 20px;
margin-top: 20px;
}
#pauseBtn {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEUAAABGCAYAAACaGVmHAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTExIDc5LjE1ODMyNSwgMjAxNS8wOS8xMC0wMToxMDoyMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTUgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MDE4MjkzRjNDNzI0MTFFNTk2RTBDMTRBMkYyNjVGMzQiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MDE4MjkzRjRDNzI0MTFFNTk2RTBDMTRBMkYyNjVGMzQiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBOERFOEQ1Q0M2QkQxMUU1OTZFMEMxNEEyRjI2NUYzNCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDowMTgyOTNGMkM3MjQxMUU1OTZFMEMxNEEyRjI2NUYzNCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pne5d1AAAAB8SURBVHja7NCxCQAwAALBuP/QZoEUlinua0G4tD1j83Asv/4GChQoUKBAgQIFChQoUKBAgQIFChQoUKBAgQIFChQoUKBAgQIFChQoUKBAgQIFChQoUKBAgQIFChQoUKBAgQIFChQoUKBAgQIFChQoUKBAgQIFCpRXV4ABAOgpXYTDYwEwAAAAAElFTkSuQmCC');
width: 69px;
height: 70px;
left: 0%;
top: 0%;
margin-left: 20px;
margin-top: 20px;
display: none;
}

#loading {
position: absolute;
left: 0%;
top: 0%;
margin-left: 20px;
margin-top: 20px;
width: 70px;
height: 70px;
background-color: #fff;
border-radius: 100%;
-webkit-animation: sk-scaleout 1.0s infinite ease-in-out;
animation: sk-scaleout 1.0s infinite ease-in-out;
display: none;
}
@-webkit-keyframes sk-scaleout {
0% { -webkit-transform: scale(0) }
100% {
-webkit-transform: scale(1.0);
opacity: 0;
}
}
@keyframes sk-scaleout {
0% {
-webkit-transform: scale(0);
transform: scale(0);
} 100% {
-webkit-transform: scale(1.0);
transform: scale(1.0);
opacity: 0;
}
}

0 comments on commit 93dbef4

Please sign in to comment.