| 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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 const AttributeModificationParams& params) { | 614 const AttributeModificationParams& params) { |
| 615 const QualifiedName& name = params.name; | 615 const QualifiedName& name = params.name; |
| 616 if (name == srcAttr) { | 616 if (name == srcAttr) { |
| 617 BLINK_MEDIA_LOG << "parseAttribute(" << (void*)this | 617 BLINK_MEDIA_LOG << "parseAttribute(" << (void*)this |
| 618 << ", srcAttr, old=" << params.old_value | 618 << ", srcAttr, old=" << params.old_value |
| 619 << ", new=" << params.new_value << ")"; | 619 << ", new=" << params.new_value << ")"; |
| 620 // Trigger a reload, as long as the 'src' attribute is present. | 620 // Trigger a reload, as long as the 'src' attribute is present. |
| 621 if (!params.new_value.IsNull()) { | 621 if (!params.new_value.IsNull()) { |
| 622 ignore_preload_none_ = false; | 622 ignore_preload_none_ = false; |
| 623 InvokeLoadAlgorithm(); | 623 InvokeLoadAlgorithm(); |
| 624 if (pending_play_) { |
| 625 if (!paused_ && !playing_) { |
| 626 PlayInternal(); |
| 627 } else { |
| 628 pending_play_ = false; |
| 629 } |
| 630 } |
| 624 } | 631 } |
| 625 } else if (name == controlsAttr) { | 632 } else if (name == controlsAttr) { |
| 626 UseCounter::Count(GetDocument(), | 633 UseCounter::Count(GetDocument(), |
| 627 UseCounter::kHTMLMediaElementControlsAttribute); | 634 UseCounter::kHTMLMediaElementControlsAttribute); |
| 628 UpdateControlsVisibility(); | 635 UpdateControlsVisibility(); |
| 629 } else if (name == controlslistAttr) { | 636 } else if (name == controlslistAttr) { |
| 630 UseCounter::Count(GetDocument(), | 637 UseCounter::Count(GetDocument(), |
| 631 UseCounter::kHTMLMediaElementControlsListAttribute); | 638 UseCounter::kHTMLMediaElementControlsListAttribute); |
| 632 if (params.old_value != params.new_value) { | 639 if (params.old_value != params.new_value) { |
| 633 controls_list_->DidUpdateAttributeValue(params.old_value, | 640 controls_list_->DidUpdateAttributeValue(params.old_value, |
| (...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2271 } | 2278 } |
| 2272 | 2279 |
| 2273 return promise; | 2280 return promise; |
| 2274 } | 2281 } |
| 2275 | 2282 |
| 2276 Nullable<ExceptionCode> HTMLMediaElement::Play() { | 2283 Nullable<ExceptionCode> HTMLMediaElement::Play() { |
| 2277 BLINK_MEDIA_LOG << "play(" << (void*)this << ")"; | 2284 BLINK_MEDIA_LOG << "play(" << (void*)this << ")"; |
| 2278 | 2285 |
| 2279 Nullable<ExceptionCode> exception_code = autoplay_policy_->RequestPlay(); | 2286 Nullable<ExceptionCode> exception_code = autoplay_policy_->RequestPlay(); |
| 2280 | 2287 |
| 2288 if (EffectivePreloadType() == WebMediaPlayer::kPreloadNone && !src_object_) |
| 2289 pending_play_ = true; |
| 2290 |
| 2281 if (exception_code == kNotAllowedError) { | 2291 if (exception_code == kNotAllowedError) { |
| 2282 // If we're already playing, then this play would do nothing anyway. | 2292 // If we're already playing, then this play would do nothing anyway. |
| 2283 // Call playInternal to handle scheduling the promise resolution. | 2293 // Call playInternal to handle scheduling the promise resolution. |
| 2284 if (!paused_) { | 2294 if (!paused_) { |
| 2285 PlayInternal(); | 2295 PlayInternal(); |
| 2286 return nullptr; | 2296 return nullptr; |
| 2287 } | 2297 } |
| 2288 String message = ExceptionMessages::FailedToExecute( | 2298 String message = ExceptionMessages::FailedToExecute( |
| 2289 "play", "HTMLMediaElement", | 2299 "play", "HTMLMediaElement", |
| 2290 "API can only be initiated by a user gesture."); | 2300 "API can only be initiated by a user gesture."); |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3321 // Set rate, muted before calling play in case they were set before the | 3331 // Set rate, muted before calling play in case they were set before the |
| 3322 // media engine was setup. The media engine should just stash the rate | 3332 // media engine was setup. The media engine should just stash the rate |
| 3323 // and muted values since it isn't already playing. | 3333 // and muted values since it isn't already playing. |
| 3324 GetWebMediaPlayer()->SetRate(playbackRate()); | 3334 GetWebMediaPlayer()->SetRate(playbackRate()); |
| 3325 GetWebMediaPlayer()->SetVolume(EffectiveMediaVolume()); | 3335 GetWebMediaPlayer()->SetVolume(EffectiveMediaVolume()); |
| 3326 GetWebMediaPlayer()->Play(); | 3336 GetWebMediaPlayer()->Play(); |
| 3327 } | 3337 } |
| 3328 | 3338 |
| 3329 StartPlaybackProgressTimer(); | 3339 StartPlaybackProgressTimer(); |
| 3330 playing_ = true; | 3340 playing_ = true; |
| 3341 if (pending_play_) |
| 3342 pending_play_ = false; |
| 3343 |
| 3331 } else { // Should not be playing right now | 3344 } else { // Should not be playing right now |
| 3332 if (is_playing) { | 3345 if (is_playing) { |
| 3333 GetWebMediaPlayer()->Pause(); | 3346 GetWebMediaPlayer()->Pause(); |
| 3334 } | 3347 } |
| 3335 | 3348 |
| 3336 playback_progress_timer_.Stop(); | 3349 playback_progress_timer_.Stop(); |
| 3337 playing_ = false; | 3350 playing_ = false; |
| 3338 double time = currentTime(); | 3351 double time = currentTime(); |
| 3339 if (time > last_seek_time_) | 3352 if (time > last_seek_time_) |
| 3340 AddPlayedRange(last_seek_time_, time); | 3353 AddPlayedRange(last_seek_time_, time); |
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4080 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); | 4093 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); |
| 4081 } | 4094 } |
| 4082 | 4095 |
| 4083 void HTMLMediaElement::ViewportFillDebouncerTimerFired(TimerBase*) { | 4096 void HTMLMediaElement::ViewportFillDebouncerTimerFired(TimerBase*) { |
| 4084 mostly_filling_viewport_ = true; | 4097 mostly_filling_viewport_ = true; |
| 4085 if (web_media_player_) | 4098 if (web_media_player_) |
| 4086 web_media_player_->BecameDominantVisibleContent(mostly_filling_viewport_); | 4099 web_media_player_->BecameDominantVisibleContent(mostly_filling_viewport_); |
| 4087 } | 4100 } |
| 4088 | 4101 |
| 4089 } // namespace blink | 4102 } // namespace blink |
| OLD | NEW |