⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 176714 in webkit


Ignore:
Timestamp:
Dec 3, 2014, 2:09:06 AM (12 years ago)
Author:
dino@apple.com
Message:

[Media] Audio content shouldn't have fullscreen buttons, even if in a video element
https://bugs.webkit.org/show_bug.cgi?id=139200
<rdar://problem/18914506>

Reviewed by Eric Carlson.

Source/WebCore:

An audio-only resource, even if loaded into a <video> element, should not
present the fullscreen or optimised fullscreen controls. This includes a
MediaDocument, which is always a <video> element. We can detect this by
examining the length of the videoTracks property as our content loads.

Test: media/audio-as-video-fullscreen.html

  • Modules/mediacontrols/mediaControlsApple.js:

(Controller): Initialize a hasVisualMedia to false.
(Controller.prototype.handleReadyStateChange): If we see a videoTrack, hasVisualMedia is now true.
(Controller.prototype.updateFullscreenButtons): Merge the updateFullscreenButton and
updateOptimizedFullscreenButton methods into this single spot, and check for
hasVisualMedia.
(Controller.prototype.updateFullscreenButton): Deleted.
(Controller.prototype.updateOptimizedFullscreenButton): Deleted.

  • Modules/mediacontrols/mediaControlsBase.js: Do the same for the other ports.

LayoutTests:

Loads an audio file via the video element and checks if the
fullscreen button is visible.

  • media/audio-as-video-fullscreen-expected.txt: Added.
  • media/audio-as-video-fullscreen.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r176712 r176714  
     12014-12-02  Dean Jackson  <dino@apple.com>
     2
     3        [Media] Audio content shouldn't have fullscreen buttons, even if in a video element
     4        https://bugs.webkit.org/show_bug.cgi?id=139200
     5        <rdar://problem/18914506>
     6
     7        Reviewed by Eric Carlson.
     8
     9        Loads an audio file via the video element and checks if the
     10        fullscreen button is visible.
     11
     12        * media/audio-as-video-fullscreen-expected.txt: Added.
     13        * media/audio-as-video-fullscreen.html: Added.
     14
    1152014-12-03  Eva Balazsfalvi  <evab.u-szeged@partner.samsung.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r176713 r176714  
     12014-12-02  Dean Jackson  <dino@apple.com>
     2
     3        [Media] Audio content shouldn't have fullscreen buttons, even if in a video element
     4        https://bugs.webkit.org/show_bug.cgi?id=139200
     5        <rdar://problem/18914506>
     6
     7        Reviewed by Eric Carlson.
     8
     9        An audio-only resource, even if loaded into a <video> element, should not
     10        present the fullscreen or optimised fullscreen controls. This includes a
     11        MediaDocument, which is always a <video> element. We can detect this by
     12        examining the length of the videoTracks property as our content loads.
     13
     14        Test: media/audio-as-video-fullscreen.html
     15
     16        * Modules/mediacontrols/mediaControlsApple.js:
     17        (Controller): Initialize a hasVisualMedia to false.
     18        (Controller.prototype.handleReadyStateChange): If we see a videoTrack, hasVisualMedia is now true.
     19        (Controller.prototype.updateFullscreenButtons): Merge the updateFullscreenButton and
     20        updateOptimizedFullscreenButton methods into this single spot, and check for
     21        hasVisualMedia.
     22        (Controller.prototype.updateFullscreenButton): Deleted.
     23        (Controller.prototype.updateOptimizedFullscreenButton): Deleted.
     24
     25        * Modules/mediacontrols/mediaControlsBase.js: Do the same for the other ports.
     26
    1272014-12-02  Dean Jackson  <dino@apple.com>
    228
  • trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js

    r176139 r176714  
    1313    this.isLive = false;
    1414    this.statusHidden = true;
     15    this.hasVisualMedia = false;
    1516
    1617    this.addVideoListeners();
     
    2728    this.updateCaptionButton();
    2829    this.updateCaptionContainer();
    29     this.updateFullscreenButton();
     30    this.updateFullscreenButtons();
    3031    this.updateVolume();
    3132    this.updateHasAudio();
     
    555556    handleReadyStateChange: function(event)
    556557    {
     558        this.hasVisualMedia = this.video.videoTracks && this.video.videoTracks.length > 0;
    557559        this.updateReadyState();
    558560        this.updateDuration();
    559561        this.updateCaptionButton();
    560562        this.updateCaptionContainer();
    561         this.updateFullscreenButton();
    562         this.updateOptimizedFullscreenButton();
     563        this.updateFullscreenButtons();
    563564        this.updateProgress();
    564565    },
     
    861862    },
    862863
    863     updateFullscreenButton: function()
    864     {
    865         this.controls.fullscreenButton.classList.toggle(this.ClassNames.hidden, !this.video.webkitSupportsFullscreen);
    866     },
    867 
    868     updateOptimizedFullscreenButton: function()
    869     {
    870         this.controls.optimizedFullscreenButton.classList.toggle(this.ClassNames.hidden, !this.video.webkitSupportsFullscreen);
    871     },
    872    
     864    updateFullscreenButtons: function()
     865    {
     866        var shouldBeHidden = !this.video.webkitSupportsFullscreen || !this.hasVisualMedia;
     867        this.controls.fullscreenButton.classList.toggle(this.ClassNames.hidden, shouldBeHidden);
     868        this.controls.optimizedFullscreenButton.classList.toggle(this.ClassNames.hidden, shouldBeHidden);
     869    },
     870
    873871    handleFullscreenButtonClicked: function(event)
    874872    {
  • trunk/Source/WebCore/Modules/mediacontrols/mediaControlsBase.js

    r175477 r176714  
    1313    this.isLive = false;
    1414    this.statusHidden = true;
     15    this.hasVisualMedia = false;
    1516
    1617    this.addVideoListeners();
     
    555556    handleReadyStateChange: function(event)
    556557    {
     558        this.hasVisualMedia = this.video.videoTracks && this.video.videoTracks.length > 0;
    557559        this.updateReadyState();
    558560        this.updateDuration();
     
    837839    updateFullscreenButton: function()
    838840    {
    839         this.controls.fullscreenButton.classList.toggle(this.ClassNames.hidden, !this.video.webkitSupportsFullscreen);
     841        this.controls.fullscreenButton.classList.toggle(this.ClassNames.hidden, (!this.video.webkitSupportsFullscreen || !this.hasVisualMedia));
    840842    },
    841843
Note: See TracChangeset for help on using the changeset viewer.