| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 const AttributeModificationParams& params) { | 628 const AttributeModificationParams& params) { |
| 629 const QualifiedName& name = params.name; | 629 const QualifiedName& name = params.name; |
| 630 if (name == srcAttr) { | 630 if (name == srcAttr) { |
| 631 BLINK_MEDIA_LOG << "parseAttribute(" << (void*)this | 631 BLINK_MEDIA_LOG << "parseAttribute(" << (void*)this |
| 632 << ", srcAttr, old=" << params.old_value | 632 << ", srcAttr, old=" << params.old_value |
| 633 << ", new=" << params.new_value << ")"; | 633 << ", new=" << params.new_value << ")"; |
| 634 // Trigger a reload, as long as the 'src' attribute is present. | 634 // Trigger a reload, as long as the 'src' attribute is present. |
| 635 if (!params.new_value.IsNull()) { | 635 if (!params.new_value.IsNull()) { |
| 636 ignore_preload_none_ = false; | 636 ignore_preload_none_ = false; |
| 637 InvokeLoadAlgorithm(); | 637 InvokeLoadAlgorithm(); |
| 638 if (pending_play_) { |
| 639 if (!paused_ && !playing_) { |
| 640 PlayInternal(); |
| 641 } else { |
| 642 pending_play_ = false; |
| 643 } |
| 644 } |
| 638 } | 645 } |
| 639 } else if (name == controlsAttr) { | 646 } else if (name == controlsAttr) { |
| 640 UseCounter::Count(GetDocument(), | 647 UseCounter::Count(GetDocument(), |
| 641 WebFeature::kHTMLMediaElementControlsAttribute); | 648 WebFeature::kHTMLMediaElementControlsAttribute); |
| 642 UpdateControlsVisibility(); | 649 UpdateControlsVisibility(); |
| 643 } else if (name == controlslistAttr) { | 650 } else if (name == controlslistAttr) { |
| 644 UseCounter::Count(GetDocument(), | 651 UseCounter::Count(GetDocument(), |
| 645 WebFeature::kHTMLMediaElementControlsListAttribute); | 652 WebFeature::kHTMLMediaElementControlsListAttribute); |
| 646 if (params.old_value != params.new_value) { | 653 if (params.old_value != params.new_value) { |
| 647 controls_list_->DidUpdateAttributeValue(params.old_value, | 654 controls_list_->DidUpdateAttributeValue(params.old_value, |
| (...skipping 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2293 } | 2300 } |
| 2294 | 2301 |
| 2295 return promise; | 2302 return promise; |
| 2296 } | 2303 } |
| 2297 | 2304 |
| 2298 Nullable<ExceptionCode> HTMLMediaElement::Play() { | 2305 Nullable<ExceptionCode> HTMLMediaElement::Play() { |
| 2299 BLINK_MEDIA_LOG << "play(" << (void*)this << ")"; | 2306 BLINK_MEDIA_LOG << "play(" << (void*)this << ")"; |
| 2300 | 2307 |
| 2301 Nullable<ExceptionCode> exception_code = autoplay_policy_->RequestPlay(); | 2308 Nullable<ExceptionCode> exception_code = autoplay_policy_->RequestPlay(); |
| 2302 | 2309 |
| 2310 if (EffectivePreloadType() == WebMediaPlayer::kPreloadNone && !src_object_) |
| 2311 pending_play_ = true; |
| 2312 |
| 2303 if (exception_code == kNotAllowedError) { | 2313 if (exception_code == kNotAllowedError) { |
| 2304 // If we're already playing, then this play would do nothing anyway. | 2314 // If we're already playing, then this play would do nothing anyway. |
| 2305 // Call playInternal to handle scheduling the promise resolution. | 2315 // Call playInternal to handle scheduling the promise resolution. |
| 2306 if (!paused_) { | 2316 if (!paused_) { |
| 2307 PlayInternal(); | 2317 PlayInternal(); |
| 2308 return nullptr; | 2318 return nullptr; |
| 2309 } | 2319 } |
| 2310 String message = ExceptionMessages::FailedToExecute( | 2320 String message = ExceptionMessages::FailedToExecute( |
| 2311 "play", "HTMLMediaElement", | 2321 "play", "HTMLMediaElement", |
| 2312 "API can only be initiated by a user gesture."); | 2322 "API can only be initiated by a user gesture."); |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3343 // Set rate, muted before calling play in case they were set before the | 3353 // Set rate, muted before calling play in case they were set before the |
| 3344 // media engine was setup. The media engine should just stash the rate | 3354 // media engine was setup. The media engine should just stash the rate |
| 3345 // and muted values since it isn't already playing. | 3355 // and muted values since it isn't already playing. |
| 3346 GetWebMediaPlayer()->SetRate(playbackRate()); | 3356 GetWebMediaPlayer()->SetRate(playbackRate()); |
| 3347 GetWebMediaPlayer()->SetVolume(EffectiveMediaVolume()); | 3357 GetWebMediaPlayer()->SetVolume(EffectiveMediaVolume()); |
| 3348 GetWebMediaPlayer()->Play(); | 3358 GetWebMediaPlayer()->Play(); |
| 3349 } | 3359 } |
| 3350 | 3360 |
| 3351 StartPlaybackProgressTimer(); | 3361 StartPlaybackProgressTimer(); |
| 3352 playing_ = true; | 3362 playing_ = true; |
| 3363 if (pending_play_) |
| 3364 pending_play_ = false; |
| 3365 |
| 3353 } else { // Should not be playing right now | 3366 } else { // Should not be playing right now |
| 3354 if (is_playing) { | 3367 if (is_playing) { |
| 3355 GetWebMediaPlayer()->Pause(); | 3368 GetWebMediaPlayer()->Pause(); |
| 3356 } | 3369 } |
| 3357 | 3370 |
| 3358 playback_progress_timer_.Stop(); | 3371 playback_progress_timer_.Stop(); |
| 3359 playing_ = false; | 3372 playing_ = false; |
| 3360 double time = currentTime(); | 3373 double time = currentTime(); |
| 3361 if (time > last_seek_time_) | 3374 if (time > last_seek_time_) |
| 3362 AddPlayedRange(last_seek_time_, time); | 3375 AddPlayedRange(last_seek_time_, time); |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4126 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); | 4139 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); |
| 4127 } | 4140 } |
| 4128 | 4141 |
| 4129 void HTMLMediaElement::ViewportFillDebouncerTimerFired(TimerBase*) { | 4142 void HTMLMediaElement::ViewportFillDebouncerTimerFired(TimerBase*) { |
| 4130 mostly_filling_viewport_ = true; | 4143 mostly_filling_viewport_ = true; |
| 4131 if (web_media_player_) | 4144 if (web_media_player_) |
| 4132 web_media_player_->BecameDominantVisibleContent(mostly_filling_viewport_); | 4145 web_media_player_->BecameDominantVisibleContent(mostly_filling_viewport_); |
| 4133 } | 4146 } |
| 4134 | 4147 |
| 4135 } // namespace blink | 4148 } // namespace blink |
| OLD | NEW |