How to hide control before MPMoviePlayerController movie is played?

前端 未结 3 903
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-24 03:10

Assume iOS 3.2 or later. What is the proper sequence of command to play a move with the controls initially hidden. When the movie is playing, the user has the option to tag

相关标签:
3条回答
  • 2020-12-24 03:27
    player.moviePlayer.controlStyle = MPMovieControlStyleNone;
    

    Is the newest way to do it. :)

    0 讨论(0)
  • 2020-12-24 03:29

    Use a callback instead of a timer :

        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hidecontrol) 
                                                     name:MPMoviePlayerLoadStateDidChangeNotification 
                                                   object:playerView.moviePlayer];
    

    With call back function :

    - (void) hidecontrol {
    [[NSNotificationCenter defaultCenter] removeObserver:self     name:MPMoviePlayerNowPlayingMovieDidChangeNotification object:playerView.moviePlayer];
    [playerView.moviePlayer setControlStyle:MPMovieControlStyleFullscreen];
    
    }
    
    0 讨论(0)
  • 2020-12-24 03:30

    [Update] As proposed by @ReinYem, a much better solution is to rely on a MPMoviePlayerLoadStateDidChangeNotification instead of a timer.

    Actually, the following solution should not be considered anymore:

    Set controlStyle property to MPMovieControlStyleNone initially, and then set it to MPMovieControlStyleFullscreen one second later using a [performSelector:withObject:afterDelay:1]. It works well, controls do not appear until user taps on video.

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