This example executes the following steps:
// Use the currently connected camera: var connectResult = connectToCamera(); if (connectResult.ok) { var cameraName = connectResult.message; // Capture var result = startRecording(cameraName); if (!result.ok) { logMessage("Error capturing: " + result.message, true); return; } // Wait until capturing has finished result = waitForCameraRecordingState(cameraName, 0, "idle"); // Load the media list from the camera var mediaList = getMediaList(cameraName, true); // Download the last media item // Media items are sorted by date (descending), thus we use the first one. // After download the media item is deleted. if (mediaList.length > 0) { var result = downloadMedia(cameraName, mediaList[0].mediaKey, "", true, false); if (!result.ok) { logMessage("Download error: " + result.message, true); } } } else logMessage("No camera found");