我想发挥的MPMoviePlayerController /转发视频以不同的速度。 任何一个可以建议我我如何做到这一点。
现在我做的快进(在单速),但在几秒钟后,回来就正常速度。
请建议。
我想发挥的MPMoviePlayerController /转发视频以不同的速度。 任何一个可以建议我我如何做到这一点。
现在我做的快进(在单速),但在几秒钟后,回来就正常速度。
请建议。
MPMoviePlayerController Conforms to MPMediaPlayback protocol
you can see the property currentPlaybackRate as :-
@property(nonatomic) float currentPlaybackRate
A value of 0 represents that the video is stopped , a value of 1 indicates normal speed and further positive values indicate increased speed while negative ones indicate reverse .
同时检查MPMediaPlayback您endseeking委托方法,因为它是恢复播放正常的唯一方法
下面是转发代码和向后的电影为2倍3倍4倍速度MPMoviePlayerViewController
在.h文件
@property(nonatomic) float currentPlaybackRate;
在.m文件
- (void)viewDidLoad
{
currentPlaybackRate=1.0; //video Play in Normal speed
}
现在,在快进和快退按钮操作
[fastForward addTarget:self action:@selector(fastForward) forControlEvents:UIControlEventTouchUpInside];
[fastBackWard addTarget:self action:@selector(fastBackward) forControlEvents:UIControlEventTouchUpInside];
操作代码
-(void)fastForward
{
[mp.moviePlayer pause];
playPauseButton.selected=TRUE;
if (currentPlaybackRate < 0.0) {
currentPlaybackRate = 1.0;
}
if (currentPlaybackRate < 4.0) {
currentPlaybackRate=currentPlaybackRate+1.0;
NSLog(@"Forward::%f",currentPlaybackRate);
mp.moviePlayer.currentPlaybackRate=currentPlaybackRate;
}
}
-(void)fastBackward
{
[mp.moviePlayer pause];
playPauseButton.selected=TRUE;
if (currentPlaybackRate > 0.0) {
currentPlaybackRate = 0.0;
}
if (currentPlaybackRate > -4.0) {
currentPlaybackRate=currentPlaybackRate-1.0;
NSLog(@"BackWard::%f",currentPlaybackRate);
mp.moviePlayer.currentPlaybackRate=currentPlaybackRate;
}
}