Add optional auth info to LoadResult.

Add auth_header_ to LoadResult. If it exists, populate the MediaPlaybackRequests
headers with an Authorization header with that value.
This commit is contained in:
Jim Broadus 2020-02-19 22:51:22 -08:00 committed by John Maguire
parent 3c7b509d59
commit e338939c8b
2 changed files with 5 additions and 0 deletions

View File

@ -147,6 +147,8 @@ void Player::HandleLoadResult(const UrlHandler::LoadResult& result) {
app_->playlist_manager()->active()->InformOfCurrentSongChange();
}
MediaPlaybackRequest req(result.media_url_);
if (!result.auth_header_.isEmpty())
req.headers_["Authorization"] = result.auth_header_;
engine_->Play(req, stream_change_type_, item->Metadata().has_cue(),
item->Metadata().beginning_nanosec(),
item->Metadata().end_nanosec());

View File

@ -66,6 +66,9 @@ class UrlHandler : public QObject {
// Track length, if we are able to get it only now
qint64 length_nanosec_;
// If non-empty, value for an Authorization header.
QByteArray auth_header_;
};
// Called by the Player when a song starts loading - gives the handler