MPMoviePlayerViewController customization

前端 未结 3 1883
长发绾君心
长发绾君心 2021-02-04 19:12

I\'m using MPMoviePlayerViewController - with the player controls set to: MPMovieControlStyleFullscreen

I\'m having a problem with some of buttons that are in MPMovieCon

3条回答
  •  醉话见心
    2021-02-04 19:42

    There isn't a way to customize the MPMovieControlStyle values provided by Apple. What you need to do is is turn off the Apple controls (MPMovieControlStyleNone) and then create your own custom controls. Apple is fine with you putting your own UIViews in to the hierarchy here, so you can get started with something like this:

    MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL: YOUR_URL];
    moviePlayer.controlStyle = MPMovieControlStyleNone;
    UIView *movieView = moviePlayer.view;
    [movieView addSubview: _movieControlsView];
    [movieView bringSubviewToFront: _movieControlsView];
    

    Where _movieControlsView was set up earlier in code or in IB.

    Aesthetically, you can do what you want, but I would recommend sticking with something that looks like Apple's choices so as not to confuse the user. For the project I just finished, I created a transparent button the exact size of the movie player. Clicking the button fades in a control bar on the bottom with my custom controls. If one of the controls isn't clicked, the control bar fades back out again after a few seconds.

提交回复
热议问题