User Tools

Site Tools


script-download-media

Download media

This example executes the following steps:

  1. Connect the script to a camera.
  2. Get the media list from the camera.
  3. Download the newest media item without deleting it.
// Use the currently connected camera:
var connectResult = connectToCamera();
if (connectResult.ok) {
    var cameraName = connectResult.message;
 
    // Load the media list from the camera
    var mediaList = getMediaList(cameraName, true);
 
    // Download the first media item
    if (mediaList.length > 0) {
        var result = downloadMedia(cameraName, mediaList[0].mediaKey, "", false, true);
        if (!result.ok) {
            logMessage("Download error: " + result.message, true);
        }
    }
}
else logMessage("No camera found");
script-download-media.txt · Last modified: 2018/03/30 17:02 by teq