Ejemplo n.º 1
0
void MediaControls::reset()
{
    double duration = mediaElement().duration();
    m_durationDisplay->setInnerText(LayoutTheme::theme().formatMediaControlsTime(duration), ASSERT_NO_EXCEPTION);
    m_durationDisplay->setCurrentValue(duration);

    updatePlayState();

    updateCurrentTimeDisplay();

    m_timeline->setDuration(duration);
    m_timeline->setPosition(mediaElement().currentTime());

    if (!mediaElement().hasAudio())
        m_volumeSlider->hide();
    else
        m_volumeSlider->show();
    updateVolume();

    refreshClosedCaptionsButtonVisibility();

    if (mediaElement().hasVideo() && fullscreenIsSupported(document()))
        m_fullScreenButton->show();
    else
        m_fullScreenButton->hide();

    refreshCastButtonVisibility();
    makeOpaque();
}
Ejemplo n.º 2
0
void MediaControls::onPlay() {
  updatePlayState();
  m_timeline->setPosition(mediaElement().currentTime());
  updateCurrentTimeDisplay();

  startHideMediaControlsTimer();
}
Ejemplo n.º 3
0
void MediaControls::playbackProgressed() {
  m_timeline->setPosition(mediaElement().currentTime());
  updateCurrentTimeDisplay();

  if (isVisible() && shouldHideMediaControls())
    makeTransparent();
}
Ejemplo n.º 4
0
void MediaControls::playbackProgressed()
{
    m_timeline->setPosition(m_mediaController->currentTime());
    updateCurrentTimeDisplay();

    if (!m_isMouseOverControls && m_mediaController->hasVideo())
        makeTransparent();
}
Ejemplo n.º 5
0
void MediaControls::playbackStopped() {
  updatePlayState();
  m_timeline->setPosition(mediaElement().currentTime());
  updateCurrentTimeDisplay();
  makeOpaque();

  stopHideMediaControlsTimer();
}
Ejemplo n.º 6
0
void MediaControls::playbackStopped()
{
    m_playButton->updateDisplayType();
    m_timeline->setPosition(m_mediaController->currentTime());
    updateCurrentTimeDisplay();
    makeOpaque();

    stopHideFullscreenControlsTimer();
}
Ejemplo n.º 7
0
void MediaControls::playbackStarted()
{
    m_playButton->updateDisplayType();
    m_timeline->setPosition(m_mediaController->currentTime());
    updateCurrentTimeDisplay();

    if (m_isFullscreen)
        startHideFullscreenControlsTimer();
}
Ejemplo n.º 8
0
void MediaControls::playbackStarted()
{
    m_currentTimeDisplay->show();
    m_durationDisplay->hide();

    updatePlayState();
    m_timeline->setPosition(mediaElement().currentTime());
    updateCurrentTimeDisplay();

    startHideMediaControlsTimer();
}
Ejemplo n.º 9
0
void MediaControls::onTimeUpdate() {
  m_timeline->setPosition(mediaElement().currentTime());
  updateCurrentTimeDisplay();

  // 'timeupdate' might be called in a paused state. The controls should not
  // become transparent in that case.
  if (mediaElement().paused()) {
    makeOpaque();
    return;
  }

  if (isVisible() && shouldHideMediaControls())
    makeTransparent();
}
Ejemplo n.º 10
0
void MediaControls::playbackStarted() {
  BatchedControlUpdate batch(this);

  if (!RuntimeEnabledFeatures::newMediaPlaybackUiEnabled()) {
    m_currentTimeDisplay->setIsWanted(true);
    m_durationDisplay->setIsWanted(false);
  }

  updatePlayState();
  m_timeline->setPosition(mediaElement().currentTime());
  updateCurrentTimeDisplay();

  startHideMediaControlsTimer();
}
Ejemplo n.º 11
0
void MediaControls::reset()
{
    const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled();
    BatchedControlUpdate batch(this);

    m_allowHiddenVolumeControls = useNewUi;
    m_keepMuteButton = false;

    const double duration = mediaElement().duration();
    m_durationDisplay->setInnerText(LayoutTheme::theme().formatMediaControlsTime(duration), ASSERT_NO_EXCEPTION);
    m_durationDisplay->setCurrentValue(duration);

    if (useNewUi) {
        // Show everything that we might hide.
        // If we don't have a duration, then mark it to be hidden.  For the
        // old UI case, want / don't want is the same as show / hide since
        // it is never marked as not fitting.
        m_durationDisplay->setIsWanted(std::isfinite(duration));
        m_currentTimeDisplay->setIsWanted(true);
        m_timeline->setIsWanted(true);
    }

    updatePlayState();

    updateCurrentTimeDisplay();

    m_timeline->setDuration(duration);
    m_timeline->setPosition(mediaElement().currentTime());

    updateVolume();

    refreshClosedCaptionsButtonVisibility();

    m_fullScreenButton->setIsWanted(shouldShowFullscreenButton(mediaElement()));

    refreshCastButtonVisibilityWithoutUpdate();
    makeOpaque();

    // Set the panel width here, and force a layout, before the controls update.
    // This would be harmless for the !useNewUi case too, but it causes
    // compositing/geometry/video-fixed-scrolling.html to fail with two extra
    // 0 height nodes in the render tree.
    if (useNewUi)
        m_panelWidth = m_panel->clientWidth();
}
Ejemplo n.º 12
0
void MediaControls::reset() {
  EventDispatchForbiddenScope::AllowUserAgentEvents allowEventsInShadow;
  const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled();
  BatchedControlUpdate batch(this);

  m_allowHiddenVolumeControls = useNewUi;

  const double duration = mediaElement().duration();
  m_durationDisplay->setTextContent(
      LayoutTheme::theme().formatMediaControlsTime(duration));
  m_durationDisplay->setCurrentValue(duration);

  if (useNewUi) {
    // Show everything that we might hide.
    // If we don't have a duration, then mark it to be hidden.  For the
    // old UI case, want / don't want is the same as show / hide since
    // it is never marked as not fitting.
    m_durationDisplay->setIsWanted(std::isfinite(duration));
    m_currentTimeDisplay->setIsWanted(true);
    m_timeline->setIsWanted(true);
  }

  // If the player has entered an error state, force it into the paused state.
  if (mediaElement().error())
    mediaElement().pause();

  updatePlayState();

  updateCurrentTimeDisplay();

  m_timeline->setDuration(duration);
  m_timeline->setPosition(mediaElement().currentTime());

  updateVolume();

  refreshClosedCaptionsButtonVisibility();

  m_fullscreenButton->setIsWanted(shouldShowFullscreenButton(mediaElement()));

  refreshCastButtonVisibilityWithoutUpdate();

  m_downloadButton->setIsWanted(
      m_downloadButton->shouldDisplayDownloadButton());
}
Ejemplo n.º 13
0
void MediaControls::reset()
{
    Page* page = document().page();
    if (!page)
        return;

    m_playButton->updateDisplayType();

    updateCurrentTimeDisplay();

    double duration = m_mediaController->duration();
    if (std::isfinite(duration) || page->theme().hasOwnDisabledStateHandlingFor(MediaSliderPart)) {
        m_timeline->setDuration(duration);
        m_timeline->setPosition(m_mediaController->currentTime());
    }

    if (m_mediaController->hasAudio() || page->theme().hasOwnDisabledStateHandlingFor(MediaMuteButtonPart))
        m_panelMuteButton->show();
    else
        m_panelMuteButton->hide();

    if (m_volumeSlider) {
        if (!m_mediaController->hasAudio())
            m_volumeSlider->hide();
        else {
            m_volumeSlider->show();
            setSliderVolume();
        }
    }

    refreshClosedCaptionsButtonVisibility();

    if (m_fullScreenButton) {
        if (m_mediaController->supportsFullscreen(HTMLMediaElementEnums::VideoFullscreenModeStandard) && m_mediaController->hasVideo())
            m_fullScreenButton->show();
        else
            m_fullScreenButton->hide();
    }

    makeOpaque();
}
Ejemplo n.º 14
0
void MediaControls::reset()
{
    const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled();
    BatchedControlUpdate batch(this);

    m_allowHiddenVolumeControls = useNewUi;

    const double duration = mediaElement().duration();
    m_durationDisplay->setInnerText(LayoutTheme::theme().formatMediaControlsTime(duration), ASSERT_NO_EXCEPTION);
    m_durationDisplay->setCurrentValue(duration);

    if (useNewUi) {
        // Show everything that we might hide.
        // If we don't have a duration, then mark it to be hidden.  For the
        // old UI case, want / don't want is the same as show / hide since
        // it is never marked as not fitting.
        m_durationDisplay->setIsWanted(std::isfinite(duration));
        m_currentTimeDisplay->setIsWanted(true);
        m_timeline->setIsWanted(true);
    }

    updatePlayState();

    updateCurrentTimeDisplay();

    m_timeline->setDuration(duration);
    m_timeline->setPosition(mediaElement().currentTime());

    updateVolume();

    refreshClosedCaptionsButtonVisibility();

    m_fullScreenButton->setIsWanted(shouldShowFullscreenButton(mediaElement()));

    refreshCastButtonVisibilityWithoutUpdate();
}
void MediaControlsApple::reset()
{
    Page* page = document().page();
    if (!page)
        return;

    updateStatusDisplay();

    if (m_mediaController->supportsFullscreen(HTMLMediaElementEnums::VideoFullscreenModeStandard))
        m_fullScreenButton->show();
    else
        m_fullScreenButton->hide();

    double duration = m_mediaController->duration();
    if (std::isfinite(duration) || page->theme().hasOwnDisabledStateHandlingFor(MediaSliderPart)) {
        m_timeline->setDuration(duration);
        m_timelineContainer->show();
        m_timeline->setPosition(m_mediaController->currentTime());
        updateCurrentTimeDisplay();
    } else
        m_timelineContainer->hide();

    if (m_mediaController->hasAudio() || page->theme().hasOwnDisabledStateHandlingFor(MediaMuteButtonPart))
        m_panelMuteButton->show();
    else
        m_panelMuteButton->hide();

    if (m_volumeSlider)
        setSliderVolume();

    if (m_toggleClosedCaptionsButton) {
        if (m_mediaController->hasClosedCaptions())
            m_toggleClosedCaptionsButton->show();
        else
            m_toggleClosedCaptionsButton->hide();
    }

    if (m_playButton)
        m_playButton->updateDisplayType();

#if ENABLE(FULLSCREEN_API)
    if (m_fullScreenVolumeSlider)
        setFullscreenSliderVolume();

    if (m_isFullscreen) {
        if (m_mediaController->isLiveStream()) {
            m_seekBackButton->hide();
            m_seekForwardButton->hide();
            m_rewindButton->show();
            m_returnToRealTimeButton->show();
        } else {
            m_seekBackButton->show();
            m_seekForwardButton->show();
            m_rewindButton->hide();
            m_returnToRealTimeButton->hide();
        }
    } else
#endif
    if (!m_mediaController->isLiveStream()) {
        m_returnToRealTimeButton->hide();
        m_rewindButton->show();
    } else {
        m_returnToRealTimeButton->show();
        m_rewindButton->hide();
    }

    makeOpaque();
}