Function

UISaveVideoAtPathToSavedPhotosAlbum(_:_:_:_:)

Adds the movie at the specified path to the user’s Camera Roll album.

Declaration

func UISaveVideoAtPathToSavedPhotosAlbum(_ videoPath: String, _ completionTarget: Any?, _ completionSelector: Selector?, _ contextInfo: UnsafeMutableRawPointer?)

Parameters

videoPath

The filesystem path to the movie file you want to save to the Camera Roll album.

completionTarget

Optionally, the object whose selector should be called after the movie has been written to the Camera Roll album.

completionSelector

The method selector, of the completionTarget object, to call. This optional method should conform to the following signature:

- (void)               video: (NSString *) videoPath
    didFinishSavingWithError: (NSError *) error
                 contextInfo: (void *) contextInfo;
contextInfo

An optional pointer to any context-specific data that you want passed to the completion selector.

Discussion

When used with an image picker controller, you would typically call this function within your imagePickerController(_:didFinishPickingMediaWithInfo:) delegate method implementation.

Before calling this function, call the UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(_:) function to determine if it is possible to save movies to the Camera Roll album. For a code example, refer to Camera Programming Topics for iOS.

The use of the completionTarget, completionSelector, and contextInfo parameters is optional and necessary only if you want to be notified asynchronously when the function finishes writing the movie to the user’s Camera Roll or Saved Photos album. If you do not want to be notified, pass nil for these parameters.

When used on an iOS device without a camera, this method adds the movie to the Saved Photos album rather than to the Camera Roll album.

See Also

Photo Album

func UIImageWriteToSavedPhotosAlbum(UIImage, Any?, Selector?, UnsafeMutableRawPointer?)

Adds the specified image to the user’s Camera Roll album.

func UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(String) -> Bool

Returns a Boolean value indicating whether the specified video can be saved to user’s Camera Roll album.