2009-10-22 Eric Carlson <eric.carlson@apple.com>

        Reviewed by Dan Bernstein & Simon Fraser.

        <rdar://problem/7297717>
        https://bugs.webkit.org/show_bug.cgi?id=30323
        Play/pause button in full-screen video controller does not reflect current state

        * WebView/WebVideoFullscreenController.mm:
        (-[WebVideoFullscreenController setMediaElement:WebCore::]): Register for QTMovieRateDidChangeNotification
        (-[WebVideoFullscreenController rateChanged:]): Call HUD controller when rate changes.

        * WebView/WebVideoFullscreenHUDWindowController.h:
        * WebView/WebVideoFullscreenHUDWindowController.mm:
        (-[WebVideoFullscreenHUDWindowController scheduleTimeUpdate]): Call updateRate so play button
        reflects playback state.
        (-[WebVideoFullscreenHUDWindowController updateRate]): New, set play button state according to
        movie state.
        (-[WebVideoFullscreenHUDWindowController playingChanged:]): Only call [self playing] once.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49948 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0a749158
2009-10-22 Eric Carlson <eric.carlson@apple.com>
Reviewed by Dan Bernstein & Simon Fraser.
<rdar://problem/7297717>
https://bugs.webkit.org/show_bug.cgi?id=30323
Play/pause button in full-screen video controller does not reflect current state
* WebView/WebVideoFullscreenController.mm:
(-[WebVideoFullscreenController setMediaElement:WebCore::]): Register for QTMovieRateDidChangeNotification
(-[WebVideoFullscreenController rateChanged:]): Call HUD controller when rate changes.
* WebView/WebVideoFullscreenHUDWindowController.h:
* WebView/WebVideoFullscreenHUDWindowController.mm:
(-[WebVideoFullscreenHUDWindowController scheduleTimeUpdate]): Call updateRate so play button
reflects playback state.
(-[WebVideoFullscreenHUDWindowController updateRate]): New, set play button state according to
movie state.
(-[WebVideoFullscreenHUDWindowController playingChanged:]): Only call [self playing] once.
2009-10-21 John Sullivan <sullivan@apple.com>
Rubber-stamped by Dan Bernstein.
......
......@@ -42,6 +42,10 @@
SOFT_LINK_FRAMEWORK(QTKit)
SOFT_LINK_CLASS(QTKit, QTMovieView)
SOFT_LINK_POINTER(QTKit, QTMovieRateDidChangeNotification, NSString *)
#define QTMovieRateDidChangeNotification getQTMovieRateDidChangeNotification()
@interface WebVideoFullscreenWindow : NSWindow
#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_TIGER)
<NSAnimationDelegate>
......@@ -76,6 +80,7 @@ SOFT_LINK_CLASS(QTKit, QTMovieView)
{
ASSERT(!_backgroundFullscreenWindow);
ASSERT(!_fadeAnimation);
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
}
......@@ -109,7 +114,15 @@ SOFT_LINK_CLASS(QTKit, QTMovieView)
_mediaElement = mediaElement;
if ([self isWindowLoaded]) {
QTMovieView *movieView = [[self fullscreenWindow] movieView];
[movieView setMovie:_mediaElement->platformMedia().qtMovie];
QTMovie *movie = _mediaElement->platformMedia().qtMovie;
ASSERT(movieView);
ASSERT(movie);
[movieView setMovie:movie];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(rateChanged:)
name:QTMovieRateDidChangeNotification
object:movie];
}
}
......@@ -286,6 +299,16 @@ static NSWindow *createBackgroundFullscreenWindow(NSRect frame, int level)
{
[_hudController fadeWindowIn];
}
#pragma mark -
#pragma mark QTMovie callbacks
- (void)rateChanged:(NSNotification *)unusedNotification
{
UNUSED_PARAM(unusedNotification);
[_hudController updateRate];
}
@end
@implementation WebVideoFullscreenWindow
......@@ -442,6 +465,7 @@ static NSWindow *createBackgroundFullscreenWindow(NSRect frame, int level)
[super resignKeyWindow];
[[self windowController] requestExitFullscreenWithAnimation:NO];
}
@end
#endif /* ENABLE(VIDEO) */
......@@ -50,6 +50,7 @@
- (void)fadeWindowIn;
- (void)fadeWindowOut;
- (void)closeWindow;
- (void)updateRate;
@end
......
......@@ -181,6 +181,7 @@ static const NSTimeInterval HUDWindowFadeOutDelay = 3;
// First, update right away, then schedule future update
[self updateTime];
[self updateRate];
[_timelineUpdateTimer invalidate];
[_timelineUpdateTimer release];
......@@ -466,12 +467,18 @@ static NSTextField *createTimeTextField(NSRect frame)
[_delegate mediaElement]->setVolume(volume / [self maxVolume], e);
}
- (void)updateRate
{
[_playButton setIntValue:[self playing]];
}
- (void)playingChanged:(id)sender
{
[self setPlaying:![self playing]];
BOOL nowPlaying = [self playing];
[self setPlaying:!nowPlaying];
// Keep HUD visible when paused
if (![self playing])
if (!nowPlaying)
[self fadeWindowIn];
else if (!_mouseIsInHUD) {
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(fadeWindowOut) object:nil];
......
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