Commit e0ff32d3 authored by mitz@apple.com's avatar mitz@apple.com

Made the full-screen video HUD appear when playback stops, such as when

the end of the video is reached.

Reviewed by Eric Carlson.

* WebView/WebVideoFullscreenHUDWindowController.h: Cleaned up.
* WebView/WebVideoFullscreenHUDWindowController.mm:
(-[WebVideoFullscreenHUDWindowController scheduleTimeUpdate]): Updated
for the renaming of -updateRate to -updatePlayButton.
(-[WebVideoFullscreenHUDWindowController updatePlayButton]): Renamed
-updateRate to this.
(-[WebVideoFullscreenHUDWindowController updateRate]): This method now
responds to changes to the playback rate by updating the play button
and showing or hiding the HUD as necessary.
(-[WebVideoFullscreenHUDWindowController togglePlaying:]): Now only
toggles playing. UI updates are driven by -updateRate being called.
(-[WebVideoFullscreenHUDWindowController playing]): Cleaned up.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50636 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 660fdcec
2009-11-08 Dan Bernstein <mitz@apple.com>
Reviewed by Eric Carlson.
Made the full-screen video HUD appear when playback stops, such as when
the end of the video is reached.
* WebView/WebVideoFullscreenHUDWindowController.h: Cleaned up.
* WebView/WebVideoFullscreenHUDWindowController.mm:
(-[WebVideoFullscreenHUDWindowController scheduleTimeUpdate]): Updated
for the renaming of -updateRate to -updatePlayButton.
(-[WebVideoFullscreenHUDWindowController updatePlayButton]): Renamed
-updateRate to this.
(-[WebVideoFullscreenHUDWindowController updateRate]): This method now
responds to changes to the playback rate by updating the play button
and showing or hiding the HUD as necessary.
(-[WebVideoFullscreenHUDWindowController togglePlaying:]): Now only
toggles playing. UI updates are driven by -updateRate being called.
(-[WebVideoFullscreenHUDWindowController playing]): Cleaned up.
2009-11-02 Eric Carlson <eric.carlson@apple.com>
Reviewed by John Sullivan and Mark Rowe.
......
......@@ -10,17 +10,17 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#if ENABLE(VIDEO)
......@@ -33,7 +33,7 @@ namespace WebCore {
@interface WebVideoFullscreenHUDWindowController : NSWindowController
{
id<WebVideoFullscreenHUDWindowControllerDelegate> _delegate;
id <WebVideoFullscreenHUDWindowControllerDelegate> _delegate;
NSTimer *_timelineUpdateTimer;
#if !defined(BUILDING_ON_TIGER)
NSTrackingArea *_area;
......@@ -48,8 +48,8 @@ namespace WebCore {
NSButton *_playButton;
}
- (id<WebVideoFullscreenHUDWindowControllerDelegate>)delegate;
- (void)setDelegate:(id<WebVideoFullscreenHUDWindowControllerDelegate>)delegate;
- (id <WebVideoFullscreenHUDWindowControllerDelegate>)delegate;
- (void)setDelegate:(id <WebVideoFullscreenHUDWindowControllerDelegate>)delegate;
- (void)fadeWindowIn;
- (void)fadeWindowOut;
- (void)closeWindow;
......
......@@ -59,6 +59,7 @@ static inline CGFloat webkit_CGFloor(CGFloat value)
- (void)decrementVolume;
- (void)incrementVolume;
- (void)updatePlayButton;
- (void)togglePlaying:(id)sender;
- (BOOL)playing;
- (void)setPlaying:(BOOL)playing;
......@@ -210,12 +211,12 @@ static const NSTimeInterval HUDWindowFadeOutDelay = 3;
[super keyDown:event];
}
- (id<WebVideoFullscreenHUDWindowControllerDelegate>)delegate
- (id <WebVideoFullscreenHUDWindowControllerDelegate>)delegate
{
return _delegate;
}
- (void)setDelegate:(id<WebVideoFullscreenHUDWindowControllerDelegate>)delegate
- (void)setDelegate:(id <WebVideoFullscreenHUDWindowControllerDelegate>)delegate
{
_delegate = delegate;
}
......@@ -226,7 +227,7 @@ static const NSTimeInterval HUDWindowFadeOutDelay = 3;
// First, update right away, then schedule future update
[self updateTime];
[self updateRate];
[self updatePlayButton];
[_timelineUpdateTimer invalidate];
[_timelineUpdateTimer release];
......@@ -525,30 +526,37 @@ static NSTextField *createTimeTextField(NSRect frame)
[self updateVolume];
}
- (void)updateRate
- (void)updatePlayButton
{
[_playButton setIntValue:[self playing]];
}
- (void)togglePlaying:(id)sender
- (void)updateRate
{
BOOL nowPlaying = [self playing];
[self setPlaying:!nowPlaying];
BOOL playing = [self playing];
// Keep HUD visible when paused
if (!nowPlaying)
// Keep the HUD visible when paused.
if (!playing)
[self fadeWindowIn];
else if (!_mouseIsInHUD) {
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(fadeWindowOut) object:nil];
[self performSelector:@selector(fadeWindowOut) withObject:nil afterDelay:HUDWindowFadeOutDelay];
}
[self updatePlayButton];
}
- (void)togglePlaying:(id)sender
{
[self setPlaying:![self playing]];
}
- (BOOL)playing
{
if (![_delegate mediaElement])
return false;
return ![_delegate mediaElement]->canPlay();
HTMLMediaElement* mediaElement = [_delegate mediaElement];
if (!mediaElement)
return NO;
return !mediaElement->canPlay();
}
- (void)setPlaying:(BOOL)playing
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment