Chromium Code Reviews| Index: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
| diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
| index ed596d00d9df66b3052914fec0e6c9c47b0352e2..551216bfcae7d1bcabaa650fed684ff35fef95c7 100644 |
| --- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
| +++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
| @@ -916,6 +916,20 @@ void HTMLMediaElement::selectMediaResource() |
| // 8 - Queue a task to fire a simple event named loadstart at the media element. |
| scheduleEvent(EventTypeNames::loadstart); |
| + // Reload a post-redirect URL from a previous WebMediaPlayer instance. This provides a |
|
hubbe
2016/06/15 21:07:56
line
length?
DaleCurtis
2016/06/15 23:11:31
Blink uses longer line lengths unfortunately, so I
|
| + // workaround for WebMediaPlayer instances which discover they can't play a URL after |
| + // redirects have been followed. |
| + // TODO(tguilbert): Remove once http://crbug.com/580626 is fixed. |
| + if (webMediaPlayer()) { |
| + WebURL alternativeSourceURL = webMediaPlayer()->alternativeSourceURL(); |
| + if (!alternativeSourceURL.isEmpty()) { |
| + resetMediaPlayerAndMediaSource(); |
| + ContentType contentType((String())); |
| + loadResource(WebMediaPlayerSource(alternativeSourceURL), contentType); |
| + return; |
| + } |
| + } |
| + |
| // 9 - Run the appropriate steps... |
| switch (mode) { |
| case Object: |
| @@ -1428,6 +1442,13 @@ void HTMLMediaElement::mediaLoadingFailed(WebMediaPlayer::NetworkState error) |
| { |
| stopPeriodicTimers(); |
| + // WebMediaPlayer encountered a resource it can't play, retry the loading with a new WebMediaPlayer instance using the post-redirect URL. |
| + // TODO(tguilbert): Remove once http://crbug.com/580626 is fixed. |
| + if (m_readyState < HAVE_METADATA && error == WebMediaPlayer::NetworkStateFormatError && webMediaPlayer() && !webMediaPlayer()->alternativeSourceURL().isEmpty()) { |
| + scheduleNextSourceChild(); |
| + return; |
| + } |
| + |
| // If we failed while trying to load a <source> element, the movie was never parsed, and there are more |
| // <source> children, schedule the next one |
| if (m_readyState < HAVE_METADATA && m_loadState == LoadingFromSourceElement) { |