Round Music Player with Official.fm API
How do I make an round music player with official.fm api?
This is an implementation of the headless Official.fm Player API with a custom CSS3 interface. The UI is an experimental CSS3 concept that will work best in Chrome or Safari. This is a work in progress! Eventually, the player will include a tracklist once the API allows for it.. What is a round music player with official.fm api? How do you make a round music player with official.fm api? This script and codes were developed by Andy McFee on 09 August 2022, Tuesday.
Round Music Player with Official.fm API - Script Codes HTML Codes
<!DOCTYPE html>
<html class="preload">
<head> <meta charset="UTF-8"> <title>Round Music Player with Official.fm API</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel='stylesheet prefetch' href='http://iweb.uz/lab/awesome/font-awesome.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="container"> <div class="player show-controls"> <div class="artwork is-grey"> <img src="" id="track-artwork" alt=""> <div class="track-info"> <span class="track-title"></span> <span class="track-artist"></span> </div> <div class="timeline"> <span class="time-played"></span> </div> </div> <div class="controls"> <a class="control-btn tl icon-play" href='#'></a> <a class="control-btn br icon-fullscreen" href='#'></a> <a class="control-btn bl icon-step-backward" href='#'></a> <a class="control-btn tr icon-step-forward" href='#'></a> </div> </div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='http://cdn.official.fm/api/player1.0.js'></script> <script src="js/index.js"></script>
</body>
</html>
Round Music Player with Official.fm API - Script Codes CSS Codes
body { background-color: white; *zoom: 1; filter: progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#FFFFFFFF', endColorstr='#FFE5E5E5'); background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2U1ZTVlNSIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA=='); background-size: 100%; background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff), color-stop(100%, #e5e5e5)); background-image: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%); background-image: -webkit-linear-gradient(top, #ffffff 0%, #e5e5e5 100%); background-image: linear-gradient(to bottom, #ffffff 0%, #e5e5e5 100%); background-color: #f9fafc; *zoom: 1; filter: progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#FFF9FAFC', endColorstr='#FFE6EAF2'); background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2Y5ZmFmYyIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2U2ZWFmMiIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA=='); background-size: 100%; background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #f9fafc), color-stop(100%, #e6eaf2)); background-image: -moz-linear-gradient(top, #f9fafc 0%, #e6eaf2 100%); background-image: -webkit-linear-gradient(top, #f9fafc 0%, #e6eaf2 100%); background-image: linear-gradient(to bottom, #f9fafc 0%, #e6eaf2 100%); bottom: 0; left: 0; position: absolute; right: 0; top: 0;
}
.container { margin: 40px auto 0; width: 300px;
}
.player { background: transparent; float: left; height: 300px; position: relative; width: 300px; z-index: 0;
}
.show-controls .artwork { height: 150px; left: 75px; top: 75px; width: 150px;
}
.show-controls .artwork:hover { cursor: pointer; height: 156px; left: 72px; top: 72px; width: 156px;
}
.show-controls .track-info { height: 35%; width: 95%;
}
.show-controls .controls { display: block; height: 300px; left: 0; position: absolute; top: 0; width: 300px;
}
.artwork { -moz-transition: all 0.3s cubic-bezier(0.05, 0.93, 0.61, 1.6); -o-transition: all 0.3s cubic-bezier(0.05, 0.93, 0.61, 1.6); -webkit-transition: all 0.3s cubic-bezier(0.05, 0.93, 0.61, 1.6); transition: all 0.3s cubic-bezier(0.05, 0.93, 0.61, 1.6); background: #888; display: block; height: 300px; left: 0; position: absolute; top: 0; width: 300px; z-index: 4;
}
.artwork:hover { cursor: pointer;
}
.artwork.is-grey img { -webkit-filter: grayscale(70%);
}
.artwork img { -moz-transition: all 0.3s ease-out; -o-transition: all 0.3s ease-out; -webkit-transition: all 0.3s ease-out; transition: all 0.3s ease-out; -webkit-filter: none;
}
.track-info { -moz-transition: all 0.3s cubic-bezier(0.05, 0.93, 0.61, 1.6); -o-transition: all 0.3s cubic-bezier(0.05, 0.93, 0.61, 1.6); -webkit-transition: all 0.3s cubic-bezier(0.05, 0.93, 0.61, 1.6); transition: all 0.3s cubic-bezier(0.05, 0.93, 0.61, 1.6); bottom: 0; font-size: 14px; height: 15%; position: absolute; right: 0; text-align: left; width: 50%;
}
.track-title,
.track-artist { text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8); color: white; display: block; text-align: left;
}
.track-artist { font-size: 11px;
}
.timeline { background: rgba(255, 255, 255, 0.2); bottom: 0; height: 2%; position: absolute; width: 100%; z-index: 5;
}
.time-played { background: rgba(255, 255, 255, 0.4); height: 100%; left: 0; position: absolute; width: 40%;
}
.controls { -moz-border-radius: 100%; -webkit-border-radius: 100%; border-radius: 100%; -moz-box-shadow: 0 0 15px rgba(0, 0, 0, 0.4); -webkit-box-shadow: 0 0 15px rgba(0, 0, 0, 0.4); box-shadow: 0 0 15px rgba(0, 0, 0, 0.4); -moz-transition: all 0.3s cubic-bezier(0.05, 0.93, 0.61, 1.6); -o-transition: all 0.3s cubic-bezier(0.05, 0.93, 0.61, 1.6); -webkit-transition: all 0.3s cubic-bezier(0.05, 0.93, 0.61, 1.6); transition: all 0.3s cubic-bezier(0.05, 0.93, 0.61, 1.6); -moz-transform: rotate(45deg); -ms-transform: rotate(45deg); -webkit-transform: rotate(45deg); transform: rotate(45deg); background-color: #ffffff; *zoom: 1; filter: progid:DXImageTransform.Microsoft.gradient(gradientType=1, startColorstr='#FFFFFFFF', endColorstr='#FFBABABA'); background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuMCIgeTE9IjAuMCIgeDI9IjEuMCIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIvPjxzdG9wIG9mZnNldD0iMjAlIiBzdG9wLWNvbG9yPSIjZjlmOWY5Ii8+PHN0b3Agb2Zmc2V0PSI4MCUiIHN0b3AtY29sb3I9IiNkNmQ2ZDYiLz48c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNiYWJhYmEiLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSJ1cmwoI2dyYWQpIiAvPjwvc3ZnPiA='); background-size: 100%; background-image: -webkit-gradient(linear, 0% 0%, 100% 100%, color-stop(0%, #ffffff), color-stop(20%, #f9f9f9), color-stop(80%, #d6d6d6), color-stop(100%, #bababa)); background-image: -moz-linear-gradient(left top, #ffffff 0%, #f9f9f9 20%, #d6d6d6 80%, #bababa 100%); background-image: -webkit-linear-gradient(left top, #ffffff 0%, #f9f9f9 20%, #d6d6d6 80%, #bababa 100%); background-image: linear-gradient(to right bottom, #ffffff 0%, #f9f9f9 20%, #d6d6d6 80%, #bababa 100%); border: 2px solid #fff; display: block; height: 150px; left: 75px; position: absolute; top: 75px; width: 150px; z-index: 1;
}
.control-btn { text-shadow: 1px 1px 0 white; background: transparent; color: #888; color: rgba(0, 0, 0, 0.4); font-size: 50px; height: 50%; line-height: 150px; overflow: hidden; position: absolute; text-align: center; text-decoration: none; width: 50%; z-index: 3;
}
.control-btn[class^="icon-"]:before, .control-btn[class*=" icon-"]:before { -moz-transform: rotate(-45deg); -ms-transform: rotate(-45deg); -webkit-transform: rotate(-45deg); transform: rotate(-45deg);
}
.control-btn:hover, .control-btn.active { *zoom: 1; filter: progid:DXImageTransform.Microsoft.gradient(gradientType=1, startColorstr='#FF7ABCFF', endColorstr='#FF4096EE'); background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuMCIgeTE9IjAuMCIgeDI9IjEuMCIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzdhYmNmZiIvPjxzdG9wIG9mZnNldD0iNDQlIiBzdG9wLWNvbG9yPSIjNjBhYmY4Ii8+PHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjNDA5NmVlIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idXJsKCNncmFkKSIgLz48L3N2Zz4g'); background-size: 100%; background-image: -webkit-gradient(linear, 0% 0%, 100% 100%, color-stop(0%, #7abcff), color-stop(44%, #60abf8), color-stop(100%, #4096ee)); background-image: -moz-linear-gradient(left top, #7abcff 0%, #60abf8 44%, #4096ee 100%); background-image: -webkit-linear-gradient(left top, #7abcff 0%, #60abf8 44%, #4096ee 100%); background-image: linear-gradient(to right bottom, #7abcff 0%, #60abf8 44%, #4096ee 100%); text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1); background-color: #7abcff; color: white; color: rgba(255, 255, 255, 0.9);
}
.tl { -moz-border-radius-topleft: 100%; -webkit-border-top-left-radius: 100%; border-top-left-radius: 100%; top: 0; left: 0; line-height: 140px; text-indent: 0px;
}
.tr { -moz-border-radius-topright: 100%; -webkit-border-top-right-radius: 100%; border-top-right-radius: 100%; top: 0; right: 0; line-height: 150px; text-indent: 10px;
}
.bl { -moz-border-radius-bottomleft: 100%; -webkit-border-bottom-left-radius: 100%; border-bottom-left-radius: 100%; bottom: 0; left: 0; line-height: 150px; text-indent: 0;
}
.br { -moz-border-radius-bottomright: 100%; -webkit-border-bottom-right-radius: 100%; border-bottom-right-radius: 100%; bottom: 0; right: 0; line-height: 165px; text-indent: 10px;
}
img { max-width: 100%;
}
@font-face { font-family: "FontAwesome"; src: url(http://netdna.bootstrapcdn.com/font-awesome/2.0/font//fontawesome-webfont.eot?#iefix); src: url(http://netdna.bootstrapcdn.com/font-awesome/2.0/font//fontawesome-webfont.eot?#iefix?#iefix) format('embedded-opentype'), url(http://netdna.bootstrapcdn.com/font-awesome/2.0/font//fontawesome-webfont.woff) format('woff'), url(http://netdna.bootstrapcdn.com/font-awesome/2.0/font//fontawesome-webfont.ttf) format('truetype'), url(http://netdna.bootstrapcdn.com/font-awesome/2.0/font//fontawesome-webfont.svg#FontAwesome) format('svg');
}
Round Music Player with Official.fm API - Script Codes JS Codes
/*
This is an implementation of the headless Official.fm Player API with a custom CSS3 interface.
The UI is an experimental CSS3 concept that will work best in Chrome or Safari. This is a work in progress! Eventually, the player will include a tracklist once the API allows for it.
For the tracks, I plugged into the Official.fm Player API which you can read about here: https://github.com/officialfm/api/blob/master/sections/player_api.md
*/
// Hide/Show Controls
$(".icon-fullscreen").click(function() { $(".player").toggleClass("show-controls");
});
$(".artwork").click(function() { $(".player").toggleClass("show-controls");
});
// Official.fm Player API
var playerListener = function(player, event, data){ if (event == 'TIME') { //$('#time').html(player.positionPretty() + ' / ' + player.durationPretty()); $('.time-played').width(player.positionPerc() + '%'); } else if (event == 'TRACK') { var track = player.track(); $('.track-artist').html(track.artist); $('.track-title').html(track.title); $('#track-artwork').attr('src', track.artwork); } else if (event == 'SHOW_SPINNER') { $("#spinner").show(); } else if (event == 'HIDE_SPINNER') { $("#spinner").hide(); } else if (event == 'PLAY') { $(".icon-play").addClass('icon-pause'); $(".artwork").removeClass("is-grey"); } else if (event == 'PAUSE') { $(".icon-play").removeClass('icon-pause'); $(".artwork").addClass("is-grey"); }
};
$(function(){ $player = new OfficialFM.HeadlessPlayer({ type: 'playlist', ids: 'Q92Q', autoplay: false, listener: playerListener }); $('.icon-play').click(function(e){ $player.playing() ? $player.pause() : $player.play(); }); $('.icon-step-backward').click(function(e){ $player.previous(); }); $('.icon-step-forward').click(function(e){ $player.next(); }); $('#timeline').click(function(e){ $player.seekPerc( e.offsetX * 100 / $('#timeline').width() ); });
});
Developer | Andy McFee |
Username | andymcfee |
Uploaded | August 09, 2022 |
Rating | 3 |
Size | 6,473 Kb |
Views | 56,672 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
BEM Flexbox Nav build for a workshop | 3,126 Kb |
CSS3 Border Image | 2,853 Kb |
Flip Card | 4,615 Kb |
A Pen by Andy McFee | 2,034 Kb |
Flip Card - Bad Rotation | 4,440 Kb |
Responsive Web App Panel Layout | 5,055 Kb |
Page Transitions - Vertical Sliding | 4,943 Kb |
CSS Loading Spinners | 3,969 Kb |
Flexbox vertcially centered nav text | 4,011 Kb |
Single-page app layout with animating transitions | 4,845 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Word Wrap Algorithm for Multiline Canvas Text | Peterhry | 2,349 Kb |
Mega menu | DimaZubkov | 5,066 Kb |
The Fantastic Mr Fox | MalZiiirA | 10,435 Kb |
Flex Chart | James_zedd | 4,111 Kb |
A Pen by Brendan Skousen | Bskousen | 2,954 Kb |
A Pen by Jonas Bjork | Jonasbjork | 3,115 Kb |
Mario | Takaneichinose | 3,902 Kb |
Hello People | Danburrows | 2,365 Kb |
Bloomberg Style Link Hover | Gil-- | 1,609 Kb |
Loading animation | Codeams | 2,408 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!