iOS————使用NSdate获取播放时间
来源:互联网 发布:淘宝怎么激活支付宝 编辑:程序博客网 时间:2024/04/29 22:34
- (id)addPeriodicTimeObserverForInterval:(CMTime)interval queue:(dispatch_queue_t)queue usingBlock:(void (^)(CMTime time))block;
这个函数来控制获取时间的刷新率
例如:
[_LGCustomMoviePlayerController.playeraddPeriodicTimeObserverForInterval:CMTimeMake(1,1) queue:NULLusingBlock:^(CMTime time){
//获取当前时间
CMTime currentTime =_LGCustomMoviePlayerController.player.currentItem.currentTime;
//转成秒数
double currentPlayTime = currentTime.value/currentTime.timescale;
//进度条的value
_movieProgressSlider.value = currentPlayTime/totalMovieDuration;
//把时间转化成 NSDate 格式
NSDate *d = [NSDatedateWithTimeIntervalSince1970:currentPlayTime];
// d 的打印形式为:1970——1——1 xx:xx:xx 我们需要的是 xx:xx:xx,然后进行显示
NSString *currentTimeStr = [NSStringstringWithFormat:@"%@",d];
NSRange range;
range.location =11;
range.length =8;
NSString *showtime = [currentTimeStr substringWithRange:range];
self.currentTimeLabel.text = showtime;
}];
- iOS————使用NSdate获取播放时间
- IOS开发——获得当前时间(NSDate )
- OC 时间NSDate (NSDate<——> NSString)
- OC 时间NSDate (NSDate<——> NSString)
- iOS NSDate的基本使用,获取时间戳
- ios 获取时间--NSCalendar NSDateComponents NSDate
- iOS开发 NSDate 获取系统当前时间
- iOS 开发获取当前时间 NSDate
- IOS——NSDate昨天、今天、明天
- iOS学习之——NSDate
- iOS获取当前时间 NSDate(NSCalendar)获取当前时间
- NSDate 使用 ios时间的秒数
- iOS NSDate等时间类的使用
- foundation的使用——NSDate
- iOS开发中获取上月的起止时间(NSCalendar、NSDateComponents和NSDate的使用)
- iOS之NSDate,NSDateFormatter--获取时间与格式化时间
- OC基础学习——NSDate时间类
- NSdate获取时间问题
- php之单例模式
- Java并发编程 基础概念
- Junit4新断言 assertThat
- 后台“待回复询盘”提醒功能实现
- 推荐命门&运营商的数据质量高
- iOS————使用NSdate获取播放时间
- android adb 命令发送 keyevent
- sed 文件查找,替换
- 一个触发器内三种INSERT,UPDATE,DELETE状态
- 为什么写技术博客对新人如此重要?
- hMailServer多语言设定及官方翻译下载
- Junit 各个方法
- VB.NET String数据类型操作技巧
- JUnit中使用Hamcrest测试框架的assertThat断言【4.4新特性】