Bug 144871

Summary: Do not exit fullscreen when starting optimized fullscreen since this is done automatically.
Product: WebKit Reporter: Jeremy Jones <jeremyj-wk>
Component: MediaAssignee: Jeremy Jones <jeremyj-wk>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, eric.carlson, jonlee, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: iPhone / iPad   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Jeremy Jones 2015-05-11 08:04:26 PDT
Do not exit fullscreen when starting optimized fullscreen since this is done automatically.
Comment 1 Jeremy Jones 2015-05-11 08:05:49 PDT
Created attachment 252860 [details]
Patch
Comment 2 Jeremy Jones 2015-05-11 08:06:36 PDT
rdar://problem/20719473
Comment 3 Jeremy Jones 2015-05-11 08:07:05 PDT
rdar://problem/20719473
Comment 4 Jeremy Jones 2015-06-18 22:19:45 PDT
Created attachment 255173 [details]
Patch
Comment 5 Darin Adler 2015-06-19 11:29:02 PDT
Comment on attachment 255173 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=255173&action=review

Is there a way to make a regression test for this?

> Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h:108
> +    typedef enum {
> +        ExitFullScreenReasonDoneButtonTapped,
> +        ExitFullScreenReasonFullScreenButtonTapped,
> +        ExitFullScreenReasonPinchGestureHandled,
> +        ExitFullScreenReasonRemoteControlStopEventReceived,
> +        ExitFullScreenReasonPictureInPictureStarted
> +    } ExitFullscreenReason;

That’s C style. C++ style would be:

    enum ExitFullScreenReason {
        ExitFullScreenReasonDoneButtonTapped
        ...
    };

And modern C++ style would be:

    enum class ExitFullScreenReason {
        DoneButtonTapped
        ...
    };

Please use one of those styles.

> Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm:245
> +    WebVideoFullscreenInterfaceAVKit::ExitFullscreenReason exitReason;
> +    switch (reason) {
> +    case AVPlayerViewControllerExitFullScreenReasonDoneButtonTapped:
> +        exitReason = WebVideoFullscreenInterfaceAVKit::ExitFullScreenReasonDoneButtonTapped;
> +        break;
> +    case AVPlayerViewControllerExitFullScreenReasonFullScreenButtonTapped:
> +        exitReason = WebVideoFullscreenInterfaceAVKit::ExitFullScreenReasonFullScreenButtonTapped;
> +        break;
> +    case AVPlayerViewControllerExitFullScreenReasonPictureInPictureStarted:
> +        exitReason = WebVideoFullscreenInterfaceAVKit::ExitFullScreenReasonPictureInPictureStarted;
> +        break;
> +    case AVPlayerViewControllerExitFullScreenReasonPinchGestureHandled:
> +        exitReason = WebVideoFullscreenInterfaceAVKit::ExitFullScreenReasonPinchGestureHandled;
> +        break;
> +    case AVPlayerViewControllerExitFullScreenReasonRemoteControlStopEventReceived:
> +        exitReason = WebVideoFullscreenInterfaceAVKit::ExitFullScreenReasonRemoteControlStopEventReceived;
> +        break;
> +    }

Seems like we should factor this out into a helper function that makes the AVPlayerViewController codes to the WebVideoFullscreenInterfaceAVKit ones and does nothing else.

Build failed on iOS; I think the codes might be different iOS vs. Mac or iOS 8 vs. iOS 9.
Comment 6 Jeremy Jones 2015-06-19 14:44:37 PDT
Created attachment 255227 [details]
Patch
Comment 7 Jeremy Jones 2015-06-19 14:46:28 PDT
(In reply to comment #5)
> Comment on attachment 255173 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=255173&action=review
> 
> Is there a way to make a regression test for this?
> 
> > Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h:108
> > +    typedef enum {
> > +        ExitFullScreenReasonDoneButtonTapped,
> > +        ExitFullScreenReasonFullScreenButtonTapped,
> > +        ExitFullScreenReasonPinchGestureHandled,
> > +        ExitFullScreenReasonRemoteControlStopEventReceived,
> > +        ExitFullScreenReasonPictureInPictureStarted
> > +    } ExitFullscreenReason;
> 
> That’s C style. C++ style would be:
> 
>     enum ExitFullScreenReason {
>         ExitFullScreenReasonDoneButtonTapped
>         ...
>     };
> 
> And modern C++ style would be:
> 
>     enum class ExitFullScreenReason {
>         DoneButtonTapped
>         ...
>     };
> 
> Please use one of those styles.

Updated to Modern C++ style.

> 
> > Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm:245
> > +    WebVideoFullscreenInterfaceAVKit::ExitFullscreenReason exitReason;
> > +    switch (reason) {
> > +    case AVPlayerViewControllerExitFullScreenReasonDoneButtonTapped:
> > +        exitReason = WebVideoFullscreenInterfaceAVKit::ExitFullScreenReasonDoneButtonTapped;
> > +        break;
> > +    case AVPlayerViewControllerExitFullScreenReasonFullScreenButtonTapped:
> > +        exitReason = WebVideoFullscreenInterfaceAVKit::ExitFullScreenReasonFullScreenButtonTapped;
> > +        break;
> > +    case AVPlayerViewControllerExitFullScreenReasonPictureInPictureStarted:
> > +        exitReason = WebVideoFullscreenInterfaceAVKit::ExitFullScreenReasonPictureInPictureStarted;
> > +        break;
> > +    case AVPlayerViewControllerExitFullScreenReasonPinchGestureHandled:
> > +        exitReason = WebVideoFullscreenInterfaceAVKit::ExitFullScreenReasonPinchGestureHandled;
> > +        break;
> > +    case AVPlayerViewControllerExitFullScreenReasonRemoteControlStopEventReceived:
> > +        exitReason = WebVideoFullscreenInterfaceAVKit::ExitFullScreenReasonRemoteControlStopEventReceived;
> > +        break;
> > +    }
> 
> Seems like we should factor this out into a helper function that makes the
> AVPlayerViewController codes to the WebVideoFullscreenInterfaceAVKit ones
> and does nothing else.

Done.

> 
> Build failed on iOS; I think the codes might be different iOS vs. Mac or iOS
> 8 vs. iOS 9.

Added Missing enums in AVKitSPI.h.
Comment 8 Jeremy Jones 2015-06-19 14:51:16 PDT
Radar updated to:
rdar://problem/21467999
Comment 9 Darin Adler 2015-06-19 15:59:51 PDT
Comment on attachment 255227 [details]
Patch

While I am not an expert on this code, it looks good. r=me
Comment 10 WebKit Commit Bot 2015-06-22 10:42:46 PDT
Comment on attachment 255227 [details]
Patch

Clearing flags on attachment: 255227

Committed r185834: <http://trac.webkit.org/changeset/185834>
Comment 11 WebKit Commit Bot 2015-06-22 10:42:49 PDT
All reviewed patches have been landed.  Closing bug.