User Tools

Site Tools


script-download-media

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

script-download-media [2018/03/30 17:02] (current)
teq created
Line 1: Line 1:
 +====== Download media ======
 +This example executes the following steps:
 +  - Connect the script to a camera.
 +  - Get the media list from the camera.
 +  - Download the newest media item without deleting it.
  
 +<code javascript>​
 +// 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"​);​
 +</​code>​
script-download-media.txt ยท Last modified: 2018/03/30 17:02 by teq