Merge branch 'develop' for release v3.15.1
This commit is contained in:
@@ -146,11 +146,9 @@ LMS.mediaplayer = function () {
|
||||
_gainNode.connect(_audioCtx.destination);
|
||||
|
||||
_elems.playpause.addEventListener("click", function() {
|
||||
if (_elems.audio.paused) {
|
||||
if (_elems.audio.firstChild) {
|
||||
_audioCtx.resume();
|
||||
_playTrack();
|
||||
}
|
||||
_audioCtx.resume();
|
||||
if (_elems.audio.paused && _elems.audio.children.length > 0) {
|
||||
_playTrack();
|
||||
}
|
||||
else
|
||||
_elems.audio.pause();
|
||||
@@ -285,7 +283,7 @@ LMS.mediaplayer = function () {
|
||||
_elems.curtime.innerHTML = _durationToString(_offset);
|
||||
_elems.duration.innerHTML = _durationToString(_duration);
|
||||
|
||||
if (autoplay)
|
||||
if (autoplay && _audioCtx.state == "running")
|
||||
_playTrack();
|
||||
|
||||
if ('mediaSession' in navigator) {
|
||||
|
||||
@@ -54,10 +54,24 @@ Transcoder::Transcoder(const std::filesystem::path& filePath, const TranscodePar
|
||||
bool
|
||||
Transcoder::start()
|
||||
{
|
||||
if (!std::filesystem::exists(_filePath))
|
||||
return false;
|
||||
else if (!std::filesystem::is_regular_file( _filePath) )
|
||||
try
|
||||
{
|
||||
if (!std::filesystem::exists(_filePath))
|
||||
{
|
||||
LOG(ERROR) << "File '" << _filePath << "' does not exist!";
|
||||
return false;
|
||||
}
|
||||
else if (!std::filesystem::is_regular_file( _filePath) )
|
||||
{
|
||||
LOG(ERROR) << "File '" << _filePath << "' is not regular!";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const std::filesystem::filesystem_error& e)
|
||||
{
|
||||
LOG(ERROR) << "File error on '" << _filePath.string() << "': " << e.what();
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG(INFO) << "Transcoding file '" << _filePath.string() << "'";
|
||||
|
||||
|
||||
@@ -107,6 +107,12 @@ TrackList::getById(Session& session, IdType id)
|
||||
return session.getDboSession().find<TrackList>().where("id = ?").bind(id);
|
||||
}
|
||||
|
||||
bool
|
||||
TrackList::isEmpty() const
|
||||
{
|
||||
return _entries.empty();
|
||||
}
|
||||
|
||||
std::size_t
|
||||
TrackList::getCount() const
|
||||
{
|
||||
|
||||
@@ -79,6 +79,7 @@ class TrackList : public Wt::Dbo::Dbo<TrackList>
|
||||
void clear() { _entries.clear(); }
|
||||
|
||||
// Get tracks, ordered by position
|
||||
bool isEmpty() const;
|
||||
std::size_t getCount() const;
|
||||
Wt::Dbo::ptr<TrackListEntry> getEntry(std::size_t pos) const;
|
||||
std::vector<Wt::Dbo::ptr<TrackListEntry>> getEntries(std::optional<std::size_t> offset = {}, std::optional<std::size_t> size = {}) const;
|
||||
|
||||
@@ -42,8 +42,6 @@ FileResourceHandler::processRequest(const Wt::Http::Request& request, Wt::Http::
|
||||
::uint64_t startByte {_offset};
|
||||
std::ifstream ifs {_path.string().c_str(), std::ios::in | std::ios::binary};
|
||||
|
||||
LMS_LOG(UTILS, DEBUG) << "startByte = " << startByte;
|
||||
|
||||
if (startByte == 0)
|
||||
{
|
||||
if (!ifs)
|
||||
@@ -100,6 +98,12 @@ FileResourceHandler::processRequest(const Wt::Http::Request& request, Wt::Http::
|
||||
response.setContentLength(_beyondLastByte);
|
||||
}
|
||||
}
|
||||
else if (!ifs)
|
||||
{
|
||||
LMS_LOG(UTILS, ERROR) << "Cannot reopen file stream for '" << _path.string() << "'";
|
||||
_isFinished = true;
|
||||
return;
|
||||
}
|
||||
|
||||
ifs.seekg(static_cast<std::istream::pos_type>(startByte));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user