2

I am using CTVideoView to playback videos inside a UITableView in iOS. As of late this was working fine, but for some reason, it seems as though the something has gone astray.

About 10% of the videos will play in the table, but many will simply just fail to play. The error occurs when iOS is trying to download the video as can be seen by the error messages below. For some reason, the error message is different in iOS 10 & 11 but the code is the same.

Based on iOS 10's message one would believe that the network is not available, but if I point my safari/chrome browser on the same iOS device it plays the video just fine.

As for the iOS 11 message, I have no idea where to even start as it the first time I've seen this message.

Any help at all would be much appreciated in resolving this.

iOS 10 Error Message

FAILED TO PREPARE VIDEO WITH ERROR: Error Domain=NSURLErrorDomain Code=-1 "unknown error" UserInfo={NSLocalizedDescription=unknown error, NSErrorFailingURLStringKey=URLOBSCUREDFORPRIVACY, NSErrorFailingURLKey=URLOBSCUREDFORPRIVACY, NSURL=URLOBSCUREDFORPRIVACY, NSUnderlyingError=0x17044bd00 {Error Domain=CoreMediaErrorDomain Code=-12939 "CFNetwork error unavailable" UserInfo={NSDescription=CFNetwork error unavailable, NSURL=URLOBSCUREDFORPRIVACY}}}

iOS 11 Error Message

FAILED TO PREPARE VIDEO WITH ERROR: Error Domain=NSURLErrorDomain Code=-1 "unknown error" UserInfo={NSUnderlyingError=0x1c08483d0 {Error Domain=CoreMediaErrorDomain Code=-12939 "content range mismatch - should be start 0 length 1247166 is start 0 length 1048575" UserInfo={NSDescription=content range mismatch - should be start 0 length 1247166 is start 0 length 1048575, NSURL=URLOBSCUREDFORPRIVACY}}, NSErrorFailingURLStringKey=URLOBSCUREDFORPRIVACY, NSErrorFailingURLKey=URLOBSCUREDFORPRIVACY, NSURL=URLOBSCUREDFORPRIVACY, NSLocalizedDescription=unknown error}

Update (Possible Clue)

So after some testing I've narrowed it down to videos longer than or equal to 10 seconds. In all other circumstances the video will play.

6
  • 1
    Make sure your video players are being dealloc, depending on device you can only have 4/8/16 players (decoders) in memory at a time. scroll your table then press the memory graph button, with cell -reuse you should only have a max of 4 in memory Nov 23, 2017 at 11:25
  • Thanks for the suggestion @SeanLintern88. I have done my best to verify this and it seems like they already are being dealloc. The strange part of this is that I can scroll to the next video or in some cases have to scroll three or four videos and it will play. Even through app resets, the same videos will not play. Nov 23, 2017 at 11:32
  • 1
    if the videos are not autoplaying, i would suggest having 1 video player in you VC and passit into the cell when you press play or something, im not sure on your video library but AVPlayer has replaceCurrentItem: which allows you to reuse as making video players are expensive Nov 23, 2017 at 11:34
  • Thanks sean, I have tried narrowing this down to a memory issue by having just a simple UIViewController with the video and my play button. The issue persists however. It is worth nothing thought, that it is still a video specific issue, some videos DO infact play. It's always the same ones that do and don't play. Nov 23, 2017 at 11:52
  • could it be a rate limiting issue from the video supplier ? Nov 23, 2017 at 11:55

1 Answer 1

1

I have resolved the issue. The issue was with ParseServer and the fact that it could not stream videos to iOS as it does not come out of the box with byte-range headers configured.

The solution was to implement the GridStoreAdapter into the server and from there migrate file storage to S3 or GCS (depending on your preference). This will need to be done alongside the respective adapter for your service.

Once that was done, the app started behaving correctly again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.