| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011 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 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 } | 1159 } |
| 1160 | 1160 |
| 1161 if (state == MediaPlayer::FormatError || state == MediaPlayer::NetworkError
|| state == MediaPlayer::DecodeError) { | 1161 if (state == MediaPlayer::FormatError || state == MediaPlayer::NetworkError
|| state == MediaPlayer::DecodeError) { |
| 1162 mediaLoadingFailed(state); | 1162 mediaLoadingFailed(state); |
| 1163 return; | 1163 return; |
| 1164 } | 1164 } |
| 1165 | 1165 |
| 1166 if (state == MediaPlayer::Idle) { | 1166 if (state == MediaPlayer::Idle) { |
| 1167 if (m_networkState > NETWORK_IDLE) { | 1167 if (m_networkState > NETWORK_IDLE) { |
| 1168 m_progressEventTimer.stop(); | 1168 m_progressEventTimer.stop(); |
| 1169 if (hasMediaControls() && m_player->bytesLoaded() != m_previousProgr
ess) |
| 1170 mediaControls()->bufferingProgressed(); |
| 1171 |
| 1169 scheduleEvent(eventNames().suspendEvent); | 1172 scheduleEvent(eventNames().suspendEvent); |
| 1170 setShouldDelayLoadEvent(false); | 1173 setShouldDelayLoadEvent(false); |
| 1171 } | 1174 } |
| 1172 m_networkState = NETWORK_IDLE; | 1175 m_networkState = NETWORK_IDLE; |
| 1173 } | 1176 } |
| 1174 | 1177 |
| 1175 if (state == MediaPlayer::Loading) { | 1178 if (state == MediaPlayer::Loading) { |
| 1176 if (m_networkState < NETWORK_LOADING || m_networkState == NETWORK_NO_SOU
RCE) | 1179 if (m_networkState < NETWORK_LOADING || m_networkState == NETWORK_NO_SOU
RCE) |
| 1177 startProgressEventTimer(); | 1180 startProgressEventTimer(); |
| 1178 m_networkState = NETWORK_LOADING; | 1181 m_networkState = NETWORK_LOADING; |
| 1179 } | 1182 } |
| 1180 | 1183 |
| 1181 if (state == MediaPlayer::Loaded) { | 1184 if (state == MediaPlayer::Loaded) { |
| 1182 if (m_networkState != NETWORK_IDLE) { | 1185 if (m_networkState != NETWORK_IDLE) { |
| 1183 m_progressEventTimer.stop(); | 1186 m_progressEventTimer.stop(); |
| 1187 if (hasMediaControls() && m_player->bytesLoaded() != m_previousProgr
ess) |
| 1188 mediaControls()->bufferingProgressed(); |
| 1184 | 1189 |
| 1185 // Schedule one last progress event so we guarantee that at least on
e is fired | 1190 // Schedule one last progress event so we guarantee that at least on
e is fired |
| 1186 // for files that load very quickly. | 1191 // for files that load very quickly. |
| 1187 scheduleEvent(eventNames().progressEvent); | 1192 scheduleEvent(eventNames().progressEvent); |
| 1188 } | 1193 } |
| 1189 m_networkState = NETWORK_IDLE; | 1194 m_networkState = NETWORK_IDLE; |
| 1190 m_completelyLoaded = true; | 1195 m_completelyLoaded = true; |
| 1191 } | 1196 } |
| 1192 | 1197 |
| 1193 if (hasMediaControls()) | 1198 if (hasMediaControls()) |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 m_sentStalledEvent = true; | 1330 m_sentStalledEvent = true; |
| 1326 setShouldDelayLoadEvent(false); | 1331 setShouldDelayLoadEvent(false); |
| 1327 } | 1332 } |
| 1328 } else { | 1333 } else { |
| 1329 scheduleEvent(eventNames().progressEvent); | 1334 scheduleEvent(eventNames().progressEvent); |
| 1330 m_previousProgress = progress; | 1335 m_previousProgress = progress; |
| 1331 m_previousProgressTime = time; | 1336 m_previousProgressTime = time; |
| 1332 m_sentStalledEvent = false; | 1337 m_sentStalledEvent = false; |
| 1333 if (renderer()) | 1338 if (renderer()) |
| 1334 renderer()->updateFromElement(); | 1339 renderer()->updateFromElement(); |
| 1340 if (hasMediaControls()) |
| 1341 mediaControls()->bufferingProgressed(); |
| 1335 } | 1342 } |
| 1336 } | 1343 } |
| 1337 | 1344 |
| 1338 void HTMLMediaElement::rewind(float timeDelta) | 1345 void HTMLMediaElement::rewind(float timeDelta) |
| 1339 { | 1346 { |
| 1340 LOG(Media, "HTMLMediaElement::rewind(%f)", timeDelta); | 1347 LOG(Media, "HTMLMediaElement::rewind(%f)", timeDelta); |
| 1341 | 1348 |
| 1342 ExceptionCode e; | 1349 ExceptionCode e; |
| 1343 setCurrentTime(max(currentTime() - timeDelta, minTimeSeekable()), e); | 1350 setCurrentTime(max(currentTime() - timeDelta, minTimeSeekable()), e); |
| 1344 } | 1351 } |
| (...skipping 2079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3424 float mediaControllerPosition = m_mediaController->currentTime(); | 3431 float mediaControllerPosition = m_mediaController->currentTime(); |
| 3425 if (mediaControllerPosition < startTime() || mediaControllerPosition > start
Time() + duration()) | 3432 if (mediaControllerPosition < startTime() || mediaControllerPosition > start
Time() + duration()) |
| 3426 return true; | 3433 return true; |
| 3427 | 3434 |
| 3428 return false; | 3435 return false; |
| 3429 } | 3436 } |
| 3430 | 3437 |
| 3431 } | 3438 } |
| 3432 | 3439 |
| 3433 #endif | 3440 #endif |
| OLD | NEW |