jvaeyhcd / hcdcacheplayer Goto Github PK
View Code? Open in Web Editor NEWA video player with cache.
License: MIT License
A video player with cache.
License: MIT License
----loadingRequest----:<AVAssetResourceLoadingRequest: 0x1595daea0, URL request = <NSMutableURLRequest: 0x1596110f0> { URL: streaming://static.ojutao.com/video/wangyuan_bts_256k.mp4 }, request ID = 5, content information request = (null), data request = <AVAssetResourceLoadingDataRequest: 0x159627e70, requested offset = 145031168, requested length = 52609, requests all data to end of resource = YES, current offset = 145031168>>
大概就是上面这样的提示 放到项目中 只有声音没有画面
视频链接是 @"http://static.ojutao.com/video/wangyuan_bts_256k.mp4"
--------- 我是分割线-------
我的项目中请求该视频会弹出视频工具栏,但是时间等信息加载不出来。放在您的demo中是只会出现声音,没有画面
播放的时候我暂停,然后退到后台再打开,视频又自己播放了。应该也是暂停的。。。还有就是这个播放器怎么控制它的高度,不管我怎么增大都不行呢
选取的视频路径可以上传到服务器,但是在你这里无法播放
i download the demo, and i see you writed demo which used swift . but i do it ,it is wrong
在缓存视频时,第一个视频可以缓存,第二和第三个视频在HcdVideoRequestTask中的self.taskArr始终会添加两次connection导致无法使视频从temp移到document,请问这个该怎么解决?
请问更换url播放时怎么搞,我再次调- (void)playWithUrl:(NSURL *)url showView:(UIView *)showView andSuperView:(UIView *)superView;界面就卡着不动了
先点击全屏播放,然后应用退到后台,再进入前台,界面显示异常
第一次运行时出现的错误信息:reason: 'attempting to add unsupported attribute: (null)'
将HcdLightView单例的代码中的约束注释后,拖动滑块出现的错误信息
reason: 'AVPlayerItem cannot service a seek request with a completion handler until its status is AVPlayerItemStatusReadyToPlay.'
详细信息:关于第一次报错问题,我定位到错误是在创建HcdLightView单例的代码中,我把下面代码#warning -----注释了就可以运行起来了,但是拖动播放进步滑块时,还是会奔溃,我用的是Xcode8,请问怎么解决呀
第二个错误注释了seekToTime:CMTimeMakeWithSeconds方法就不报错了
(void)seekToTime:(CGFloat)seconds {
if (self.state == HCDPlayerStateStopped) {
return;
}
seconds = MAX(0, seconds);
seconds = MIN(seconds, self.duration);
[self.player pause];
#warning -----
// [self.player seekToTime:CMTimeMakeWithSeconds(seconds, NSEC_PER_SEC) completionHandler:^(BOOL finished) {
// self.isPauseByUser = NO;
// [self.player play];
// if (!self.currentPlayerItem.isPlaybackLikelyToKeepUp) {
// self.state = HCDPlayerStateBuffering;
//
// self.actIndicator.hidden = NO;
// [self.actIndicator startAnimating];
// // [[XCHudHelper sharedInstance] showHudOnView:_showView caption:nil image:nil acitivity:YES autoHideTime:0];
// }
//
// }];
}
导入你这个框架是不是就一定要同时导入Masonary?
还有就是,没有提供清除缓存的方法吗?
全屏的时候键盘大小变了 但是方向还是竖屏方向弹出
i downloaded the demo and found you used swift to write code ,but it could't work . Can the HcdCachePlayer work by swift ? the finally i will play onLine but no cache ,how i to do
HCDVideoPlayerItemPlaybackLikelyToKeepUpKeyPath 总是显示这个然后就崩了
如果一个视频断点多次下载, HcdVideoRequestTask类里响应网络完成函数进行处理,taskArr一直大于1, 不会建立本地缓存文件。
导致每次都从网络取数据。
你看是不是在HcdVideoRequestTask 的 connectionDidFinishLoading 里加上
[self.taskArr removeObject:connection];
?
目前发现的问题
1.通过 cocoaPods 安装报错
2.有时候快进快退播放时 按钮显示的 却是 暂停状态
3.用真机运行时 进入全屏模式,切换回竖屏模式的按钮无效
用心了,给颗星 望再接再励
你写的这个视频播放库是不是只支持MP4格式的视频,其他视频格式支持嘛?
at
HcdLoaderURLConnection.m line 105
-[HcdLoaderURLConnection respondWithDataForRequest:]
throws an error [_NSZeroData subdataWithRange:]: range {1119212, 2856} exceeds data length 0
detail: http://crashes.to/s/fcbc25cf97f
[[UIApplication sharedApplication] setStatusBarOrientation:_currentOrientation animated:YES];
这句代码貌似不生效
_play = [[HcdCacheVideoPlayer alloc] init];
[_play playWithUrl:[NSURL URLWithString:url showView:_videoImg andSuperView:self withCache:YES];
[_play seekToTime:3];
指定时间播放会闪退 进入下面的代码的时候 self.duration时间为0
seconds = MIN(seconds, self.duration);
[self.player pause];
[self.player seekToTime:CMTimeMakeWithSeconds(seconds, NSEC_PER_SEC) completionHandler:^(BOOL finished) {}
如果从UIDeviceOrientationLandscapeLeft, 直接变到UIDeviceOrientationLandscapeRight时会出现播放player适配不到全屏的问题.
如果将shouldAutorotate设置为YES, 电池条就不跟这适配位置.
怎么没看见有接收的操作呢?
进了视频播放的界面再返回视频还在放,再进来就报错
你好,Jvaeyhcd:
发现视频有时无法缓存,我看你用的是NSURLConnection,现在都是用NSURLSession,你可以替换下吗?
能不能增加一个直接横屏播放的方法?
谢谢!
出错定位 :
[dataRequest respondWithData:[filedata subdataWithRange:NSMakeRange((NSUInteger)startOffset- self.task.offset, (NSUInteger)numberOfBytesToRespondWith)]];
输出日志:
Fatal Exception: NSRangeException
0 CoreFoundation 0x1823c6db0 exceptionPreprocess
1 libobjc.A.dylib 0x181a2bf80 objc_exception_throw
2 CoreFoundation 0x1823c6cf8 -[NSException initWithCoder:]
3 Foundation 0x182d16ff0 -[NSData(NSData) subdataWithRange:]
4 EasyGo 0x100317690 -HcdLoaderURLConnection respondWithDataForRequest:
5 EasyGo 0x100317134 -HcdLoaderURLConnection processPendingRequests
6 EasyGo 0x100317fb4 -HcdLoaderURLConnection didReciveVideoDataWithTask:
7 EasyGo 0x1000e27c4 -HcdVideoRequestTask connection:didReceiveData:
8 CFNetwork 0x182b416a0 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke
9 Foundation 0x182d80540 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK
10 Foundation 0x182cd2870 -[NSBlockOperation main]
11 Foundation 0x182cc2e48 -[NSOperationInternal _start:]
12 Foundation 0x182d82934 __NSOQSchedule_f
13 libdispatch.dylib 0x181e1147c _dispatch_client_callout
14 libdispatch.dylib 0x181e16b84 _dispatch_main_queue_callback_4CF
15 CoreFoundation 0x18237cd50 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE
16 CoreFoundation 0x18237abb8 __CFRunLoopRun
17 CoreFoundation 0x1822a4c50 CFRunLoopRunSpecific
18 GraphicsServices 0x183b8c088 GSEventRunModal
19 UIKit 0x18758e088 UIApplicationMain
20 EasyGo 0x1002a6510 main (main.m:14)
21 libdispatch.dylib 0x181e428b8 (Missing)
我每次进下一个视频界面,那个进度条还停留在上一次播放的位置,等这一条视频加载完才会回到原点,这个bug很重要,谢谢!
在iOS12之前。因为AVPlayer会触发多次请求,所以需要在- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response方法第一行加上sleep一秒钟,数据就能正常缓存了。但是在iOS12之后这个1秒的停留不能添加。否则会导致AVPlayer播放时发现数据没有,就会认为数据被损坏导致status认为Failed,总是第一次播放不成功。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.