You can change the default controls of MPMoviePlayerController
. One thing you can do is you can hide the default controls of MPMoviePlayerViewController
and add your own customize volume slider.
moviePlayer.controlStyle=MPMovieControlStyleNone;
You can add the volume button like this:
UIButton *soundBtn=[ UIButton buttonWithType:UIButtonTypeCustom];
soundBtn.frame=CGRectMake(400,10,35,35);
soundBtn.showsTouchWhenHighlighted=YES;
[soundBtn setBackgroundImage:[UIImage imageNamed:@"valume.png"] forState:UIControlStateNormal];
[soundBtn addTarget:self action:@selector(valumeAction) forControlEvents:UIControlEventTouchUpInside];
[controllsView addSubview:soundBtn];
For Volume you can use the MPVolumeView Class
-(void)volumeController{
volumeView = [[UIView alloc]initWithFrame:CGRectMake(40,410,100,20)];
volumeView.backgroundColor = [UIColor clearColor];
[self.view addSubview:volumeView];
//MP Valume Slider for controlling thew volume
volumeslider = [[[MPVolumeView alloc] initWithFrame:volumeView.bounds] autorelease];
NSArray *tempArray = volumeslider.subviews;
for (id current in tempArray){
if ([current isKindOfClass:[UISlider class]]){
UISlider *tempSlider = (UISlider *) current;
UIImage *stetchLeftTrack = [[UIImage imageNamed:@"bar_2.png"]
stretchableImageWithLeftCapWidth:5.0 topCapHeight:0.0];
UIImage *stetchRightTrack = [[UIImage imageNamed:@"bar.png"]
stretchableImageWithLeftCapWidth:5.0 topCapHeight:0.0];
[tempSlider setMinimumTrackImage:stetchLeftTrack forState:UIControlStateNormal];
[tempSlider setMaximumTrackImage:stetchRightTrack forState:UIControlStateNormal];
}
}
[volumeView addSubview:volumeslider];
//[controllsView addSubview:volumeView];
[volumeView sizeToFit];
volumeView.hidden = YES;
isValumeBarHidden = YES;
//Volume Slider created and added to the volumeview
}