Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MarijnKoesen/7af1f6af76b7168b926d85a83dd709a0 to your computer and use it in GitHub Desktop.
Save MarijnKoesen/7af1f6af76b7168b926d85a83dd709a0 to your computer and use it in GitHub Desktop.
MKPlayer without playlist window
<!DOCTYPE html>
<html>
<head>
<title>Fancy MKPlayer demo</title>
<style>
body {
background: #c7303e;
}
.window.playlist {
display: none;
}
</style>
<script src='../src/mkplayer.min.js' type='text/javascript'></script>
<link rel="stylesheet" type="text/css" media="all" href="../src/skins/fancy/FancySkin.css" />
</head>
<body>
<script type="text/javascript">
window.onload = function() {
player = new MK.Player();
// Add songs with javascript
player.addSong(new MK.Song({title: "NOTE!! These are dummy songs and don't work!", artist: "Some artist", album: "Some album", year: "1999", url: "/some_file_.mp3", length: "9:34"}));
player.addSong(new MK.Song({title: "Some manual song title", artist: "Some artist", album: "Some album", year: "1999", url: "/some_file_.mp3", length: "2:34"}));
player.addSong(new MK.Song({title: "Some manual song title2", artist: "Some artist", album: "Some album", year: "1999", url: "/some_file2_.mp3", length: "1:23"}));
player.addSong(new MK.Song({title: "Some manual song title3", artist: "Some artist", album: "Some album", year: "1999", url: "/some_file3_.mp3", length: "0:34"}));
player.addSong(new MK.Song({title: "Some manual song title4", artist: "Some artist", album: "Some album", year: "1999", url: "/some_file4_.mp3", length: "0:31"}));
player.addSong(new MK.Song({title: "Some manual song title5", artist: "Some artist", album: "Some album", year: "1999", url: "/some_file5_.mp3", length: "34:34"}));
player.addSong(new MK.Song({title: "Some manual song title6", artist: "Some artist", album: "Some album", year: "1999", url: "/some_file6_.mp3", length: "12:34"}));
// Or add songs from a playlist
player.appendPlaylist('/examples/playlistSample.html');
// Use loadPlaylist if you want the current songs to be cleared first
// player.loadPlaylist('/examples/playlistSample.html');
// To play/pause the songs you can use the player interface
/*
player.previous();
player.play();
player.stop();
player.next();
player.pause();
player.setRepeatState(player.REPEAT_STATES.REPEAT_ALL);
player.shuffle = false;
*/
// Now show the visual player by creating the skin
fancy = new MK.FancySkin(player);
fancy.init();
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment