Im currently trying to customize several things inside the MPMoviePlayerViewController but I'm having trouble with one of the sliders.
As you can see below, it features 2 sliders, a volume slider, and a small duration slider.
By using the following: UIImage *thumbImage = [UIImage imageNamed:@"MPThumbSelected.png"];
[[UISlider appearance] setThumbImage:thumbImage forState:UIControlStateNormal];
I am able to customize every slider, including the volume slider, but for some reason the smaller slider thumb in the navigation bar isn't updating. Does anyone have any suggestions? Any help would be greatly appreciated! Thank you!!
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
}