5

Is there a way to customise the look or at least position of the movie progress slider on MPMovidePlayer?

Borut Tomazin
  • 8,041
  • 11
  • 78
  • 91

3 Answers3

4

Hide existing controls using MPMovieControlStyle, set this to MPMovieControlStyleNone.

Now add your custom control on MPMoviePlayer's view.

Refer example uislider-to-control-avaudioplayer as its same as MPMoviePlayer has currentPlaybackTime

Refer mpmovieplayercontroller-buffering-state link.

Refer mpmovieplayercontroller-when-will-i-know-that-the-downloading-of-the-file-reach link.

Community
  • 1
  • 1
Paresh Navadiya
  • 38,095
  • 11
  • 81
  • 132
1

For this you have to make your own custom slider. for example you can hide the MPMoviePlayerController progress bar and make your own custom progress bar you can hide MPMoviePlayerController progress bar by this code

moviePlayerController.controlStyle  = MPMovieControlStyleNone;

Then you can create custom progress bar UISlider *progressbar;

[progressbar setMinimumTrackImage:[UIImage imageNamed:@"min.png"] forState:UIControlStateNormal];//you can set the background for which you have progressed the video
[progressbar setMaximumTrackImage:[UIImage imageNamed:@"max.png"] forState:UIControlStateNormal];//you can set the background for which you have left the video
[progressbar setThumbImage:[UIImage imageNamed:@"thumb.png"] forState:UIControlStateNormal];//you can set the thumb image for you progress bar.

This will be slider you can update the postion of slider in a thread.

Ahsan
  • 827
  • 6
  • 10
  • Are there any notifications about current track position or do I have to do it myself? What about buffering track, can I get info about buffering? – Borut Tomazin Dec 27 '12 at 08:25
  • you can update the time of slider by getting the current time in thread by this control moviePlayerController.currentPlaybackTime. – Ahsan Dec 27 '12 at 08:28
  • You have to do it yourself. may be there is other way around but I'm telling you what i have used. – Ahsan Dec 27 '12 at 08:29
1

here is a code for progress a slider like as MPMoviePlayerController

"Use NSTimer to smoothly move slider as MPMoviePlayerController Progress Bar"

// you can change scheduledTimerWithTimeInterval as per your need

[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateSlider) userInfo:nil repeats:YES];

"Set currentPlaybackTime to Slider value"

- (void)updateSlider {
      slider1.value = self.moviePlayerController.currentPlaybackTime;
    }