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 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 } | 1144 } |
1145 | 1145 |
1146 bool HTMLMediaElement::textTracksAreReady() const | 1146 bool HTMLMediaElement::textTracksAreReady() const |
1147 { | 1147 { |
1148 // 4.8.10.12.1 Text track model | 1148 // 4.8.10.12.1 Text track model |
1149 // ... | 1149 // ... |
1150 // The text tracks of a media element are ready if all the text tracks whose
mode was not | 1150 // The text tracks of a media element are ready if all the text tracks whose
mode was not |
1151 // in the disabled state when the element's resource selection algorithm las
t started now | 1151 // in the disabled state when the element's resource selection algorithm las
t started now |
1152 // have a text track readiness state of loaded or failed to load. | 1152 // have a text track readiness state of loaded or failed to load. |
1153 for (unsigned i = 0; i < m_textTracksWhenResourceSelectionBegan.size(); ++i)
{ | 1153 for (unsigned i = 0; i < m_textTracksWhenResourceSelectionBegan.size(); ++i)
{ |
1154 if (m_textTracksWhenResourceSelectionBegan[i]->readinessState() == TextT
rack::Loading | 1154 if (m_textTracksWhenResourceSelectionBegan[i]->getReadinessState() == Te
xtTrack::Loading |
1155 || m_textTracksWhenResourceSelectionBegan[i]->readinessState() == Te
xtTrack::NotLoaded) | 1155 || m_textTracksWhenResourceSelectionBegan[i]->getReadinessState() ==
TextTrack::NotLoaded) |
1156 return false; | 1156 return false; |
1157 } | 1157 } |
1158 | 1158 |
1159 return true; | 1159 return true; |
1160 } | 1160 } |
1161 | 1161 |
1162 void HTMLMediaElement::textTrackReadyStateChanged(TextTrack* track) | 1162 void HTMLMediaElement::textTrackReadyStateChanged(TextTrack* track) |
1163 { | 1163 { |
1164 if (webMediaPlayer()&& m_textTracksWhenResourceSelectionBegan.contains(track
)) { | 1164 if (webMediaPlayer()&& m_textTracksWhenResourceSelectionBegan.contains(track
)) { |
1165 if (track->readinessState() != TextTrack::Loading) | 1165 if (track->getReadinessState() != TextTrack::Loading) |
1166 setReadyState(static_cast<ReadyState>(webMediaPlayer()->readyState()
)); | 1166 setReadyState(static_cast<ReadyState>(webMediaPlayer()->getReadyStat
e())); |
1167 } else { | 1167 } else { |
1168 // The track readiness state might have changed as a result of the user | 1168 // The track readiness state might have changed as a result of the user |
1169 // clicking the captions button. In this case, a check whether all the | 1169 // clicking the captions button. In this case, a check whether all the |
1170 // resources have failed loading should be done in order to hide the CC
button. | 1170 // resources have failed loading should be done in order to hide the CC
button. |
1171 if (mediaControls() && track->readinessState() == TextTrack::FailedToLoa
d) | 1171 if (mediaControls() && track->getReadinessState() == TextTrack::FailedTo
Load) |
1172 mediaControls()->refreshClosedCaptionsButtonVisibility(); | 1172 mediaControls()->refreshClosedCaptionsButtonVisibility(); |
1173 } | 1173 } |
1174 } | 1174 } |
1175 | 1175 |
1176 void HTMLMediaElement::textTrackModeChanged(TextTrack* track) | 1176 void HTMLMediaElement::textTrackModeChanged(TextTrack* track) |
1177 { | 1177 { |
1178 // Mark this track as "configured" so configureTextTracks won't change the m
ode again. | 1178 // Mark this track as "configured" so configureTextTracks won't change the m
ode again. |
1179 if (track->trackType() == TextTrack::TrackElement) | 1179 if (track->trackType() == TextTrack::TrackElement) |
1180 track->setHasBeenConfigured(true); | 1180 track->setHasBeenConfigured(true); |
1181 | 1181 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 | 1321 |
1322 for (HTMLSourceElement* source = Traversal<HTMLSourceElement>::firstChild(*t
his); source; source = Traversal<HTMLSourceElement>::nextSibling(*source)) | 1322 for (HTMLSourceElement* source = Traversal<HTMLSourceElement>::firstChild(*t
his); source; source = Traversal<HTMLSourceElement>::nextSibling(*source)) |
1323 source->cancelPendingErrorEvent(); | 1323 source->cancelPendingErrorEvent(); |
1324 | 1324 |
1325 m_playPromiseResolveTask->cancel(); | 1325 m_playPromiseResolveTask->cancel(); |
1326 m_playPromiseRejectTask->cancel(); | 1326 m_playPromiseRejectTask->cancel(); |
1327 } | 1327 } |
1328 | 1328 |
1329 void HTMLMediaElement::networkStateChanged() | 1329 void HTMLMediaElement::networkStateChanged() |
1330 { | 1330 { |
1331 setNetworkState(webMediaPlayer()->networkState()); | 1331 setNetworkState(webMediaPlayer()->getNetworkState()); |
1332 } | 1332 } |
1333 | 1333 |
1334 void HTMLMediaElement::mediaLoadingFailed(WebMediaPlayer::NetworkState error) | 1334 void HTMLMediaElement::mediaLoadingFailed(WebMediaPlayer::NetworkState error) |
1335 { | 1335 { |
1336 stopPeriodicTimers(); | 1336 stopPeriodicTimers(); |
1337 | 1337 |
1338 // If we failed while trying to load a <source> element, the movie was never
parsed, and there are more | 1338 // If we failed while trying to load a <source> element, the movie was never
parsed, and there are more |
1339 // <source> children, schedule the next one | 1339 // <source> children, schedule the next one |
1340 if (m_readyState < HAVE_METADATA && m_loadState == LoadingFromSourceElement)
{ | 1340 if (m_readyState < HAVE_METADATA && m_loadState == LoadingFromSourceElement)
{ |
1341 | 1341 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1421 // Schedule one last progress event so we guarantee that at least one is fir
ed | 1421 // Schedule one last progress event so we guarantee that at least one is fir
ed |
1422 // for files that load very quickly. | 1422 // for files that load very quickly. |
1423 if (webMediaPlayer() && webMediaPlayer()->didLoadingProgress()) | 1423 if (webMediaPlayer() && webMediaPlayer()->didLoadingProgress()) |
1424 scheduleEvent(EventTypeNames::progress); | 1424 scheduleEvent(EventTypeNames::progress); |
1425 scheduleEvent(EventTypeNames::suspend); | 1425 scheduleEvent(EventTypeNames::suspend); |
1426 setNetworkState(NETWORK_IDLE); | 1426 setNetworkState(NETWORK_IDLE); |
1427 } | 1427 } |
1428 | 1428 |
1429 void HTMLMediaElement::readyStateChanged() | 1429 void HTMLMediaElement::readyStateChanged() |
1430 { | 1430 { |
1431 setReadyState(static_cast<ReadyState>(webMediaPlayer()->readyState())); | 1431 setReadyState(static_cast<ReadyState>(webMediaPlayer()->getReadyState())); |
1432 } | 1432 } |
1433 | 1433 |
1434 void HTMLMediaElement::setReadyState(ReadyState state) | 1434 void HTMLMediaElement::setReadyState(ReadyState state) |
1435 { | 1435 { |
1436 WTF_LOG(Media, "HTMLMediaElement::setReadyState(%p, %d) - current state is %
d,", this, static_cast<int>(state), static_cast<int>(m_readyState)); | 1436 WTF_LOG(Media, "HTMLMediaElement::setReadyState(%p, %d) - current state is %
d,", this, static_cast<int>(state), static_cast<int>(m_readyState)); |
1437 | 1437 |
1438 // Set "wasPotentiallyPlaying" BEFORE updating m_readyState, potentiallyPlay
ing() uses it | 1438 // Set "wasPotentiallyPlaying" BEFORE updating m_readyState, potentiallyPlay
ing() uses it |
1439 bool wasPotentiallyPlaying = potentiallyPlaying(); | 1439 bool wasPotentiallyPlaying = potentiallyPlaying(); |
1440 | 1440 |
1441 ReadyState oldState = m_readyState; | 1441 ReadyState oldState = m_readyState; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1706 scheduleTimeupdateEvent(false); | 1706 scheduleTimeupdateEvent(false); |
1707 | 1707 |
1708 // 17 - Queue a task to fire a simple event named seeked at the element. | 1708 // 17 - Queue a task to fire a simple event named seeked at the element. |
1709 scheduleEvent(EventTypeNames::seeked); | 1709 scheduleEvent(EventTypeNames::seeked); |
1710 | 1710 |
1711 setDisplayMode(Video); | 1711 setDisplayMode(Video); |
1712 | 1712 |
1713 Platform::current()->recordAction(UserMetricsAction("Media_Seeked")); | 1713 Platform::current()->recordAction(UserMetricsAction("Media_Seeked")); |
1714 } | 1714 } |
1715 | 1715 |
1716 HTMLMediaElement::ReadyState HTMLMediaElement::readyState() const | 1716 HTMLMediaElement::ReadyState HTMLMediaElement::getReadyState() const |
1717 { | 1717 { |
1718 return m_readyState; | 1718 return m_readyState; |
1719 } | 1719 } |
1720 | 1720 |
1721 bool HTMLMediaElement::hasAudio() const | 1721 bool HTMLMediaElement::hasAudio() const |
1722 { | 1722 { |
1723 return webMediaPlayer() && webMediaPlayer()->hasAudio(); | 1723 return webMediaPlayer() && webMediaPlayer()->hasAudio(); |
1724 } | 1724 } |
1725 | 1725 |
1726 bool HTMLMediaElement::seeking() const | 1726 bool HTMLMediaElement::seeking() const |
(...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3206 WebLayer* HTMLMediaElement::platformLayer() const | 3206 WebLayer* HTMLMediaElement::platformLayer() const |
3207 { | 3207 { |
3208 return m_webLayer; | 3208 return m_webLayer; |
3209 } | 3209 } |
3210 | 3210 |
3211 bool HTMLMediaElement::hasClosedCaptions() const | 3211 bool HTMLMediaElement::hasClosedCaptions() const |
3212 { | 3212 { |
3213 if (m_textTracks) { | 3213 if (m_textTracks) { |
3214 for (unsigned i = 0; i < m_textTracks->length(); ++i) { | 3214 for (unsigned i = 0; i < m_textTracks->length(); ++i) { |
3215 TextTrack* track = m_textTracks->anonymousIndexedGetter(i); | 3215 TextTrack* track = m_textTracks->anonymousIndexedGetter(i); |
3216 if (track->readinessState() == TextTrack::FailedToLoad) | 3216 if (track->getReadinessState() == TextTrack::FailedToLoad) |
3217 continue; | 3217 continue; |
3218 | 3218 |
3219 if (track->kind() == TextTrack::captionsKeyword() | 3219 if (track->kind() == TextTrack::captionsKeyword() |
3220 || track->kind() == TextTrack::subtitlesKeyword()) | 3220 || track->kind() == TextTrack::subtitlesKeyword()) |
3221 return true; | 3221 return true; |
3222 } | 3222 } |
3223 } | 3223 } |
3224 return false; | 3224 return false; |
3225 } | 3225 } |
3226 | 3226 |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3775 { | 3775 { |
3776 visitor->trace(m_client); | 3776 visitor->trace(m_client); |
3777 } | 3777 } |
3778 | 3778 |
3779 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) | 3779 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) |
3780 { | 3780 { |
3781 visitor->trace(m_client); | 3781 visitor->trace(m_client); |
3782 } | 3782 } |
3783 | 3783 |
3784 } // namespace blink | 3784 } // namespace blink |
OLD | NEW |