Save high frame-rate video to documents folder


Hi guys,

I’m trying to save a video file to a folder within Documents. I have a PHAsset representing the video file. I can get an AVAsset from this and save it as a video in Documents. This works for the most part but fails with the following error when trying to save a high frame-rate (slo-mo) video.

JS ERROR TypeError: null is not an object (evaluating ‘urlAsset.URL’)

Does anyone have any experience dealing with high frame-rate videos? Is there a way to export a normal frame-rate version of the video using requestAVAssetForVideoOptionsResultHandler or some other method?

Relevant part of the code:

let documents = fs.knownFolders.documents();
let folder = documents.getFolder(saveToFolder);
let newFilename;
let fileManager = NSFileManager.defaultManager;

return new Promise((resolve, reject) => {

  let path = fs.path.join(folder.path, newFilename);

  let videoRequestOptions: PHVideoRequestOptions;
  videoRequestOptions = PHVideoRequestOptions.alloc().init();
  videoRequestOptions.version = PHVideoRequestOptionsVersion.Original;

  PHImageManager.defaultManager().requestAVAssetForVideoOptionsResultHandler(this._phAsset, videoRequestOptions, function(avAsset, avAudioMix, info) {

    let urlAsset = avAsset as AVURLAsset; 
    let assetURL = urlAsset.URL; // ## Fails here
    let videoData = NSData.dataWithContentsOfURL(assetURL);

    if (fileManager.createFileAtPathContentsAttributes(path, videoData, null)) {


Turns out it isn’t slo-mo videos that are the problem. It is videos that are stored in iCloud due to the “Optimise iPhone Storage” setting.

Fixed by setting networkAccessAllowed = true on the videoRequestOptions object.