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 1758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1769 } | 1769 } |
1770 } | 1770 } |
1771 | 1771 |
1772 if (m_readyState >= HAVE_METADATA && oldState < HAVE_METADATA) { | 1772 if (m_readyState >= HAVE_METADATA && oldState < HAVE_METADATA) { |
1773 createPlaceholderTracksIfNecessary(); | 1773 createPlaceholderTracksIfNecessary(); |
1774 | 1774 |
1775 prepareMediaFragmentURI(); | 1775 prepareMediaFragmentURI(); |
1776 | 1776 |
1777 selectInitialTracksIfNecessary(); | 1777 selectInitialTracksIfNecessary(); |
1778 | 1778 |
| 1779 m_duration = duration(); |
1779 scheduleEvent(EventTypeNames::durationchange); | 1780 scheduleEvent(EventTypeNames::durationchange); |
| 1781 |
1780 if (isHTMLVideoElement(*this)) | 1782 if (isHTMLVideoElement(*this)) |
1781 scheduleEvent(EventTypeNames::resize); | 1783 scheduleEvent(EventTypeNames::resize); |
1782 scheduleEvent(EventTypeNames::loadedmetadata); | 1784 scheduleEvent(EventTypeNames::loadedmetadata); |
1783 if (hasMediaControls()) | 1785 if (hasMediaControls()) |
1784 mediaControls()->reset(); | 1786 mediaControls()->reset(); |
1785 if (renderer()) | 1787 if (renderer()) |
1786 renderer()->updateFromElement(); | 1788 renderer()->updateFromElement(); |
1787 } | 1789 } |
1788 | 1790 |
1789 bool shouldUpdateDisplayState = false; | 1791 bool shouldUpdateDisplayState = false; |
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3056 } | 3058 } |
3057 else | 3059 else |
3058 m_sentEndEvent = false; | 3060 m_sentEndEvent = false; |
3059 | 3061 |
3060 updatePlayState(); | 3062 updatePlayState(); |
3061 } | 3063 } |
3062 | 3064 |
3063 void HTMLMediaElement::mediaPlayerDurationChanged() | 3065 void HTMLMediaElement::mediaPlayerDurationChanged() |
3064 { | 3066 { |
3065 WTF_LOG(Media, "HTMLMediaElement::mediaPlayerDurationChanged"); | 3067 WTF_LOG(Media, "HTMLMediaElement::mediaPlayerDurationChanged"); |
3066 durationChanged(duration()); | 3068 // FIXME: Change MediaPlayerClient & WebMediaPlayer to convey |
| 3069 // the currentTime when the duration change occured. The current |
| 3070 // WebMediaPlayer implementations always clamp currentTime() to |
| 3071 // duration() so the requestSeek condition here is always false. |
| 3072 durationChanged(duration(), currentTime() > duration()); |
3067 } | 3073 } |
3068 | 3074 |
3069 void HTMLMediaElement::durationChanged(double duration) | 3075 void HTMLMediaElement::durationChanged(double duration, bool requestSeek) |
3070 { | 3076 { |
3071 WTF_LOG(Media, "HTMLMediaElement::durationChanged(%f)", duration); | 3077 WTF_LOG(Media, "HTMLMediaElement::durationChanged(%f, %d)", duration, reques
tSeek); |
3072 | 3078 |
3073 // Abort if duration unchanged. | 3079 // Abort if duration unchanged. |
3074 if (m_duration == duration) | 3080 if (m_duration == duration) |
3075 return; | 3081 return; |
3076 | 3082 |
| 3083 WTF_LOG(Media, "HTMLMediaElement::durationChanged : %f -> %f", m_duration, d
uration); |
3077 m_duration = duration; | 3084 m_duration = duration; |
3078 scheduleEvent(EventTypeNames::durationchange); | 3085 scheduleEvent(EventTypeNames::durationchange); |
3079 | 3086 |
3080 if (hasMediaControls()) | 3087 if (hasMediaControls()) |
3081 mediaControls()->reset(); | 3088 mediaControls()->reset(); |
3082 if (renderer()) | 3089 if (renderer()) |
3083 renderer()->updateFromElement(); | 3090 renderer()->updateFromElement(); |
3084 | 3091 |
3085 if (currentTime() > duration) | 3092 if (requestSeek) |
3086 seek(duration, IGNORE_EXCEPTION); | 3093 seek(duration, IGNORE_EXCEPTION); |
3087 } | 3094 } |
3088 | 3095 |
3089 void HTMLMediaElement::mediaPlayerPlaybackStateChanged() | 3096 void HTMLMediaElement::mediaPlayerPlaybackStateChanged() |
3090 { | 3097 { |
3091 WTF_LOG(Media, "HTMLMediaElement::mediaPlayerPlaybackStateChanged"); | 3098 WTF_LOG(Media, "HTMLMediaElement::mediaPlayerPlaybackStateChanged"); |
3092 | 3099 |
3093 if (!m_player || m_pausedInternal) | 3100 if (!m_player || m_pausedInternal) |
3094 return; | 3101 return; |
3095 | 3102 |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3954 | 3961 |
3955 #if ENABLE(WEB_AUDIO) | 3962 #if ENABLE(WEB_AUDIO) |
3956 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) | 3963 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
3957 { | 3964 { |
3958 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) | 3965 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) |
3959 audioSourceProvider()->setClient(0); | 3966 audioSourceProvider()->setClient(0); |
3960 } | 3967 } |
3961 #endif | 3968 #endif |
3962 | 3969 |
3963 } | 3970 } |
OLD | NEW |