OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 setPlayerPreload(); | 988 setPlayerPreload(); |
989 | 989 |
990 if (fastHasAttribute(mutedAttr)) | 990 if (fastHasAttribute(mutedAttr)) |
991 m_muted = true; | 991 m_muted = true; |
992 updateVolume(); | 992 updateVolume(); |
993 | 993 |
994 ASSERT(!m_mediaSource); | 994 ASSERT(!m_mediaSource); |
995 | 995 |
996 bool attemptLoad = true; | 996 bool attemptLoad = true; |
997 | 997 |
998 if (source.isMediaStream() || url.protocolIs(mediaSourceBlobProtocol)) { | 998 bool isStreamOrBlobUrl = source.isMediaStream() || url.protocolIs(mediaSourc
eBlobProtocol); |
| 999 if (isStreamOrBlobUrl) { |
999 bool isMediaStream = source.isMediaStream() || (source.isURL() && isMedi
aStreamURL(url.getString())); | 1000 bool isMediaStream = source.isMediaStream() || (source.isURL() && isMedi
aStreamURL(url.getString())); |
1000 if (isMediaStream) { | 1001 if (isMediaStream) { |
1001 m_autoplayHelper->removeUserGestureRequirement(GesturelessPlaybackEn
abledByStream); | 1002 m_autoplayHelper->removeUserGestureRequirement(GesturelessPlaybackEn
abledByStream); |
1002 } else { | 1003 } else { |
1003 m_mediaSource = HTMLMediaSource::lookup(url.getString()); | 1004 m_mediaSource = HTMLMediaSource::lookup(url.getString()); |
1004 | 1005 |
1005 if (m_mediaSource) { | 1006 if (m_mediaSource) { |
1006 if (!m_mediaSource->attachToElement(this)) { | 1007 if (!m_mediaSource->attachToElement(this)) { |
1007 // Forget our reference to the MediaSource, so we leave it a
lone | 1008 // Forget our reference to the MediaSource, so we leave it a
lone |
1008 // while processing remainder of load failure. | 1009 // while processing remainder of load failure. |
1009 m_mediaSource = nullptr; | 1010 m_mediaSource = nullptr; |
1010 attemptLoad = false; | 1011 attemptLoad = false; |
1011 } | 1012 } |
1012 } | 1013 } |
1013 } | 1014 } |
1014 } | 1015 } |
1015 | 1016 |
1016 bool canLoadResource = source.isMediaStream() || canLoadURL(url, contentType
); | 1017 bool canLoadResource = source.isMediaStream() || canLoadURL(url, contentType
); |
1017 if (attemptLoad && canLoadResource) { | 1018 if (attemptLoad && canLoadResource) { |
1018 ASSERT(!webMediaPlayer()); | 1019 ASSERT(!webMediaPlayer()); |
1019 | 1020 |
1020 if (effectivePreloadType() == WebMediaPlayer::PreloadNone) { | 1021 // Conditionally defer the load if effective preload is 'none'. |
| 1022 // Skip this optional deferral for MediaStream sources or any blob URL, |
| 1023 // including MediaSource blob URLs. |
| 1024 if (!isStreamOrBlobUrl && effectivePreloadType() == WebMediaPlayer::Prel
oadNone) { |
1021 WTF_LOG(Media, "HTMLMediaElement::loadResource(%p) : Delaying load b
ecause preload == 'none'", this); | 1025 WTF_LOG(Media, "HTMLMediaElement::loadResource(%p) : Delaying load b
ecause preload == 'none'", this); |
1022 deferLoad(); | 1026 deferLoad(); |
1023 } else { | 1027 } else { |
1024 startPlayerLoad(); | 1028 startPlayerLoad(); |
1025 } | 1029 } |
1026 } else { | 1030 } else { |
1027 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); | 1031 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); |
1028 } | 1032 } |
1029 | 1033 |
1030 // If there is no poster to display, allow the media engine to render video
frames as soon as | 1034 // If there is no poster to display, allow the media engine to render video
frames as soon as |
(...skipping 2821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3852 | 3856 |
3853 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co
nst | 3857 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co
nst |
3854 { | 3858 { |
3855 IntRect result; | 3859 IntRect result; |
3856 if (LayoutObject* object = m_element->layoutObject()) | 3860 if (LayoutObject* object = m_element->layoutObject()) |
3857 result = object->absoluteBoundingBoxRect(); | 3861 result = object->absoluteBoundingBoxRect(); |
3858 return result; | 3862 return result; |
3859 } | 3863 } |
3860 | 3864 |
3861 } // namespace blink | 3865 } // namespace blink |
OLD | NEW |