首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >播放整个视频中的3秒片段

播放整个视频中的3秒片段
EN

Stack Overflow用户
提问于 2012-09-11 20:38:46
回答 2查看 265关注 0票数 0

我有一个10秒长的视频剪辑,我想从3秒播放到6秒。使用CCPlayer可以做到这一点吗?或者甚至是MPMoviewPlayer?

这是我的代码:

代码语言:javascript
复制
MPMoviePlayerController *_theMovie;  
[_theMovie setCurrentPlaybackTime:1.0];  
[_theMovie setEndPlaybackTime:2.0];  
[_theMovie play];  

但视频播放时间为0到2秒:(

谢谢

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-09-11 20:50:08

这是docs中的两个setter。

代码语言:javascript
复制
// 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
EN

Stack Overflow用户

发布于 2012-09-11 20:52:22

在MPMoviewPlayer中更改currentPlaybackRate时间,

代码语言:javascript
复制
moviplayer.currentPlaybackRate =moviePlayer.duration/3 or  6;
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12369917

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档