Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/43.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/104.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 同时玩,;保存电影_Iphone_Ios_Objective C_Cocoa Touch_Avplayer - Fatal编程技术网

Iphone 同时玩,;保存电影

Iphone 同时玩,;保存电影,iphone,ios,objective-c,cocoa-touch,avplayer,Iphone,Ios,Objective C,Cocoa Touch,Avplayer,现在我的AVPlayer使用以下代码从远程URL播放视频(视频文件大小为200-300KB) AVURLAsset *asset = [AVURLAsset URLAssetWithURL:someURL options:nil]; AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:asset]; cell.player = [AVPlayer playerWithPlayer

现在我的AVPlayer使用以下代码从远程URL播放视频(视频文件大小为200-300KB)

        AVURLAsset *asset = [AVURLAsset URLAssetWithURL:someURL options:nil];
        AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:asset];
        cell.player = [AVPlayer playerWithPlayerItem:playerItem];


        AVPlayerLayer *layer = [AVPlayerLayer playerLayerWithPlayer:cell.player];
        cell.player.actionAtItemEnd = AVPlayerActionAtItemEndNone;

        layer.frame = someFrame;
        [cell.layer addSublayer: layer];
到目前为止,我只看到一些示例,其中视频仅从远程URL播放,或者先下载,然后从本地URL播放


我想从URL开始播放视频,在播放时,我想将其本地保存到缓存中。我如何做到这一点?

我也在努力为用户节省一些带宽,你找到解决方案了吗?不幸的是,没有,我不得不先下载视频,下载后再播放。如果你能同时找到一种方法,请告诉我。我已经尝试了所有我能找到的方法,希望至少有一个答案可能适用于iOS 7.1,但没有成功。如果您尝试改用Avassetrader,您将得到一个更详细的错误,而不是未知的错误。