English 中文(简体)
iPad MPMoviePlayerController - Disable Full Screen
原标题:iPad MPMoviePlayerController - Disable Fullscreen

是否有办法去除MoviePlayerController议员的完全screen子?

最佳回答

无。 希望得到下一次更新。

问题回答

只是这样:

- (void)viewDidLoad {
    [super viewDidLoad];

    [[NSNotificationCenter defaultCenter] addObserver:self 
                                             selector:@selector(movieEventFullscreenHandler:) 
                                                 name:MPMoviePlayerWillEnterFullscreenNotification 
                                               object:nil];

    [[NSNotificationCenter defaultCenter] addObserver:self 
                                             selector:@selector(movieEventFullscreenHandler:) 
                                                 name:MPMoviePlayerDidEnterFullscreenNotification 
                                               object:nil];

    self.moviePlayer.controlStyle = MPMovieControlStyleEmbedded;
}

- (void)movieEventFullscreenHandler:(NSNotification*)notification {
    [self.moviePlayer setFullscreen:NO animated:NO];
    [self.moviePlayer setControlStyle:MPMovieControlStyleEmbedded];
}

根据你们的需要,你也可以简单地使所有用户对参与者的看法失去互动。

player.view.userInteractionEnabled = NO;

你们可以把控制包放到完全的屏幕上。 这些控制有点不同,但并没有完全明了。

[_moviePlayerController setControlStyle:MPMovieControlStyleFullscreen];

你可以躲藏 play击控制,加上你自己的习俗,这将防止出现违约的纽扣。

页: 1

[player setMovieControlMode:MPMovieControlModeNone];

不幸的是,我没有为我做过适当的工作,因此,我照此办理了以下工作(并做了罚款):

  1. Hide the full screen button.

在你创办电影演员的方法中添加这一法律。


    ....

        //Because we have to wait until controllers are shown

        [self performSelector:@selector(hideFullscreenButton) withObject:self afterDelay:0.5];

    ...

增加方法:


    -(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;

            }

        }

    }

问题在于,找不到什么人必须隐藏。 在我的案件中,我以观点坐标表示。

  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];

加上选择方法:


    -(void) doSingleTap{
        //DO NOTHING!!!
    }

    -(void) doDoubleTap{
        //DO NOTHING!!!
    }

che:

MPMoviePlayerController *mpc = (...some instance...)
UIView *fsbutton = [[mpc view] viewWithTag:512];
[fsbutton setHidden:YES];

主要渔获量是viewDidAppear:或类似,因为电影制片人的观点在<>didMoveToWindow或didMove Toperview内有些地方出现,这些地方是在< view WillAppear:之后发生的。 因此,你听到了完全screen子的短暂闪光。 其他明显的渔获物包括:碎块。 Apple果改变了512个标值(尽管它用3.2-4.2);当然, Apple果会不会这样做。

认可的解决办法是将控制风格定在MovieControlStyleNone上,并推出你自己的运输控制,这更加可行。

为了向全方位屏幕转换,无论形式是顿式还是pin式,你都可以使用:

moviePlayer.controlStyle = MPMovieControlStyleNone;
moviePlayer.view.userInteractionEnabled =NO; 

这样做。 对于从完全屏幕上开始的录像,他们有标准的MPMoviePlayerController控制,但是没有完整的屏幕。 他们还使用标准内建构,因为他们突然用4.2%飞到AirPlay县。

此处去除胎圈的简单块

希望

它与我合作6

 for (UIView *view in  moviePlayer.view.subviews) {

    for(UIPinchGestureRecognizer *pinch in view.gestureRecognizers){
    if([pinch isKindOfClass:[UIPinchGestureRecognizer class]])
        [view removeGestureRecognizer:pinch];
    }
}

这一工作涉及Si-7,5。

Add Notification:

MPMoviePlayerDidEnterFullscreenNotification : @"moviePlayFullscreenNote:"

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

通知说,我只听到“DID”而不是“WILL”通知,并且听起来。 我认为,这项工作使系统有时间作出反应。 当我使用上文答复中所指出的“地雷”和“DID”时,它导致一个没有控制的黑色屏幕。 当过渡发生时,有一点眼光是显而易见的,但我需要穿着的游戏/陈词。

完全screen子和pa子可以拆除。

[self.videoPlayer setControlStyle:MPMovieControlStyleNone];

如果你想要做的只是,那么你想要做的事情是完全筛选的(即保持能够进行的互动和你想要的控制风格),你可以这样做:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

    NSSet *set = [event allTouches];
    NSArray *arr = [set allObjects];
    for (int i = 0; i < arr.count; i++) {
        UITouch *touch = (UITouch *) [arr objectAtIndex:i];

        NSArray *recognisers = touch.gestureRecognizers;
        for (UIGestureRecognizer *recogniser in recognisers) {
            if (recogniser.enabled && [recogniser isMemberOfClass:[UIPinchGestureRecognizer class]]) {
                recogniser.enabled = NO;
            }
        }
    }
}

这是哈维尔·卡拉特拉维利亚的第一个解决办法的快速版本:

func hideFullScreenButton() {
    self.hideFullScreenSubview((self.moviePlayerController?.view.subviews)!)
}

func hideFullScreenSubview(subviews: [UIView]) {
    for view: UIView in subviews {
        if view.subviews.count > 0 {
            self.hideFullScreenSubview(view.subviews)
        }
        if view.frame.origin.x == 631 {
            view.hidden = true
        }
    }
}

而当用户在“游戏”上作主时:

self.performSelector(#selector(VideoViewController.hideFullScreenButton), withObject: self, afterDelay: 0.5)

(VideoViewController是我拥有MoviePlayerController议员的观点控制器)

我知道,这只是一条小小小的过时,但却是毫无进展。 我在这方面做了一些研究,并想找到答案。 我不知道它为什么要工作,但现在却不知道。

-(void) playMovieAtURL: (NSURL*) theURL {

    MPMoviePlayerController* theMovie =
    [[MPMoviePlayerController alloc] initWithContentURL: theURL];
    //That line is for ARC. Without it, it may not work.
    self.moviePlayer = theMovie;
    theMovie.scalingMode = MPMovieScalingModeAspectFill;
    theMovie.controlStyle = MPMovieControlStyleFullscreen;
    theMovie.repeatMode  = MPMovieRepeatModeOne;
    //Here you d better use your custom ViewController subclass, if you want autorotating and all that stuff.
    UIViewController * vc = [UIViewController new];
    [vc.view addSubview:theMovie.view];
    theMovie.fullscreen  = YES;
    theMovie.view.frame = vc.view.bounds;
    vc.view = theMovie.view;
    [self presentModalViewController:vc animated:YES];
    theMovie.fullscreen  = YES;

    [theMovie prepareToPlay];
    [theMovie play];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
}

页: 1 当电影放映时,便释放控制者。

-(void) myMovieFinishedCallback: (NSNotification*) aNotification
{
    [self dismissModalViewControllerAnimated:YES];
    MPMoviePlayerController* theMovie = [aNotification object];
    [[NSNotificationCenter defaultCenter]
 removeObserver: self
 name: MPMoviePlayerPlaybackDidFinishNotification
 object: theMovie];
    [self.moviePlayer.view removeFromSuperview];
    self.moviePlayer = nil;
    // Release the movie instance created in playMovieAtURL:
}

Put a UIView or UIButton, 具有显示视频内容的透明背景,从而使用户得以利用含有视频内容的观点。





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签