diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/core/html/media/html_media_element.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/core/html/media/html_media_element.cc | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/chromium/third_party/blink/renderer/core/html/media/html_media_element.cc b/chromium/third_party/blink/renderer/core/html/media/html_media_element.cc index 637245eb50f..0506fbbca58 100644 --- a/chromium/third_party/blink/renderer/core/html/media/html_media_element.cc +++ b/chromium/third_party/blink/renderer/core/html/media/html_media_element.cc @@ -1165,6 +1165,10 @@ void HTMLMediaElement::LoadResource(const WebMediaPlayerSource& source, // media element API. current_src_ = url; + // Default this to empty, so that we use |current_src_| unless the player + // provides one later. + current_src_after_redirects_ = KURL(); + if (audio_source_node_) audio_source_node_->OnCurrentSrcChanged(current_src_); @@ -1775,6 +1779,13 @@ void HTMLMediaElement::SetReadyState(ReadyState state) { ready_state_ = kHaveCurrentData; } + // If we're transitioning to / past kHaveMetadata, then cache the final URL. + if (old_state < kHaveMetadata && new_state >= kHaveMetadata && + web_media_player_) { + current_src_after_redirects_ = + KURL(web_media_player_->GetSrcAfterRedirects()); + } + if (new_state > ready_state_maximum_) ready_state_maximum_ = new_state; @@ -1951,8 +1962,11 @@ bool HTMLMediaElement::SupportsSave() const { return false; } + // Get the URL that we'll use for downloading. + const KURL url = downloadURL(); + // URLs that lead to nowhere are ignored. - if (current_src_.IsNull() || current_src_.IsEmpty()) + if (url.IsNull() || url.IsEmpty()) return false; // If we have no source, we can't download. @@ -1960,7 +1974,7 @@ bool HTMLMediaElement::SupportsSave() const { return false; // It is not useful to offer a save feature on local files. - if (current_src_.IsLocalFile()) + if (url.IsLocalFile()) return false; // MediaStream can't be downloaded. @@ -1972,7 +1986,7 @@ bool HTMLMediaElement::SupportsSave() const { return false; // HLS stream shouldn't have a download button. - if (IsHLSURL(current_src_)) + if (IsHLSURL(url)) return false; // Infinite streams don't have a clear end at which to finish the download. |