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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 , m_playing(false) | 338 , m_playing(false) |
339 , m_shouldDelayLoadEvent(false) | 339 , m_shouldDelayLoadEvent(false) |
340 , m_haveFiredLoadedData(false) | 340 , m_haveFiredLoadedData(false) |
341 , m_active(true) | 341 , m_active(true) |
342 , m_autoplaying(true) | 342 , m_autoplaying(true) |
343 , m_muted(false) | 343 , m_muted(false) |
344 , m_paused(true) | 344 , m_paused(true) |
345 , m_seeking(false) | 345 , m_seeking(false) |
346 , m_sentStalledEvent(false) | 346 , m_sentStalledEvent(false) |
347 , m_sentEndEvent(false) | 347 , m_sentEndEvent(false) |
348 , m_pausedInternal(false) | |
349 , m_closedCaptionsVisible(false) | 348 , m_closedCaptionsVisible(false) |
350 , m_completelyLoaded(false) | 349 , m_completelyLoaded(false) |
351 , m_havePreparedToPlay(false) | 350 , m_havePreparedToPlay(false) |
352 , m_tracksAreReady(true) | 351 , m_tracksAreReady(true) |
353 , m_haveVisibleTextTrack(false) | 352 , m_haveVisibleTextTrack(false) |
354 , m_processingPreferenceChange(false) | 353 , m_processingPreferenceChange(false) |
355 , m_remoteRoutesAvailable(false) | 354 , m_remoteRoutesAvailable(false) |
356 , m_playingRemotely(false) | 355 , m_playingRemotely(false) |
357 #if ENABLE(OILPAN) | 356 #if ENABLE(OILPAN) |
358 , m_isFinalizing(false) | 357 , m_isFinalizing(false) |
(...skipping 2824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3183 renderer()->updateFromElement(); | 3182 renderer()->updateFromElement(); |
3184 | 3183 |
3185 if (requestSeek) | 3184 if (requestSeek) |
3186 seek(duration); | 3185 seek(duration); |
3187 } | 3186 } |
3188 | 3187 |
3189 void HTMLMediaElement::mediaPlayerPlaybackStateChanged() | 3188 void HTMLMediaElement::mediaPlayerPlaybackStateChanged() |
3190 { | 3189 { |
3191 WTF_LOG(Media, "HTMLMediaElement::mediaPlayerPlaybackStateChanged(%p)", this
); | 3190 WTF_LOG(Media, "HTMLMediaElement::mediaPlayerPlaybackStateChanged(%p)", this
); |
3192 | 3191 |
3193 if (!m_player || m_pausedInternal) | 3192 if (!webMediaPlayer()) |
3194 return; | 3193 return; |
3195 | 3194 |
3196 if (webMediaPlayer()->paused()) | 3195 if (webMediaPlayer()->paused()) |
3197 pause(); | 3196 pause(); |
3198 else | 3197 else |
3199 playInternal(); | 3198 playInternal(); |
3200 } | 3199 } |
3201 | 3200 |
3202 void HTMLMediaElement::mediaPlayerRequestFullscreen() | 3201 void HTMLMediaElement::mediaPlayerRequestFullscreen() |
3203 { | 3202 { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3349 | 3348 |
3350 return false; | 3349 return false; |
3351 } | 3350 } |
3352 | 3351 |
3353 void HTMLMediaElement::updatePlayState() | 3352 void HTMLMediaElement::updatePlayState() |
3354 { | 3353 { |
3355 if (!m_player) | 3354 if (!m_player) |
3356 return; | 3355 return; |
3357 | 3356 |
3358 bool isPlaying = webMediaPlayer() && !webMediaPlayer()->paused(); | 3357 bool isPlaying = webMediaPlayer() && !webMediaPlayer()->paused(); |
3359 if (m_pausedInternal) { | |
3360 if (isPlaying) | |
3361 webMediaPlayer()->pause(); | |
3362 refreshCachedTime(); | |
3363 m_playbackProgressTimer.stop(); | |
3364 if (hasMediaControls()) | |
3365 mediaControls()->playbackStopped(); | |
3366 return; | |
3367 } | |
3368 | |
3369 bool shouldBePlaying = potentiallyPlaying(); | 3358 bool shouldBePlaying = potentiallyPlaying(); |
3370 | 3359 |
3371 WTF_LOG(Media, "HTMLMediaElement::updatePlayState(%p) - shouldBePlaying = %s
, isPlaying = %s", | 3360 WTF_LOG(Media, "HTMLMediaElement::updatePlayState(%p) - shouldBePlaying = %s
, isPlaying = %s", |
3372 this, boolString(shouldBePlaying), boolString(isPlaying)); | 3361 this, boolString(shouldBePlaying), boolString(isPlaying)); |
3373 | 3362 |
3374 if (shouldBePlaying) { | 3363 if (shouldBePlaying) { |
3375 setDisplayMode(Video); | 3364 setDisplayMode(Video); |
3376 invalidateCachedTime(); | 3365 invalidateCachedTime(); |
3377 | 3366 |
3378 if (!isPlaying) { | 3367 if (!isPlaying) { |
(...skipping 26 matching lines...) Expand all Loading... |
3405 if (hasMediaControls()) | 3394 if (hasMediaControls()) |
3406 mediaControls()->playbackStopped(); | 3395 mediaControls()->playbackStopped(); |
3407 } | 3396 } |
3408 | 3397 |
3409 updateMediaController(); | 3398 updateMediaController(); |
3410 | 3399 |
3411 if (renderer()) | 3400 if (renderer()) |
3412 renderer()->updateFromElement(); | 3401 renderer()->updateFromElement(); |
3413 } | 3402 } |
3414 | 3403 |
3415 void HTMLMediaElement::setPausedInternal(bool b) | |
3416 { | |
3417 m_pausedInternal = b; | |
3418 updatePlayState(); | |
3419 } | |
3420 | |
3421 void HTMLMediaElement::stopPeriodicTimers() | 3404 void HTMLMediaElement::stopPeriodicTimers() |
3422 { | 3405 { |
3423 m_progressEventTimer.stop(); | 3406 m_progressEventTimer.stop(); |
3424 m_playbackProgressTimer.stop(); | 3407 m_playbackProgressTimer.stop(); |
3425 } | 3408 } |
3426 | 3409 |
3427 void HTMLMediaElement::userCancelledLoad() | 3410 void HTMLMediaElement::userCancelledLoad() |
3428 { | 3411 { |
3429 WTF_LOG(Media, "HTMLMediaElement::userCancelledLoad(%p)", this); | 3412 WTF_LOG(Media, "HTMLMediaElement::userCancelledLoad(%p)", this); |
3430 | 3413 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3511 { | 3494 { |
3512 WTF_LOG(Media, "HTMLMediaElement::stop(%p)", this); | 3495 WTF_LOG(Media, "HTMLMediaElement::stop(%p)", this); |
3513 | 3496 |
3514 m_active = false; | 3497 m_active = false; |
3515 userCancelledLoad(); | 3498 userCancelledLoad(); |
3516 | 3499 |
3517 // Stop the playback without generating events | 3500 // Stop the playback without generating events |
3518 m_playing = false; | 3501 m_playing = false; |
3519 m_paused = true; | 3502 m_paused = true; |
3520 m_seeking = false; | 3503 m_seeking = false; |
3521 setPausedInternal(true); | |
3522 | 3504 |
3523 if (renderer()) | 3505 if (renderer()) |
3524 renderer()->updateFromElement(); | 3506 renderer()->updateFromElement(); |
3525 | 3507 |
3526 stopPeriodicTimers(); | 3508 stopPeriodicTimers(); |
3527 cancelPendingEventsAndCallbacks(); | 3509 cancelPendingEventsAndCallbacks(); |
3528 | 3510 |
3529 m_asyncEventQueue->close(); | 3511 m_asyncEventQueue->close(); |
3530 | 3512 |
3531 // Ensure that hasPendingActivity() is not preventing garbage collection, si
nce otherwise this | 3513 // Ensure that hasPendingActivity() is not preventing garbage collection, si
nce otherwise this |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4047 | 4029 |
4048 #if ENABLE(WEB_AUDIO) | 4030 #if ENABLE(WEB_AUDIO) |
4049 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) | 4031 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
4050 { | 4032 { |
4051 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) | 4033 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) |
4052 audioSourceProvider()->setClient(0); | 4034 audioSourceProvider()->setClient(0); |
4053 } | 4035 } |
4054 #endif | 4036 #endif |
4055 | 4037 |
4056 } | 4038 } |
OLD | NEW |