Skip to content

Instantly share code, notes, and snippets.

@dirkk0
Created September 5, 2021 09:37
Show Gist options
  • Save dirkk0/de02cd05a819f417e14272371750715c to your computer and use it in GitHub Desktop.
Save dirkk0/de02cd05a819f417e14272371750715c to your computer and use it in GitHub Desktop.
Minimal JavaScript to get Deezer wo work. Don't forget to replace the APP_ID and put it on the domain associated with this ID.
<!DOCTYPE html>
<html>
<head>
<title>Basic Custom Player with Deezer JavaScript SDK</title>
<meta name="viewport"
content="width=device-width,initial-scale=1,shrink-to-fit=no,user-scalable=no,maximum-scale=1" />
<script src="https://e-cdns-files.dzcdn.net/js/min/dz.js"></script>
</head>
<body>
<div id="dz-root"></div>
<h1>Get Started</h1>
<div>
<button onclick="playTracks()">play tracks</button>
<!-- <button onclick="playList()">playlist</button> -->
<button onclick="DZ.player.pause()">pause</button>
<button onclick="DZ.player.play()">play</button>
<button onclick="DZ.player.next()">next</button>
<button onclick="DZ.player.prev()">prev</button>
</div>
<script>
</script>
<script>
DZ.init({
appId: "APP_ID", // REPLACE THIS!
channelUrl: "channel.html",
player: {
// container: "player",
// width : 300,
// height : 300,
// format : 'square',
onload: function () {
console.log("yes, loaded!")
},
},
});
function playTracks() {
console.log(123)
DZ.player.playTracks([1011116422, 3135556]);
}
// function playList() {
// DZ.player.playPlaylist(9190762642);
// }
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment