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