ChangbaDevs / KTVHTTPCache

A powerful media cache framework.
MIT License
2.35k stars 435 forks source link

视频还没有完全缓存完,然后推到后台触发停止缓存功能 #124

Closed iBinbro closed 8 months ago

iBinbro commented 4 years ago
- (void)applicationDidEnterBackground
{
    if (self.server.numberOfHTTPConnections > 0) {
        KTVHCLogHTTPServer(@"%p, enter background", self);
        [self beginBackgroundTask];
    } else {
        KTVHCLogHTTPServer(@"%p, enter background and stop server", self);
        [self stopInternal];
    }
}

执行了 enter background and stop server 方法,实际上音视频并没有完全下载完全 播放核心代码,   请大佬赐教~(^_^)

NSURL *proxyUrl = [KTVHTTPCache proxyURLWithOriginalURL:self.assetURL];

    _asset = [AVURLAsset URLAssetWithURL:proxyUrl options:self.requestHeader];

    _playerItem = [AVPlayerItem playerItemWithAsset:_asset];
    _player = [AVPlayer playerWithPlayerItem:_playerItem];
iBinbro commented 4 years ago

我把源码相关的[self stopInternal]; 进行了注释,也算解决了这个问题,但是有点旁门左道的味道~不知道大佬能不能给点建议,谢谢~

ChangJian2333 commented 4 years ago
libobjc commented 8 months ago

3.0 已修复