MPMoviePlayerViewController not showing volume sli

2019-08-17 06:21发布

问题:

I am playing the video from the url:

   MPMoviePlayerViewController *m = [[MPMoviePlayerViewController alloc] initWithContentURL:url];

    if([m.moviePlayer respondsToSelector:@selector(setAllowsAirPlay:)])
        m.moviePlayer.allowsAirPlay = YES;
    [self presentMoviePlayerViewControllerAnimated:m];

It is playing, but there is no volume control slider. Is it possible to add volume control?

回答1:

You can use MPVolumeView object.

volume = [[MPVolumeView alloc] initWithFrame: rect];
[self addSubview:volume];