Storing next track and pre-fetching artwork for snappier UI

This commit is contained in:
James Barnsley
2018-04-12 15:55:39 +12:00
parent 4736f85ff2
commit cd4451f69c
13 changed files with 220 additions and 68 deletions

View File

@ -91,9 +91,9 @@ class Queue extends React.Component{
}
render(){
var current_track = null;
var tracks = [];
if (this.props.queue && this.props.tracks){
for (var i = 0; i < this.props.queue.length; i++){
var track = this.props.queue[i];
@ -131,11 +131,10 @@ class Queue extends React.Component{
}
}
var image = null
var current_track_image = null;
if (current_track){
if (current_track.images !== undefined && current_track.images){
image = helpers.sizedImages(current_track.images)
image = image.large
current_track_image = helpers.sizedImages(current_track.images).large;
}
}
@ -164,11 +163,11 @@ class Queue extends React.Component{
return (
<div className="view queue-view">
<Header icon="play" className="overlay" title="Now playing" options={options} uiActions={this.props.uiActions} />
<Parallax blur image={image} />
<Parallax blur image={current_track_image} />
<div className="content-wrapper">
<div className="current-track">
{this.renderArtwork(image)}
{this.renderArtwork(current_track_image)}
<div className="title">
{current_track ? <URILink type="track" uri={current_track.uri}>{current_track.name}</URILink> : <span>-</span>}
</div>