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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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_cachedTimeWallClockUpdateTime(0) | 335 , m_cachedTimeWallClockUpdateTime(0) |
336 , m_minimumWallClockTimeToCacheMediaTime(0) | 336 , m_minimumWallClockTimeToCacheMediaTime(0) |
337 , m_fragmentStartTime(MediaPlayer::invalidTime()) | |
338 , m_fragmentEndTime(MediaPlayer::invalidTime()) | 337 , m_fragmentEndTime(MediaPlayer::invalidTime()) |
339 , m_pendingActionFlags(0) | 338 , m_pendingActionFlags(0) |
340 , m_userGestureRequiredForPlay(false) | 339 , m_userGestureRequiredForPlay(false) |
341 , m_playing(false) | 340 , m_playing(false) |
342 , m_shouldDelayLoadEvent(false) | 341 , m_shouldDelayLoadEvent(false) |
343 , m_haveFiredLoadedData(false) | 342 , m_haveFiredLoadedData(false) |
344 , m_active(true) | 343 , m_active(true) |
345 , m_autoplaying(true) | 344 , m_autoplaying(true) |
346 , m_muted(false) | 345 , m_muted(false) |
347 , m_paused(true) | 346 , m_paused(true) |
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1806 if (wasPotentiallyPlaying && m_readyState < HAVE_FUTURE_DATA) { | 1805 if (wasPotentiallyPlaying && m_readyState < HAVE_FUTURE_DATA) { |
1807 // 4.8.10.8 | 1806 // 4.8.10.8 |
1808 scheduleTimeupdateEvent(false); | 1807 scheduleTimeupdateEvent(false); |
1809 scheduleEvent(EventTypeNames::waiting); | 1808 scheduleEvent(EventTypeNames::waiting); |
1810 } | 1809 } |
1811 } | 1810 } |
1812 | 1811 |
1813 if (m_readyState >= HAVE_METADATA && oldState < HAVE_METADATA) { | 1812 if (m_readyState >= HAVE_METADATA && oldState < HAVE_METADATA) { |
1814 createPlaceholderTracksIfNecessary(); | 1813 createPlaceholderTracksIfNecessary(); |
1815 | 1814 |
1816 prepareMediaFragmentURI(); | 1815 selectInitialTracksIfNecessary(); |
1817 | 1816 |
1818 selectInitialTracksIfNecessary(); | 1817 MediaFragmentURIParser fragmentParser(m_currentSrc); |
1819 | 1818 |
1820 m_duration = duration(); | 1819 m_duration = duration(); |
1821 scheduleEvent(EventTypeNames::durationchange); | 1820 scheduleEvent(EventTypeNames::durationchange); |
1822 | 1821 |
1822 double end = fragmentParser.endTime(); | |
amogh.bihani
2014/09/05 09:05:43
Does end==0 needs to be taken care of? As per line
philipj_slow
2014/09/05 22:49:11
At this point it seems like we should just set m_f
amogh.bihani
2014/09/08 09:33:46
Done.
| |
1823 if (end != MediaPlayer::invalidTime() && end > 0) | |
1824 m_fragmentEndTime = std::min(end, m_duration); | |
1825 else | |
1826 m_fragmentEndTime = MediaPlayer::invalidTime(); | |
1827 | |
1823 if (isHTMLVideoElement()) | 1828 if (isHTMLVideoElement()) |
1824 scheduleEvent(EventTypeNames::resize); | 1829 scheduleEvent(EventTypeNames::resize); |
1825 scheduleEvent(EventTypeNames::loadedmetadata); | 1830 scheduleEvent(EventTypeNames::loadedmetadata); |
1826 | 1831 |
1832 bool jumped = false; | |
1827 if (m_defaultPlaybackStartPosition > 0) { | 1833 if (m_defaultPlaybackStartPosition > 0) { |
1828 seek(m_defaultPlaybackStartPosition); | 1834 seek(m_defaultPlaybackStartPosition); |
1835 jumped = true; | |
1829 m_defaultPlaybackStartPosition = 0; | 1836 m_defaultPlaybackStartPosition = 0; |
1830 } | 1837 } |
1831 | 1838 |
1839 if (!jumped) { | |
1840 double start = fragmentParser.startTime(); | |
1841 if (start !=MediaPlayer::invalidTime() && start > 0) { | |
philipj_slow
2014/09/05 22:49:12
Missing whitespace after !=
| |
1842 m_sentEndEvent = false; | |
1843 UseCounter::count(document(), UseCounter::HTMLMediaElementSeekTo FragmentStart); | |
1844 seek(start); | |
1845 jumped = true; | |
philipj_slow
2014/09/05 22:49:11
Don't need to set jumped, the spec doesn't AFAICT.
amogh.bihani
2014/09/08 09:33:45
Step 10 says "if jumped is still false, seek to th
philipj_slow
2014/09/08 14:42:31
Oh sorry, sloppy spec reading on my part. That the
| |
1846 } | |
1847 // FIXME: Add support for selecting tracks by ID with the Media Frag ments track dimension. | |
1848 } | |
1849 | |
1832 if (hasMediaControls()) | 1850 if (hasMediaControls()) |
1833 mediaControls()->reset(); | 1851 mediaControls()->reset(); |
1834 if (renderer()) | 1852 if (renderer()) |
1835 renderer()->updateFromElement(); | 1853 renderer()->updateFromElement(); |
1836 } | 1854 } |
1837 | 1855 |
1838 bool shouldUpdateDisplayState = false; | 1856 bool shouldUpdateDisplayState = false; |
1839 | 1857 |
1840 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) { |
1841 m_haveFiredLoadedData = true; | 1859 m_haveFiredLoadedData = true; |
1842 shouldUpdateDisplayState = true; | 1860 shouldUpdateDisplayState = true; |
1843 scheduleEvent(EventTypeNames::loadeddata); | 1861 scheduleEvent(EventTypeNames::loadeddata); |
1844 setShouldDelayLoadEvent(false); | 1862 setShouldDelayLoadEvent(false); |
1845 applyMediaFragmentURI(); | |
1846 } | 1863 } |
1847 | 1864 |
1848 bool isPotentiallyPlaying = potentiallyPlaying(); | 1865 bool isPotentiallyPlaying = potentiallyPlaying(); |
1849 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) { |
1850 scheduleEvent(EventTypeNames::canplay); | 1867 scheduleEvent(EventTypeNames::canplay); |
1851 if (isPotentiallyPlaying) | 1868 if (isPotentiallyPlaying) |
1852 scheduleEvent(EventTypeNames::playing); | 1869 scheduleEvent(EventTypeNames::playing); |
1853 shouldUpdateDisplayState = true; | 1870 shouldUpdateDisplayState = true; |
1854 } | 1871 } |
1855 | 1872 |
(...skipping 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3862 // or if its media controller position is either before the media resource's earliest possible | 3879 // or if its media controller position is either before the media resource's earliest possible |
3863 // position relative to the MediaController's timeline or after the end of t he media resource | 3880 // position relative to the MediaController's timeline or after the end of t he media resource |
3864 // relative to the MediaController's timeline. | 3881 // relative to the MediaController's timeline. |
3865 double mediaControllerPosition = m_mediaController->currentTime(); | 3882 double mediaControllerPosition = m_mediaController->currentTime(); |
3866 if (mediaControllerPosition < 0 || mediaControllerPosition > duration()) | 3883 if (mediaControllerPosition < 0 || mediaControllerPosition > duration()) |
3867 return true; | 3884 return true; |
3868 | 3885 |
3869 return false; | 3886 return false; |
3870 } | 3887 } |
3871 | 3888 |
3872 void HTMLMediaElement::prepareMediaFragmentURI() | |
3873 { | |
3874 MediaFragmentURIParser fragmentParser(m_currentSrc); | |
3875 double dur = duration(); | |
3876 | |
3877 double start = fragmentParser.startTime(); | |
3878 if (start != MediaFragmentURIParser::invalidTimeValue() && start > 0) { | |
3879 m_fragmentStartTime = start; | |
3880 if (m_fragmentStartTime > dur) | |
3881 m_fragmentStartTime = dur; | |
3882 } else | |
3883 m_fragmentStartTime = MediaPlayer::invalidTime(); | |
3884 | |
3885 double end = fragmentParser.endTime(); | |
3886 if (end != MediaFragmentURIParser::invalidTimeValue() && end > 0 && end > m_ fragmentStartTime) { | |
3887 m_fragmentEndTime = end; | |
3888 if (m_fragmentEndTime > dur) | |
3889 m_fragmentEndTime = dur; | |
3890 } else | |
3891 m_fragmentEndTime = MediaPlayer::invalidTime(); | |
3892 | |
3893 // FIXME: Add support for selecting tracks by ID with the Media Fragments tr ack dimension. | |
3894 | |
3895 if (m_fragmentStartTime != MediaPlayer::invalidTime() && m_readyState < HAVE _FUTURE_DATA) | |
3896 prepareToPlay(); | |
3897 } | |
3898 | |
3899 void HTMLMediaElement::applyMediaFragmentURI() | |
3900 { | |
3901 if (m_fragmentStartTime != MediaPlayer::invalidTime()) { | |
3902 m_sentEndEvent = false; | |
3903 UseCounter::count(document(), UseCounter::HTMLMediaElementSeekToFragment Start); | |
3904 seek(m_fragmentStartTime); | |
3905 } | |
3906 } | |
3907 | |
3908 WebMediaPlayer::CORSMode HTMLMediaElement::corsMode() const | 3889 WebMediaPlayer::CORSMode HTMLMediaElement::corsMode() const |
3909 { | 3890 { |
3910 const AtomicString& crossOriginMode = fastGetAttribute(crossoriginAttr); | 3891 const AtomicString& crossOriginMode = fastGetAttribute(crossoriginAttr); |
3911 if (crossOriginMode.isNull()) | 3892 if (crossOriginMode.isNull()) |
3912 return WebMediaPlayer::CORSModeUnspecified; | 3893 return WebMediaPlayer::CORSModeUnspecified; |
3913 if (equalIgnoringCase(crossOriginMode, "use-credentials")) | 3894 if (equalIgnoringCase(crossOriginMode, "use-credentials")) |
3914 return WebMediaPlayer::CORSModeUseCredentials; | 3895 return WebMediaPlayer::CORSModeUseCredentials; |
3915 return WebMediaPlayer::CORSModeAnonymous; | 3896 return WebMediaPlayer::CORSModeAnonymous; |
3916 } | 3897 } |
3917 | 3898 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4001 | 3982 |
4002 #if ENABLE(WEB_AUDIO) | 3983 #if ENABLE(WEB_AUDIO) |
4003 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) | 3984 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
4004 { | 3985 { |
4005 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) | 3986 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) |
4006 audioSourceProvider()->setClient(0); | 3987 audioSourceProvider()->setClient(0); |
4007 } | 3988 } |
4008 #endif | 3989 #endif |
4009 | 3990 |
4010 } | 3991 } |
OLD | NEW |