[UI] Try to read the next audio track if failure to read the current one

This commit is contained in:
epoupon
2015-10-07 18:19:58 +02:00
parent 52162e0c7a
commit 6775431182
4 changed files with 13 additions and 7 deletions
-1
View File
@@ -50,7 +50,6 @@
- MediaPlayer: move the slider using js (http://redmine.webtoolkit.eu/boards/2/topics/7924?r=8478, http://redmine.emweb.be/boards/2/topics/10994)
- TrackView: handle durations > 1 hour
- TrackView: Reselect the current selected item when displaying the updated search results
- TrackView: display the total duration of the track query
- Add covers in the release filter?
- Add a download button to get the current playlist in a streamed zip file
- Add a upload button to upload media files in a dedicated directory
+10 -4
View File
@@ -190,7 +190,7 @@ AudioMediaPlayer::loadPlayer(boost::filesystem::path filePath, Av::TranscodePara
_mediaPlayer->play();
}
void
bool
AudioMediaPlayer::load(Database::Track::id_type trackId)
{
Av::TranscodeParameters parameters;
@@ -203,6 +203,11 @@ AudioMediaPlayer::load(Database::Track::id_type trackId)
Wt::Dbo::Transaction transaction(DboSession());
Database::Track::pointer track = Database::Track::getById(DboSession(), trackId);
if (!track)
{
LMS_LOG(UI, INFO) << "Cannot find track id " << trackId;
return false;
}
path = track->getPath();
parameters.setBitrate(Av::Stream::Type::Audio, CurrentUser()->getAudioBitrate() );
@@ -216,11 +221,10 @@ AudioMediaPlayer::load(Database::Track::id_type trackId)
Av::MediaFile mediaFile(path);
if (!mediaFile.open())
if (!mediaFile.open() || !mediaFile.scan())
{
// No longer exist ? TODO next?
LMS_LOG(UI, INFO) << "Cannot open file '" << path << "'";
return;
return false;
}
// It seems to be far better to manually map the streams
@@ -248,6 +252,8 @@ AudioMediaPlayer::load(Database::Track::id_type trackId)
_duration->setText( boost::posix_time::to_simple_string( duration ));
loadPlayer(path, parameters);
return true;
}
void
+1 -1
View File
@@ -46,7 +46,7 @@ class AudioMediaPlayer : public Wt::WContainerWidget
AudioMediaPlayer(Wt::WContainerWidget *parent = 0);
// Load Media to be played
void load(Database::Track::id_type trackId);
bool load(Database::Track::id_type trackId);
// Accessors
Wt::WMediaPlayer::Encoding getEncoding() const { return _encoding; }
+2 -1
View File
@@ -510,7 +510,8 @@ Audio::playTrack(Track::id_type trackId, int pos)
CurrentUser().modify()->setCurPlayingTrackPos(pos);
}
_mediaPlayer->load(trackId);
if (!_mediaPlayer->load(trackId))
_playQueue->playNext();
}
} // namespace Desktop