Last active
September 6, 2020 09:12
-
-
Save d3v1an7/1ca8101f307bf958fefe5b091b35501b to your computer and use it in GitHub Desktop.
Now Playing for Spotify in OBS/Streamlabs OBS via Snip
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="container"> | |
<img id="cover" src="Snip_Artwork.jpg" /> | |
<div id="text"> | |
<div id="track"></div> | |
<div id="artist"></div> | |
</div> | |
</container> | |
<style> | |
body { | |
background-color: rgba(0, 0, 0, 0); | |
margin: 0 auto; | |
overflow: hidden; | |
font-size: 10px; | |
} | |
#container { | |
background: rgba(0, 0, 0, .8); | |
border-radius: 15px; | |
display: flex; | |
flex-flow: row nowrap; | |
height: 100%; | |
width: 100%; | |
} | |
img { | |
border-radius: 15px 0 0 15px; | |
height: 100%; | |
margin-right: 4%; | |
width: auto; | |
background: url("https://developer.spotify.com/assets/branding-guidelines/[email protected]") no-repeat; | |
background-size: cover; | |
} | |
#text { | |
align-self: center; | |
color: #fff; | |
display: flex; | |
flex-flow: column nowrap; | |
font-family: "Lato", sans-serif; | |
font-size: 1rem; | |
margin-right: 4%; | |
} | |
#artist, #track { | |
-webkit-box-orient: vertical; | |
-webkit-line-clamp: 2; | |
display: -webkit-box; | |
overflow: hidden; | |
} | |
#artist { | |
margin-top: 3%; | |
} | |
#track { | |
-webkit-line-clamp: 2; | |
font-size: 1.3rem; | |
font-weight: 700; | |
} | |
</style> | |
<script src="https://unpkg.com/jquery"></script> | |
<script> | |
setInterval(function() { | |
var cachebuster = new Date().getTime(); | |
var image = document.getElementById("cover"); | |
image.src = "Snip_Artwork.jpg?time="+cachebuster; | |
// This doesn't work in a browser, but it works in OBS! | |
$("#track").load("Snip_Track.txt", function() { | |
if($(this).is(":empty")) { | |
$(this).text("Paused"); | |
} | |
}); | |
$("#artist").load("Snip_Artist.txt"); | |
}, 1000); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to use
7.0.5
at time of writing)My settings
Any streaming software that supports a "Browser source" (such as OBS, Streamlabs OBS, etc) will now be ready to go!
GLHF :)