| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 bool isURLAttribute(const Attribute&) const override; | 277 bool isURLAttribute(const Attribute&) const override; |
| 278 void attach(const AttachContext& = AttachContext()) override; | 278 void attach(const AttachContext& = AttachContext()) override; |
| 279 | 279 |
| 280 void didMoveToNewDocument(Document& oldDocument) override; | 280 void didMoveToNewDocument(Document& oldDocument) override; |
| 281 virtual KURL posterImageURL() const { return KURL(); } | 281 virtual KURL posterImageURL() const { return KURL(); } |
| 282 | 282 |
| 283 enum DisplayMode { Unknown, Poster, Video }; | 283 enum DisplayMode { Unknown, Poster, Video }; |
| 284 DisplayMode getDisplayMode() const { return m_displayMode; } | 284 DisplayMode getDisplayMode() const { return m_displayMode; } |
| 285 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; } | 285 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; } |
| 286 | 286 |
| 287 void recordAutoplayMetric(AutoplayMetrics); |
| 288 |
| 287 private: | 289 private: |
| 288 void resetMediaPlayerAndMediaSource(); | 290 void resetMediaPlayerAndMediaSource(); |
| 289 | 291 |
| 290 bool alwaysCreateUserAgentShadowRoot() const final { return true; } | 292 bool alwaysCreateUserAgentShadowRoot() const final { return true; } |
| 291 bool areAuthorShadowsAllowed() const final { return false; } | 293 bool areAuthorShadowsAllowed() const final { return false; } |
| 292 | 294 |
| 293 bool supportsFocus() const final; | 295 bool supportsFocus() const final; |
| 294 bool isMouseFocusable() const final; | 296 bool isMouseFocusable() const final; |
| 295 bool layoutObjectIsNeeded(const ComputedStyle&) override; | 297 bool layoutObjectIsNeeded(const ComputedStyle&) override; |
| 296 LayoutObject* createLayoutObject(const ComputedStyle&) override; | 298 LayoutObject* createLayoutObject(const ComputedStyle&) override; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 void deferredLoadTimerFired(Timer<HTMLMediaElement>*); | 385 void deferredLoadTimerFired(Timer<HTMLMediaElement>*); |
| 384 | 386 |
| 385 void markCaptionAndSubtitleTracksAsUnconfigured(); | 387 void markCaptionAndSubtitleTracksAsUnconfigured(); |
| 386 | 388 |
| 387 // This does not check user gesture restrictions. | 389 // This does not check user gesture restrictions. |
| 388 void playInternal(); | 390 void playInternal(); |
| 389 | 391 |
| 390 // This does not change the buffering strategy. | 392 // This does not change the buffering strategy. |
| 391 void pauseInternal(); | 393 void pauseInternal(); |
| 392 | 394 |
| 393 // If we are about to enter a paused state, call this to record | |
| 394 // autoplay metrics. If we were already in a stopped state, then | |
| 395 // this does nothing. | |
| 396 void recordMetricsIfPausing(); | |
| 397 // Could stopping at this point be considered a bailout of playback? | |
| 398 // (as in, "The user really didn't want to play this"). | |
| 399 bool isBailout() const; | |
| 400 void autoplayMediaEncountered(); | |
| 401 void allowVideoRendering(); | 395 void allowVideoRendering(); |
| 402 | 396 |
| 403 void updateVolume(); | 397 void updateVolume(); |
| 404 void updatePlayState(); | 398 void updatePlayState(); |
| 405 bool potentiallyPlaying() const; | 399 bool potentiallyPlaying() const; |
| 406 bool stoppedDueToErrors() const; | 400 bool stoppedDueToErrors() const; |
| 407 bool couldPlayIfEnoughData() const; | 401 bool couldPlayIfEnoughData() const; |
| 408 | 402 |
| 409 // Generally the presence of the loop attribute should be considered to mean
playback | 403 // Generally the presence of the loop attribute should be considered to mean
playback |
| 410 // has not "ended", as "ended" and "looping" are mutually exclusive. See | 404 // has not "ended", as "ended" and "looping" are mutually exclusive. See |
| (...skipping 11 matching lines...) Expand all Loading... |
| 422 TextTrackContainer& ensureTextTrackContainer(); | 416 TextTrackContainer& ensureTextTrackContainer(); |
| 423 | 417 |
| 424 void* preDispatchEventHandler(Event*) final; | 418 void* preDispatchEventHandler(Event*) final; |
| 425 | 419 |
| 426 void changeNetworkStateFromLoadingToIdle(); | 420 void changeNetworkStateFromLoadingToIdle(); |
| 427 | 421 |
| 428 bool isAutoplaying() const { return m_autoplaying; } | 422 bool isAutoplaying() const { return m_autoplaying; } |
| 429 | 423 |
| 430 void setAllowHiddenVolumeControls(bool); | 424 void setAllowHiddenVolumeControls(bool); |
| 431 | 425 |
| 432 void recordAutoplayMetric(AutoplayMetrics); | |
| 433 | |
| 434 WebMediaPlayer::CORSMode corsMode() const; | 426 WebMediaPlayer::CORSMode corsMode() const; |
| 435 | 427 |
| 436 // Returns the "direction of playback" value as specified in the HTML5 spec. | 428 // Returns the "direction of playback" value as specified in the HTML5 spec. |
| 437 enum DirectionOfPlayback { Backward, Forward }; | 429 enum DirectionOfPlayback { Backward, Forward }; |
| 438 DirectionOfPlayback getDirectionOfPlayback() const; | 430 DirectionOfPlayback getDirectionOfPlayback() const; |
| 439 | 431 |
| 440 // Creates placeholder AudioTrack and/or VideoTrack objects when WebMemediaP
layer objects | 432 // 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 | 433 // advertise they have audio and/or video, but don't explicitly signal them
via |
| 442 // addAudioTrack() and addVideoTrack(). | 434 // addAudioTrack() and addVideoTrack(). |
| 443 // FIXME: Remove this once all WebMediaPlayer implementations properly repor
t their track info. | 435 // FIXME: Remove this once all WebMediaPlayer implementations properly repor
t their track info. |
| 444 void createPlaceholderTracksIfNecessary(); | 436 void createPlaceholderTracksIfNecessary(); |
| 445 | 437 |
| 446 // Sets the selected/enabled tracks if they aren't set before we initially | 438 // Sets the selected/enabled tracks if they aren't set before we initially |
| 447 // transition to HAVE_METADATA. | 439 // transition to HAVE_METADATA. |
| 448 void selectInitialTracksIfNecessary(); | 440 void selectInitialTracksIfNecessary(); |
| 449 | 441 |
| 450 // Return true if and only if we require a user gesture before letting | 442 // Return true if and only if we require a user gesture before letting |
| 451 // the media play. | 443 // the media play. |
| 452 bool isUserGestureRequiredForPlay() const; | 444 bool isUserGestureRequiredForPlay() const; |
| 445 |
| 446 // If the user gesture is required, then this will remove it. Note that |
| 447 // one should not generally call this method directly; use the one on |
| 448 // m_helper and give it a reason. |
| 453 void removeUserGestureRequirement(); | 449 void removeUserGestureRequirement(); |
| 454 void setInitialPlayWithoutUserGestures(bool); | |
| 455 | 450 |
| 456 void setNetworkState(NetworkState); | 451 void setNetworkState(NetworkState); |
| 457 | 452 |
| 458 void audioTracksTimerFired(Timer<HTMLMediaElement>*); | 453 void audioTracksTimerFired(Timer<HTMLMediaElement>*); |
| 459 | 454 |
| 460 // TODO(liberato): remove once autoplay gesture override experiment conclude
s. | 455 // TODO(liberato): remove once autoplay gesture override experiment conclude
s. |
| 461 void triggerAutoplayViewportCheckForTesting(); | 456 void triggerAutoplayViewportCheckForTesting(); |
| 462 | 457 |
| 463 void scheduleResolvePlayPromises(); | 458 void scheduleResolvePlayPromises(); |
| 464 void scheduleRejectPlayPromises(ExceptionCode); | 459 void scheduleRejectPlayPromises(ExceptionCode); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 bool m_sentEndEvent : 1; | 553 bool m_sentEndEvent : 1; |
| 559 | 554 |
| 560 bool m_closedCaptionsVisible : 1; | 555 bool m_closedCaptionsVisible : 1; |
| 561 | 556 |
| 562 bool m_ignorePreloadNone : 1; | 557 bool m_ignorePreloadNone : 1; |
| 563 bool m_tracksAreReady : 1; | 558 bool m_tracksAreReady : 1; |
| 564 bool m_processingPreferenceChange : 1; | 559 bool m_processingPreferenceChange : 1; |
| 565 bool m_remoteRoutesAvailable : 1; | 560 bool m_remoteRoutesAvailable : 1; |
| 566 bool m_playingRemotely : 1; | 561 bool m_playingRemotely : 1; |
| 567 bool m_isFinalizing : 1; | 562 bool m_isFinalizing : 1; |
| 568 bool m_initialPlayWithoutUserGesture : 1; | |
| 569 bool m_autoplayMediaCounted : 1; | |
| 570 // Whether this element is in overlay fullscreen mode. | 563 // Whether this element is in overlay fullscreen mode. |
| 571 bool m_inOverlayFullscreenVideo : 1; | 564 bool m_inOverlayFullscreenVideo : 1; |
| 572 | 565 |
| 573 PersistentWillBeMember<AudioTrackList> m_audioTracks; | 566 PersistentWillBeMember<AudioTrackList> m_audioTracks; |
| 574 PersistentWillBeMember<VideoTrackList> m_videoTracks; | 567 PersistentWillBeMember<VideoTrackList> m_videoTracks; |
| 575 PersistentWillBeMember<TextTrackList> m_textTracks; | 568 PersistentWillBeMember<TextTrackList> m_textTracks; |
| 576 PersistentHeapVectorWillBeHeapVector<Member<TextTrack>> m_textTracksWhenReso
urceSelectionBegan; | 569 PersistentHeapVectorWillBeHeapVector<Member<TextTrack>> m_textTracksWhenReso
urceSelectionBegan; |
| 577 | 570 |
| 578 OwnPtrWillBeMember<CueTimeline> m_cueTimeline; | 571 OwnPtrWillBeMember<CueTimeline> m_cueTimeline; |
| 579 | 572 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 DECLARE_TRACE(); | 622 DECLARE_TRACE(); |
| 630 | 623 |
| 631 private: | 624 private: |
| 632 WebAudioSourceProvider* m_webAudioSourceProvider; | 625 WebAudioSourceProvider* m_webAudioSourceProvider; |
| 633 PersistentWillBeMember<AudioClientImpl> m_client; | 626 PersistentWillBeMember<AudioClientImpl> m_client; |
| 634 Mutex provideInputLock; | 627 Mutex provideInputLock; |
| 635 }; | 628 }; |
| 636 | 629 |
| 637 AudioSourceProviderImpl m_audioSourceProvider; | 630 AudioSourceProviderImpl m_audioSourceProvider; |
| 638 | 631 |
| 632 class AutoplayHelperClientImpl; |
| 633 |
| 639 friend class Internals; | 634 friend class Internals; |
| 640 friend class TrackDisplayUpdateScope; | 635 friend class TrackDisplayUpdateScope; |
| 641 friend class AutoplayExperimentHelper; | 636 friend class AutoplayExperimentHelper; |
| 642 friend class MediaControlsTest; | 637 friend class MediaControlsTest; |
| 643 | 638 |
| 644 AutoplayExperimentHelper m_autoplayHelper; | 639 OwnPtrWillBeMember<AutoplayExperimentHelper::Client> m_autoplayHelperClient; |
| 640 OwnPtrWillBeMember<AutoplayExperimentHelper> m_autoplayHelper; |
| 645 | 641 |
| 646 WebRemotePlaybackClient* m_remotePlaybackClient; | 642 WebRemotePlaybackClient* m_remotePlaybackClient; |
| 647 | 643 |
| 648 static URLRegistry* s_mediaStreamRegistry; | 644 static URLRegistry* s_mediaStreamRegistry; |
| 649 }; | 645 }; |
| 650 | 646 |
| 651 inline bool isHTMLMediaElement(const HTMLElement& element) | 647 inline bool isHTMLMediaElement(const HTMLElement& element) |
| 652 { | 648 { |
| 653 return isHTMLAudioElement(element) || isHTMLVideoElement(element); | 649 return isHTMLAudioElement(element) || isHTMLVideoElement(element); |
| 654 } | 650 } |
| 655 | 651 |
| 656 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 652 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
| 657 | 653 |
| 658 } // namespace blink | 654 } // namespace blink |
| 659 | 655 |
| 660 #endif // HTMLMediaElement_h | 656 #endif // HTMLMediaElement_h |
| OLD | NEW |