Posts

Post not yet marked as solved
1 Replies
1.7k Views
Hi,I'm trying to use AVPlayer with custom URL loading. We have a custom NSURLProtocol subclass. But it seems [NSURLProtocol registerClass] does not work directly with AVPlayer in real device (see this thread).Now I'm trying to use AVAssetResourceLoaderDelegate to do the custom URL loading. However it is a bit confusing to me how the delegate will be triggered. The URL looks like this "https://<some_ip_address>:<port>/resource/", however the protocol is not standard HTTP/1.1 (it's QUIC based instead). I did something like following, but does not work:(delegate is implemented in a different file) AVURLAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil]; AVAssetResourceLoader *resourceLoader = asset.resourceLoader; [resourceLoader setDelegate:delegate queue:dispatch_queue_create("MyURLDelegate loader", nil)]; AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:asset]; AVPlayer *player = [AVPlayer playerWithPlayerItem:playerItem]; AVPlayerViewController *controller = [[AVPlayerViewController alloc] init]; controller.player = player; [player play]; [self presentViewController:controller animated:false completion:^{}];With the above, I cannot see any methods are triggered in the delegate. What am I missing to allow the delegate to do custom URL loading for "https" URLs ? ThanksHan
Posted Last updated
.
Post marked as solved
3 Replies
986 Views
Hi,I was posting a follow-up question to an old thread at here. But I am not sure if anyone would see it. Hence I took the liberty to post a separate thread. Thanks for understanding.I am using a custom protocol (Cronet network stack from Chromium) to play back video using AVPlayer. The code called [NSURLProtocol registerClass] to register its custom protocol and it works well in Xcode 11.3 iOS simulator testing. But the same code does not work on real device (iPhone, iOS 13). The old thread I referred above seems to suggest that AVPlayer would never "see" the registered custom protocol, but I am wondering why it worked in simulator. And is it still true in recent iOS versions that AVPlayer would use a separate process (mediaserverd ?) to play back the video hence ignoring the custom protocol? btw, I also tried to use AVAssetResourceLoaderDelegate to hijack the URL loading for AVPlayer, but did not work either in real device.Thanks.Han
Posted Last updated
.
Post not yet marked as solved
1 Replies
1.3k Views
Hi,I am using NSURLSessionUploadTask in iOS to upload files (photos and videos) in background to my server via Wi-Fi. The small files are all good, but there is one large file that is about 1GB and it failed to upload. The error reported from the server side is: "connection reset by peer". It is interesting that after that error, it seems the client is again uploading the file using a new HTTP call, only to hit the same error again later. My question is: does iOS background upload task always upload via a single HTTP POST regardless file size? or possibily via multiple HTTP POST depends on the file size? Thanks.
Posted Last updated
.