我有一个10秒长的视频片段,我想播放它从3秒到6秒。这对CCPlayer有可能吗?甚至是MPMoviewPlayer?
这是我的代码:
MPMoviePlayerController *_theMovie;
[_theMovie setCurrentPlaybackTime:1.0];
[_theMovie setEndPlaybackTime:2.0];
[_theMovie play];
但视频播放时间为0到2秒:(
由于
答案 0 :(得分:1)
以下是docs中的两个setter。
// The start time of movie playback. Defaults to NaN, indicating the natural start time of the movie.
@property(nonatomic) NSTimeInterval initialPlaybackTime;
// The end time of movie playback. Defaults to NaN, which indicates natural end time of the movie.
@property(nonatomic) NSTimeInterval endPlaybackTime;
MPMoviePlayerController *_theMovie;
[theMovie setInitialPlaybackTime:3.0]; //instead of [_theMovie setCurrentPlaybackTime:1.0];
[theMovie setEndPlaybackTime:6.0];
[_theMovie prepareToPlay];
[_theMovie play];
:)
答案 1 :(得分:0)
更改MPMoviewPlayer中的currentPlaybackRate时间,
moviplayer.currentPlaybackRate =moviePlayer.duration/3 or 6;