iPad MPMoviePlayerController - Disable Fullscreen

后端 未结 16 2077
一向
一向 2020-12-06 01:38

Is there a way to disable the fullscreen button of the MPMoviePlayerController ?

相关标签:
16条回答
  • 2020-12-06 02:12

    Wired does this. For the videos that start in fullscreen, they have the standard MPMoviePlayerController controls, but are missing the fullscreen buttons. And they're using the standard built-in ones, since they suddenly got an AirPlay button with 4.2.

    0 讨论(0)
  • This worked on iOS 7, iPhone 5s.

    Add Notification:
    
    MPMoviePlayerDidEnterFullscreenNotification : @"moviePlayFullscreenNote:"
    
    - (void)moviePlayFullscreenNote:(NSNotification*)notification
    {
        if (notification.object == self.videoPlayer)
        {
            [self.videoPlayer setFullscreen:NO animated:YES];
            self.videoPlayer.controlStyle = MPMovieControlStyleEmbedded;
        }
    }
    

    Notice that I only listen for "DID" and not the "WILL" notification as well as running it animated. I think this works as it gives the system time to react. When I used the "WILL" and "DID" as noted in answers above it led to a black screen with no controls. There is a slight glitch that is visible when the transition occurs, but I need the play/scrub buttons from embedded.

    0 讨论(0)
  • 2020-12-06 02:13

    Unfortunately none of above worked for me properly, so picking the above I implemented the following (and worked fine):

    1. Hide the full screen button.

    Add this code in the method where you initialise the movie player.

    
        ....
    
            //Because we have to wait until controllers are shown
    
            [self performSelector:@selector(hideFullscreenButton) withObject:self afterDelay:0.5];
    
        ...
    
    

    Add the methods:

    
        -(void) hideFullscreenButton{
    
            //Hide full screen mode button
    
            [self hideFullscreenSubview:movieClip.view.subviews];
    
        }
    
    
    
        -(void) hideFullscreenSubview:(NSArray*)arr{
    
            for(UIView *v in arr){
    
                if([v.subviews count]>0)
    
                    [self hideFullscreenSubview:v.subviews];
    
                else
    
                    NSLog(@"%@",v);
    
                if(v.frame.origin.x==975 ){
    
                    v.hidden=TRUE;
    
                }
    
            }
    
        }
    
    

    The problem relies that there is no tag to identify which view you have to hide. In my case I figure it out by the view coordinates.

    1. Overwrite tap gestures for do not allowing fullscreen zoom.
    
     movieClip.controlStyle = MPMovieControlStyleEmbedded;    
    
        //Disable tap for not allowing that video control set on a full screen mode.
        UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget: self action:@selector(doSingleTap)];
        singleTap.numberOfTapsRequired = 1;
        [movieClip.view addGestureRecognizer:singleTap];
    
    
    
        UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget: self action:@selector(doDoubleTap)];
        doubleTap.numberOfTapsRequired = 2;
        [movieClip.view addGestureRecognizer:doubleTap];
        [singleTap requireGestureRecognizerToFail:doubleTap];
    
    

    And add the selector methods:

    
        -(void) doSingleTap{
            //DO NOTHING!!!
        }
    
        -(void) doDoubleTap{
            //DO NOTHING!!!
        }
    
    
    0 讨论(0)
  • 2020-12-06 02:15

    No, there is no way. Hopefully with the next update.

    0 讨论(0)
提交回复
热议问题