有没有办法在MPMovidePlayer上自定义影片进度滑块的外观或至少位置?
答案 0 :(得分:4)
使用MPMovieControlStyle
隐藏现有控件,将其设置为MPMovieControlStyleNone
。
现在add
custom control
MPMoviePlayer's
视图。
请参阅示例uislider-to-control-avaudioplayer,与MPMoviePlayer
currentPlaybackTime
参考mpmovieplayercontroller-buffering-state链接。
参考mpmovieplayercontroller-when-will-i-know-that-the-downloading-of-the-file-reach链接。
答案 1 :(得分: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.
这将是滑块,您可以更新线程中滑块的位置。
答案 2 :(得分:1)
这是一个像MPMoviePlayerController一样的滑块进度代码
"使用NSTimer将滑块平滑移动为MPMoviePlayerController进度条"
//您可以根据需要更改scheduledTimerWithTimeInterval
[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateSlider) userInfo:nil repeats:YES];
"将currentPlaybackTime设置为Slider值"
- (void)updateSlider {
slider1.value = self.moviePlayerController.currentPlaybackTime;
}