我有一个 10 秒长的视频剪辑,我想从 3 秒播放到 6 秒。CCPlayer可以做到吗?甚至是 MPMoviewPlayer?
这是我的代码:
MPMoviePlayerController *_theMovie;
[_theMovie setCurrentPlaybackTime:1.0];
[_theMovie setEndPlaybackTime:2.0];
[_theMovie play];
但视频播放时间为 0 到 2 秒 :(
谢谢
我有一个 10 秒长的视频剪辑,我想从 3 秒播放到 6 秒。CCPlayer可以做到吗?甚至是 MPMoviewPlayer?
这是我的代码:
MPMoviePlayerController *_theMovie;
[_theMovie setCurrentPlaybackTime:1.0];
[_theMovie setEndPlaybackTime:2.0];
[_theMovie play];
但视频播放时间为 0 到 2 秒 :(
谢谢
这是文档中的两个二传手。
// 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];
:)
更改 MPMoviewPlayer 中的 currentPlaybackRate 时间,
moviplayer.currentPlaybackRate =moviePlayer.duration/3 or 6;