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