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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 , m_lastTimeUpdateEventWallTime(0) | 325 , m_lastTimeUpdateEventWallTime(0) |
326 , m_lastTimeUpdateEventMovieTime(std::numeric_limits<double>::max()) | 326 , m_lastTimeUpdateEventMovieTime(std::numeric_limits<double>::max()) |
327 , m_defaultPlaybackStartPosition(0) | 327 , m_defaultPlaybackStartPosition(0) |
328 , m_loadState(WaitingForSource) | 328 , m_loadState(WaitingForSource) |
329 , m_deferredLoadState(NotDeferred) | 329 , m_deferredLoadState(NotDeferred) |
330 , m_deferredLoadTimer(this, &HTMLMediaElement::deferredLoadTimerFired) | 330 , m_deferredLoadTimer(this, &HTMLMediaElement::deferredLoadTimerFired) |
331 , m_webLayer(0) | 331 , m_webLayer(0) |
332 , m_preload(MediaPlayer::Auto) | 332 , m_preload(MediaPlayer::Auto) |
333 , m_displayMode(Unknown) | 333 , m_displayMode(Unknown) |
334 , m_cachedTime(MediaPlayer::invalidTime()) | 334 , m_cachedTime(MediaPlayer::invalidTime()) |
335 , m_fragmentStartTime(MediaPlayer::invalidTime()) | |
336 , m_fragmentEndTime(MediaPlayer::invalidTime()) | 335 , m_fragmentEndTime(MediaPlayer::invalidTime()) |
337 , m_pendingActionFlags(0) | 336 , m_pendingActionFlags(0) |
338 , m_userGestureRequiredForPlay(false) | 337 , m_userGestureRequiredForPlay(false) |
339 , m_playing(false) | 338 , m_playing(false) |
340 , m_shouldDelayLoadEvent(false) | 339 , m_shouldDelayLoadEvent(false) |
341 , m_haveFiredLoadedData(false) | 340 , m_haveFiredLoadedData(false) |
342 , m_active(true) | 341 , m_active(true) |
343 , m_autoplaying(true) | 342 , m_autoplaying(true) |
344 , m_muted(false) | 343 , m_muted(false) |
345 , m_paused(true) | 344 , m_paused(true) |
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1801 if (wasPotentiallyPlaying && m_readyState < HAVE_FUTURE_DATA) { | 1800 if (wasPotentiallyPlaying && m_readyState < HAVE_FUTURE_DATA) { |
1802 // 4.8.10.8 | 1801 // 4.8.10.8 |
1803 scheduleTimeupdateEvent(false); | 1802 scheduleTimeupdateEvent(false); |
1804 scheduleEvent(EventTypeNames::waiting); | 1803 scheduleEvent(EventTypeNames::waiting); |
1805 } | 1804 } |
1806 } | 1805 } |
1807 | 1806 |
1808 if (m_readyState >= HAVE_METADATA && oldState < HAVE_METADATA) { | 1807 if (m_readyState >= HAVE_METADATA && oldState < HAVE_METADATA) { |
1809 createPlaceholderTracksIfNecessary(); | 1808 createPlaceholderTracksIfNecessary(); |
1810 | 1809 |
1811 prepareMediaFragmentURI(); | 1810 selectInitialTracksIfNecessary(); |
1812 | 1811 |
1813 selectInitialTracksIfNecessary(); | 1812 MediaFragmentURIParser fragmentParser(m_currentSrc); |
1813 m_fragmentEndTime = fragmentParser.endTime(); | |
1814 | 1814 |
1815 m_duration = duration(); | 1815 m_duration = duration(); |
1816 scheduleEvent(EventTypeNames::durationchange); | 1816 scheduleEvent(EventTypeNames::durationchange); |
1817 | 1817 |
1818 if (isHTMLVideoElement()) | 1818 if (isHTMLVideoElement()) |
1819 scheduleEvent(EventTypeNames::resize); | 1819 scheduleEvent(EventTypeNames::resize); |
1820 scheduleEvent(EventTypeNames::loadedmetadata); | 1820 scheduleEvent(EventTypeNames::loadedmetadata); |
1821 | 1821 |
1822 if (m_defaultPlaybackStartPosition > 0) | 1822 bool jumped = false; |
1823 if (m_defaultPlaybackStartPosition > 0) { | |
1823 seek(m_defaultPlaybackStartPosition); | 1824 seek(m_defaultPlaybackStartPosition); |
1825 jumped = true; | |
1826 } | |
1827 m_defaultPlaybackStartPosition = 0; | |
1824 | 1828 |
1825 m_defaultPlaybackStartPosition = 0; | 1829 double initialPlaybackPosition = fragmentParser.startTime(); |
1830 if (initialPlaybackPosition == MediaPlayer::invalidTime()) | |
1831 initialPlaybackPosition = 0; | |
1832 | |
1833 if (!jumped) { | |
1834 if (initialPlaybackPosition > 0) { | |
philipj_slow
2014/09/11 14:38:28
Can you invert the order of these two conditions o
amogh.bihani
2014/09/12 11:02:23
Done.
| |
1835 m_sentEndEvent = false; | |
1836 UseCounter::count(document(), UseCounter::HTMLMediaElementSeekTo FragmentStart); | |
1837 seek(initialPlaybackPosition); | |
1838 jumped = true; | |
1839 } | |
1840 // FIXME: Add support for selecting tracks by ID with the Media Frag ments track dimension. | |
philipj_slow
2014/09/11 14:38:28
Maybe it's time to drop or move this FIXME, becaus
amogh.bihani
2014/09/12 11:02:23
Done.
| |
1841 } | |
1842 | |
1843 if (m_mediaController) { | |
1844 if (jumped && initialPlaybackPosition > m_mediaController->currentTi me()) | |
1845 m_mediaController->setCurrentTime(initialPlaybackPosition); | |
1846 else | |
1847 seek(m_mediaController->currentTime()); | |
1848 } | |
1849 | |
1826 if (hasMediaControls()) | 1850 if (hasMediaControls()) |
1827 mediaControls()->reset(); | 1851 mediaControls()->reset(); |
1828 if (renderer()) | 1852 if (renderer()) |
1829 renderer()->updateFromElement(); | 1853 renderer()->updateFromElement(); |
1830 } | 1854 } |
1831 | 1855 |
1832 bool shouldUpdateDisplayState = false; | 1856 bool shouldUpdateDisplayState = false; |
1833 | 1857 |
1834 if (m_readyState >= HAVE_CURRENT_DATA && oldState < HAVE_CURRENT_DATA && !m_ haveFiredLoadedData) { | 1858 if (m_readyState >= HAVE_CURRENT_DATA && oldState < HAVE_CURRENT_DATA && !m_ haveFiredLoadedData) { |
1835 m_haveFiredLoadedData = true; | 1859 m_haveFiredLoadedData = true; |
1836 shouldUpdateDisplayState = true; | 1860 shouldUpdateDisplayState = true; |
1837 scheduleEvent(EventTypeNames::loadeddata); | 1861 scheduleEvent(EventTypeNames::loadeddata); |
1838 setShouldDelayLoadEvent(false); | 1862 setShouldDelayLoadEvent(false); |
1839 applyMediaFragmentURI(); | |
1840 } | 1863 } |
1841 | 1864 |
1842 bool isPotentiallyPlaying = potentiallyPlaying(); | 1865 bool isPotentiallyPlaying = potentiallyPlaying(); |
1843 if (m_readyState == HAVE_FUTURE_DATA && oldState <= HAVE_CURRENT_DATA && tra cksAreReady) { | 1866 if (m_readyState == HAVE_FUTURE_DATA && oldState <= HAVE_CURRENT_DATA && tra cksAreReady) { |
1844 scheduleEvent(EventTypeNames::canplay); | 1867 scheduleEvent(EventTypeNames::canplay); |
1845 if (isPotentiallyPlaying) | 1868 if (isPotentiallyPlaying) |
1846 scheduleEvent(EventTypeNames::playing); | 1869 scheduleEvent(EventTypeNames::playing); |
1847 shouldUpdateDisplayState = true; | 1870 shouldUpdateDisplayState = true; |
1848 } | 1871 } |
1849 | 1872 |
(...skipping 1994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3844 // or if its media controller position is either before the media resource's earliest possible | 3867 // or if its media controller position is either before the media resource's earliest possible |
3845 // position relative to the MediaController's timeline or after the end of t he media resource | 3868 // position relative to the MediaController's timeline or after the end of t he media resource |
3846 // relative to the MediaController's timeline. | 3869 // relative to the MediaController's timeline. |
3847 double mediaControllerPosition = m_mediaController->currentTime(); | 3870 double mediaControllerPosition = m_mediaController->currentTime(); |
3848 if (mediaControllerPosition < 0 || mediaControllerPosition > duration()) | 3871 if (mediaControllerPosition < 0 || mediaControllerPosition > duration()) |
3849 return true; | 3872 return true; |
3850 | 3873 |
3851 return false; | 3874 return false; |
3852 } | 3875 } |
3853 | 3876 |
3854 void HTMLMediaElement::prepareMediaFragmentURI() | |
3855 { | |
3856 MediaFragmentURIParser fragmentParser(m_currentSrc); | |
3857 double dur = duration(); | |
3858 | |
3859 double start = fragmentParser.startTime(); | |
3860 if (start != MediaFragmentURIParser::invalidTimeValue() && start > 0) { | |
3861 m_fragmentStartTime = start; | |
3862 if (m_fragmentStartTime > dur) | |
3863 m_fragmentStartTime = dur; | |
3864 } else | |
3865 m_fragmentStartTime = MediaPlayer::invalidTime(); | |
3866 | |
3867 double end = fragmentParser.endTime(); | |
3868 if (end != MediaFragmentURIParser::invalidTimeValue() && end > 0 && end > m_ fragmentStartTime) { | |
3869 m_fragmentEndTime = end; | |
3870 if (m_fragmentEndTime > dur) | |
3871 m_fragmentEndTime = dur; | |
3872 } else | |
3873 m_fragmentEndTime = MediaPlayer::invalidTime(); | |
3874 | |
3875 // FIXME: Add support for selecting tracks by ID with the Media Fragments tr ack dimension. | |
3876 | |
3877 if (m_fragmentStartTime != MediaPlayer::invalidTime() && m_readyState < HAVE _FUTURE_DATA) | |
3878 prepareToPlay(); | |
3879 } | |
3880 | |
3881 void HTMLMediaElement::applyMediaFragmentURI() | |
3882 { | |
3883 if (m_fragmentStartTime != MediaPlayer::invalidTime()) { | |
3884 m_sentEndEvent = false; | |
3885 UseCounter::count(document(), UseCounter::HTMLMediaElementSeekToFragment Start); | |
3886 seek(m_fragmentStartTime); | |
3887 } | |
3888 } | |
3889 | |
3890 WebMediaPlayer::CORSMode HTMLMediaElement::corsMode() const | 3877 WebMediaPlayer::CORSMode HTMLMediaElement::corsMode() const |
3891 { | 3878 { |
3892 const AtomicString& crossOriginMode = fastGetAttribute(crossoriginAttr); | 3879 const AtomicString& crossOriginMode = fastGetAttribute(crossoriginAttr); |
3893 if (crossOriginMode.isNull()) | 3880 if (crossOriginMode.isNull()) |
3894 return WebMediaPlayer::CORSModeUnspecified; | 3881 return WebMediaPlayer::CORSModeUnspecified; |
3895 if (equalIgnoringCase(crossOriginMode, "use-credentials")) | 3882 if (equalIgnoringCase(crossOriginMode, "use-credentials")) |
3896 return WebMediaPlayer::CORSModeUseCredentials; | 3883 return WebMediaPlayer::CORSModeUseCredentials; |
3897 return WebMediaPlayer::CORSModeAnonymous; | 3884 return WebMediaPlayer::CORSModeAnonymous; |
3898 } | 3885 } |
3899 | 3886 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3983 | 3970 |
3984 #if ENABLE(WEB_AUDIO) | 3971 #if ENABLE(WEB_AUDIO) |
3985 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) | 3972 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
3986 { | 3973 { |
3987 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) | 3974 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) |
3988 audioSourceProvider()->setClient(0); | 3975 audioSourceProvider()->setClient(0); |
3989 } | 3976 } |
3990 #endif | 3977 #endif |
3991 | 3978 |
3992 } | 3979 } |
OLD | NEW |