5

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

4

3 回答 3

4

使用隐藏现有控件MPMovieControlStyle,将其设置为MPMovieControlStyleNone

现在addcustom controlMPMoviePlayer's观点。

将示例uislider-to-control-avaudioplayerMPMoviePlayer与has相同currentPlaybackTime

请参阅mpmovieplayercontroller-buffering-state链接。

请参阅mpmovieplayercontroller-when-will-i-know-that-the-downloading-of-the-file-reach链接。

于 2012-12-27T08:20:17.820 回答
1

为此,您必须制作自己的自定义滑块。例如,您可以隐藏 MPMoviePlayerController 进度条并制作自己的自定义进度条您可以通过此代码隐藏 MPMoviePlayerController 进度条

moviePlayerController.controlStyle  = MPMovieControlStyleNone;

然后您可以创建自定义进度条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.

这将是滑块,您可以在线程中更新滑块的位置。

于 2012-12-27T08:22:48.640 回答
1

这是进度滑块的代码,例如 MPMoviePlayerController

“使用 NSTimer 平滑移动滑块作为 MPMoviePlayerController 进度条”

// 您可以根据需要更改 scheduleTimerWithTimeInterval

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

“将 currentPlaybackTime 设置为 Slider 值”

- (void)updateSlider {
      slider1.value = self.moviePlayerController.currentPlaybackTime;
    }
于 2016-02-26T06:29:52.510 回答