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 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1694 | 1694 |
1695 void HTMLMediaElement::progressEventTimerFired(Timer<HTMLMediaElement>*) | 1695 void HTMLMediaElement::progressEventTimerFired(Timer<HTMLMediaElement>*) |
1696 { | 1696 { |
1697 ASSERT(m_player); | 1697 ASSERT(m_player); |
1698 if (m_networkState != NETWORK_LOADING) | 1698 if (m_networkState != NETWORK_LOADING) |
1699 return; | 1699 return; |
1700 | 1700 |
1701 double time = WTF::currentTime(); | 1701 double time = WTF::currentTime(); |
1702 double timedelta = time - m_previousProgressTime; | 1702 double timedelta = time - m_previousProgressTime; |
1703 | 1703 |
1704 if (m_player->didLoadingProgress()) { | 1704 if (webMediaPlayer() && webMediaPlayer()->didLoadingProgress()) { |
1705 scheduleEvent(EventTypeNames::progress); | 1705 scheduleEvent(EventTypeNames::progress); |
1706 m_previousProgressTime = time; | 1706 m_previousProgressTime = time; |
1707 m_sentStalledEvent = false; | 1707 m_sentStalledEvent = false; |
1708 if (renderer()) | 1708 if (renderer()) |
1709 renderer()->updateFromElement(); | 1709 renderer()->updateFromElement(); |
1710 } else if (timedelta > 3.0 && !m_sentStalledEvent) { | 1710 } else if (timedelta > 3.0 && !m_sentStalledEvent) { |
1711 scheduleEvent(EventTypeNames::stalled); | 1711 scheduleEvent(EventTypeNames::stalled); |
1712 m_sentStalledEvent = true; | 1712 m_sentStalledEvent = true; |
1713 setShouldDelayLoadEvent(false); | 1713 setShouldDelayLoadEvent(false); |
1714 } | 1714 } |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1967 void HTMLMediaElement::setPlaybackRate(double rate) | 1967 void HTMLMediaElement::setPlaybackRate(double rate) |
1968 { | 1968 { |
1969 WTF_LOG(Media, "HTMLMediaElement::setPlaybackRate(%f)", rate); | 1969 WTF_LOG(Media, "HTMLMediaElement::setPlaybackRate(%f)", rate); |
1970 | 1970 |
1971 if (m_playbackRate != rate) { | 1971 if (m_playbackRate != rate) { |
1972 m_playbackRate = rate; | 1972 m_playbackRate = rate; |
1973 invalidateCachedTime(); | 1973 invalidateCachedTime(); |
1974 scheduleEvent(EventTypeNames::ratechange); | 1974 scheduleEvent(EventTypeNames::ratechange); |
1975 } | 1975 } |
1976 | 1976 |
1977 if (m_player && potentiallyPlaying() && m_player->rate() != rate && !m_media Controller) | 1977 if (m_player && potentiallyPlaying() && !m_mediaController && webMediaPlayer ()) |
acolwell GONE FROM CHROMIUM
2014/06/02 23:01:14
I believe the webMediaPlayer() check is not necess
Srirama
2014/06/04 06:48:13
Done.
| |
1978 m_player->setRate(rate); | 1978 webMediaPlayer()->setRate(rate); |
1979 } | 1979 } |
1980 | 1980 |
1981 void HTMLMediaElement::updatePlaybackRate() | 1981 void HTMLMediaElement::updatePlaybackRate() |
1982 { | 1982 { |
1983 double effectiveRate = m_mediaController ? m_mediaController->playbackRate() : m_playbackRate; | 1983 double effectiveRate = m_mediaController ? m_mediaController->playbackRate() : m_playbackRate; |
1984 if (m_player && potentiallyPlaying() && m_player->rate() != effectiveRate) | 1984 if (m_player && potentiallyPlaying() && webMediaPlayer()) |
acolwell GONE FROM CHROMIUM
2014/06/02 23:01:14
ditto
Srirama
2014/06/04 06:48:13
Done.
| |
1985 m_player->setRate(effectiveRate); | 1985 webMediaPlayer()->setRate(effectiveRate); |
1986 } | 1986 } |
1987 | 1987 |
1988 bool HTMLMediaElement::ended() const | 1988 bool HTMLMediaElement::ended() const |
1989 { | 1989 { |
1990 // 4.8.10.8 Playing the media resource | 1990 // 4.8.10.8 Playing the media resource |
1991 // The ended attribute must return true if the media element has ended | 1991 // The ended attribute must return true if the media element has ended |
1992 // playback and the direction of playback is forwards, and false otherwise. | 1992 // playback and the direction of playback is forwards, and false otherwise. |
1993 return endedPlayback() && m_playbackRate > 0; | 1993 return endedPlayback() && m_playbackRate > 0; |
1994 } | 1994 } |
1995 | 1995 |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2875 ASSERT(hasVideo()); // "resize" makes no sense absent video. | 2875 ASSERT(hasVideo()); // "resize" makes no sense absent video. |
2876 if (m_readyState > HAVE_NOTHING && isHTMLVideoElement(*this)) | 2876 if (m_readyState > HAVE_NOTHING && isHTMLVideoElement(*this)) |
2877 scheduleEvent(EventTypeNames::resize); | 2877 scheduleEvent(EventTypeNames::resize); |
2878 | 2878 |
2879 if (renderer()) | 2879 if (renderer()) |
2880 renderer()->updateFromElement(); | 2880 renderer()->updateFromElement(); |
2881 } | 2881 } |
2882 | 2882 |
2883 PassRefPtr<TimeRanges> HTMLMediaElement::buffered() const | 2883 PassRefPtr<TimeRanges> HTMLMediaElement::buffered() const |
2884 { | 2884 { |
2885 if (!m_player) | 2885 if (!m_player) |
acolwell GONE FROM CHROMIUM
2014/06/02 23:01:14
Remove this case since it should now be covered by
Srirama
2014/06/04 06:48:13
Done.
| |
2886 return TimeRanges::create(); | 2886 return TimeRanges::create(); |
2887 | 2887 |
2888 if (m_mediaSource) | 2888 if (m_mediaSource) |
2889 return m_mediaSource->buffered(); | 2889 return m_mediaSource->buffered(); |
2890 | 2890 |
2891 return m_player->buffered(); | 2891 if (!webMediaPlayer()) |
2892 return TimeRanges::create(); | |
2893 | |
2894 return TimeRanges::create(webMediaPlayer()->buffered()); | |
2892 } | 2895 } |
2893 | 2896 |
2894 PassRefPtr<TimeRanges> HTMLMediaElement::played() | 2897 PassRefPtr<TimeRanges> HTMLMediaElement::played() |
2895 { | 2898 { |
2896 if (m_playing) { | 2899 if (m_playing) { |
2897 double time = currentTime(); | 2900 double time = currentTime(); |
2898 if (time > m_lastSeekTime) | 2901 if (time > m_lastSeekTime) |
2899 addPlayedRange(m_lastSeekTime, time); | 2902 addPlayedRange(m_lastSeekTime, time); |
2900 } | 2903 } |
2901 | 2904 |
2902 if (!m_playedTimeRanges) | 2905 if (!m_playedTimeRanges) |
2903 m_playedTimeRanges = TimeRanges::create(); | 2906 m_playedTimeRanges = TimeRanges::create(); |
2904 | 2907 |
2905 return m_playedTimeRanges->copy(); | 2908 return m_playedTimeRanges->copy(); |
2906 } | 2909 } |
2907 | 2910 |
2908 PassRefPtr<TimeRanges> HTMLMediaElement::seekable() const | 2911 PassRefPtr<TimeRanges> HTMLMediaElement::seekable() const |
2909 { | 2912 { |
2910 if (m_player) { | 2913 if (m_player && webMediaPlayer()) { |
acolwell GONE FROM CHROMIUM
2014/06/02 23:01:14
m_player shouldn't be needed now since it is cover
Srirama
2014/06/04 06:48:13
Done.
| |
2911 double maxTimeSeekable = m_player->maxTimeSeekable(); | 2914 double maxTimeSeekable = webMediaPlayer()->maxTimeSeekable(); |
2912 if (maxTimeSeekable) | 2915 if (maxTimeSeekable) |
2913 return TimeRanges::create(0, maxTimeSeekable); | 2916 return TimeRanges::create(0, maxTimeSeekable); |
2914 } | 2917 } |
2915 return TimeRanges::create(); | 2918 return TimeRanges::create(); |
2916 } | 2919 } |
2917 | 2920 |
2918 bool HTMLMediaElement::potentiallyPlaying() const | 2921 bool HTMLMediaElement::potentiallyPlaying() const |
2919 { | 2922 { |
2920 // "pausedToBuffer" means the media engine's rate is 0, but only because it had to stop playing | 2923 // "pausedToBuffer" means the media engine's rate is 0, but only because it had to stop playing |
2921 // when it ran out of buffered data. A movie is this state is "potentially p laying", modulo the | 2924 // when it ran out of buffered data. A movie is this state is "potentially p laying", modulo the |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3017 WTF_LOG(Media, "HTMLMediaElement::updatePlayState - shouldBePlaying = %s, pl ayerPaused = %s", | 3020 WTF_LOG(Media, "HTMLMediaElement::updatePlayState - shouldBePlaying = %s, pl ayerPaused = %s", |
3018 boolString(shouldBePlaying), boolString(playerPaused)); | 3021 boolString(shouldBePlaying), boolString(playerPaused)); |
3019 | 3022 |
3020 if (shouldBePlaying) { | 3023 if (shouldBePlaying) { |
3021 setDisplayMode(Video); | 3024 setDisplayMode(Video); |
3022 invalidateCachedTime(); | 3025 invalidateCachedTime(); |
3023 | 3026 |
3024 if (playerPaused) { | 3027 if (playerPaused) { |
3025 // Set rate, muted before calling play in case they were set before the media engine was setup. | 3028 // Set rate, muted before calling play in case they were set before the media engine was setup. |
3026 // The media engine should just stash the rate and muted values sinc e it isn't already playing. | 3029 // The media engine should just stash the rate and muted values sinc e it isn't already playing. |
3027 m_player->setRate(m_playbackRate); | 3030 if (webMediaPlayer()) |
acolwell GONE FROM CHROMIUM
2014/06/02 23:01:14
I believe this is not necessary because I don't th
Srirama
2014/06/04 06:48:13
Done.
| |
3031 webMediaPlayer()->setRate(m_playbackRate); | |
3028 updateVolume(); | 3032 updateVolume(); |
3029 | 3033 |
3030 m_player->play(); | 3034 m_player->play(); |
3031 } | 3035 } |
3032 | 3036 |
3033 if (hasMediaControls()) | 3037 if (hasMediaControls()) |
3034 mediaControls()->playbackStarted(); | 3038 mediaControls()->playbackStarted(); |
3035 startPlaybackProgressTimer(); | 3039 startPlaybackProgressTimer(); |
3036 m_playing = true; | 3040 m_playing = true; |
3037 | 3041 |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3649 visitor->trace(m_error); | 3653 visitor->trace(m_error); |
3650 visitor->trace(m_currentSourceNode); | 3654 visitor->trace(m_currentSourceNode); |
3651 visitor->trace(m_nextChildNodeToConsider); | 3655 visitor->trace(m_nextChildNodeToConsider); |
3652 visitor->trace(m_textTracks); | 3656 visitor->trace(m_textTracks); |
3653 visitor->trace(m_textTracksWhenResourceSelectionBegan); | 3657 visitor->trace(m_textTracksWhenResourceSelectionBegan); |
3654 WillBeHeapSupplementable<HTMLMediaElement>::trace(visitor); | 3658 WillBeHeapSupplementable<HTMLMediaElement>::trace(visitor); |
3655 HTMLElement::trace(visitor); | 3659 HTMLElement::trace(visitor); |
3656 } | 3660 } |
3657 | 3661 |
3658 } | 3662 } |
OLD | NEW |