MPMoviePlayerController上未显示音量控制

时间:2014-05-20 11:53:54

标签: ios mpmovieplayercontroller volume

音量控制未显示滑块。 我在Stackoverflow上搜索了很多关于此问题的答案,但没有代码运行良好。

我看到大多数答案都有一个滑块控制音量并添加到子视图中我也尝试了这个但没有滑块。

     - (void)play
    {

    NSURL *url=[[NSURL alloc] initWithString:self.url];
     player=[[MPMoviePlayerController alloc] initWithContentURL:url];
    [player prepareToPlay];

    player.allowsAirPlay = YES;
    player.scalingMode = MPMovieScalingModeAspectFit;

    player.view.frame = self.view.frame;



    player.controlStyle = MPMovieControlStyleFullscreen;
    player.useApplicationAudioSession = YES;

    [[NSNotificationCenter defaultCenter]
     addObserver:self
     selector:@selector(movieFinishedCallback:)
     name:MPMoviePlayerPlaybackDidFinishNotification
     object:player];

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(exitedFullscreen:) name:MPMoviePlayerDidExitFullscreenNotification object:player];


    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(moviePlayerWillExitFullscreen:)
                                                 name:MPMoviePlayerWillExitFullscreenNotification
                                               object:player];




      [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];


    if ([UIScreen mainScreen].bounds.size.height == 568)
    {  


         [[player view] setBounds:CGRectMake(0, 0, 568, 320)];




    }
    else
    {

         [[player view] setBounds:CGRectMake(0, 0, 480, 320)];
    }





   // [[player view] setBounds:CGRectMake(0, 0, 480, 320)];
   // [[player view] setCenter:CGPointMake(160, 240)];
    [[player view] setTransform:CGAffineTransformMakeRotation(M_PI / 2)];
    [[MPMusicPlayerController applicationMusicPlayer] setVolume:0];


     [self.view addSubview: player.view];

  // [ self.view addSubview: systemVolumeSlider];

    [player play];


    }

0 个答案:

没有答案