| 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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 // Creates placeholder AudioTrack and/or VideoTrack objects when WebMemediaP
layer objects | 440 // Creates placeholder AudioTrack and/or VideoTrack objects when WebMemediaP
layer objects |
| 441 // advertise they have audio and/or video, but don't explicitly signal them
via | 441 // advertise they have audio and/or video, but don't explicitly signal them
via |
| 442 // addAudioTrack() and addVideoTrack(). | 442 // addAudioTrack() and addVideoTrack(). |
| 443 // FIXME: Remove this once all WebMediaPlayer implementations properly repor
t their track info. | 443 // FIXME: Remove this once all WebMediaPlayer implementations properly repor
t their track info. |
| 444 void createPlaceholderTracksIfNecessary(); | 444 void createPlaceholderTracksIfNecessary(); |
| 445 | 445 |
| 446 // Sets the selected/enabled tracks if they aren't set before we initially | 446 // Sets the selected/enabled tracks if they aren't set before we initially |
| 447 // transition to HAVE_METADATA. | 447 // transition to HAVE_METADATA. |
| 448 void selectInitialTracksIfNecessary(); | 448 void selectInitialTracksIfNecessary(); |
| 449 | 449 |
| 450 // Return true if and only if we require a user gesture before letting | 450 // Return true if and only if a user gesture is required to unlock this |
| 451 // the media play. | 451 // media element for unrestricted autoplay / script control. Don't confuse |
| 452 bool isUserGestureRequiredForPlay() const; | 452 // this with isGestureNeededForPlayback(). The latter is usually what one |
| 453 // should use, if checking to see if an action is allowed. |
| 454 bool isLockedPendingUserGesture() const; |
| 453 | 455 |
| 454 // If the user gesture is required, then this will remove it. Note that | 456 // If the user gesture is required, then this will remove it. Note that |
| 455 // one should not generally call this method directly; use the one on | 457 // one should not generally call this method directly; use the one on |
| 456 // m_helper and give it a reason. | 458 // m_helper and give it a reason. |
| 457 void removeUserGestureRequirement(); | 459 void unlockUserGesture(); |
| 460 |
| 461 // Return true if and only if a user gesture is requried for playback. Even |
| 462 // if isLockedPendingUserGesture() return true, this might return false if |
| 463 // the requirement is currently overridden. This does not check if a user |
| 464 // gesture is currently being processed. |
| 465 bool isGestureNeededForPlayback() const; |
| 458 | 466 |
| 459 void setNetworkState(NetworkState); | 467 void setNetworkState(NetworkState); |
| 460 | 468 |
| 461 void audioTracksTimerFired(Timer<HTMLMediaElement>*); | 469 void audioTracksTimerFired(Timer<HTMLMediaElement>*); |
| 462 | 470 |
| 463 // TODO(liberato): remove once autoplay gesture override experiment conclude
s. | 471 // TODO(liberato): remove once autoplay gesture override experiment conclude
s. |
| 464 void triggerAutoplayViewportCheckForTesting(); | 472 void triggerAutoplayViewportCheckForTesting(); |
| 465 | 473 |
| 466 void scheduleResolvePlayPromises(); | 474 void scheduleResolvePlayPromises(); |
| 467 void scheduleRejectPlayPromises(ExceptionCode); | 475 void scheduleRejectPlayPromises(ExceptionCode); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 // Cached time value. Only valid when ready state is HAVE_METADATA or | 547 // Cached time value. Only valid when ready state is HAVE_METADATA or |
| 540 // higher, otherwise the current time is assumed to be zero. | 548 // higher, otherwise the current time is assumed to be zero. |
| 541 mutable double m_cachedTime; | 549 mutable double m_cachedTime; |
| 542 | 550 |
| 543 double m_fragmentEndTime; | 551 double m_fragmentEndTime; |
| 544 | 552 |
| 545 typedef unsigned PendingActionFlags; | 553 typedef unsigned PendingActionFlags; |
| 546 PendingActionFlags m_pendingActionFlags; | 554 PendingActionFlags m_pendingActionFlags; |
| 547 | 555 |
| 548 // FIXME: HTMLMediaElement has way too many state bits. | 556 // FIXME: HTMLMediaElement has way too many state bits. |
| 549 bool m_userGestureRequiredForPlay : 1; | 557 bool m_lockedPendingUserGesture : 1; |
| 550 bool m_playing : 1; | 558 bool m_playing : 1; |
| 551 bool m_shouldDelayLoadEvent : 1; | 559 bool m_shouldDelayLoadEvent : 1; |
| 552 bool m_haveFiredLoadedData : 1; | 560 bool m_haveFiredLoadedData : 1; |
| 553 bool m_autoplaying : 1; | 561 bool m_autoplaying : 1; |
| 554 bool m_muted : 1; | 562 bool m_muted : 1; |
| 555 bool m_paused : 1; | 563 bool m_paused : 1; |
| 556 bool m_seeking : 1; | 564 bool m_seeking : 1; |
| 557 | 565 |
| 558 // data has not been loaded since sending a "stalled" event | 566 // data has not been loaded since sending a "stalled" event |
| 559 bool m_sentStalledEvent : 1; | 567 bool m_sentStalledEvent : 1; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 inline bool isHTMLMediaElement(const HTMLElement& element) | 662 inline bool isHTMLMediaElement(const HTMLElement& element) |
| 655 { | 663 { |
| 656 return isHTMLAudioElement(element) || isHTMLVideoElement(element); | 664 return isHTMLAudioElement(element) || isHTMLVideoElement(element); |
| 657 } | 665 } |
| 658 | 666 |
| 659 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 667 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
| 660 | 668 |
| 661 } // namespace blink | 669 } // namespace blink |
| 662 | 670 |
| 663 #endif // HTMLMediaElement_h | 671 #endif // HTMLMediaElement_h |
| OLD | NEW |