camera.listFiles
列出相機中的所有圖片/所有影片/所有圖片和影片。這可能需要
多個要求,藉此列出所有檔案這項指令已新增至 API 級別 2。
如果相機不支援所要求的參數,相機必須傳回
可用的最高功能舉例來說
要求:{entryCount: 500, maxSize: 2000}
。系統不會擲回錯誤
回應應以相機支援的最大功能為依據
例如:{entryCount: 100, maxSize: 200}
。請擲回其他錯誤
案件;例如,如果要求是 {entryCount: 500, maxSize: -500}
應擲回錯誤 invalidParameterValue
,因為 maxSize
為負數。
參數
- fileType: 列出的檔案類型應為以下任何一種:
分別為「image」、「video」和「all」
- startPosition: (選填) 第一個檔案的位置
。如果省略此值,起始位置為 0,表示
第一個檔案如果大於最後一個檔案的位置,則傳回
傳回空白項目的一般回應,而不是錯誤回應。
- entryCount:要傳回的項目數量。如果是
,只要傳回包含剩餘檔案數量的正常回應即可
實際剩餘檔案,而非錯誤回應
- maxThumbSize:縮圖圖片大小的最大值;
max(thumbnail_width, 縮圖_height))。如果用戶端處於連線狀態,會設為
null
希望在搜尋結果中省略縮圖圖片。
結果
- entries:圖片屬性清單。每個項目應包含下列欄位
經緯度,兩者皆可選用:
- name:檔案名稱。
- fileUrl:檔案的絕對網址,可直接從相機下載。
- size:檔案的位元組大小。
- dateTimeZone:檔案的日期、時間和時區,格式為:
YYYY:MM:DD HH:MM:SS+(-)HH:MM
。請以 24 小時製表示時間。日期和
時間由一個空白字元分隔時區與世界標準時間的差距。請注意,
影片的擷取結束。
- lat: (選用) 擷取檔案時位置的緯度。
- lng: (選填) 檔案擷取時位置的經度。
- width:圖片或每個影片影格的寬度。
- height:圖片或每個影片影格的高度。
- thumbnail:檔案縮圖圖片的 Base64 編碼字串 (當
maxThumbSize != null
時)。
- isProcessed:布林值,表示檔案是否為
(例如拼接) 或只是預覽。這應該是
預設值為
delayProcessing
。如果已有經過處理的圖片
相關的預覽圖片即使存在,也不應顯示。
如果沒有,請列出預覽圖片
- previewUrl:如果
delayProcessing
則預設為空白字串
不支援或 isProcessed
等於 false,或者預覽圖片時
從未產生為中繼結果,否則會是
與最終圖片相對應的預覽圖片。這會用來
預覽圖片與最終圖片的相對應。
- totalEntries (項目總數):以下查詢的項目總數:
fileType
儲存空間 (例如如果 fileType 是「image」,則代表的是
如果 30 天內讀取資料不到一次
建議使用 Coldline Storage
錯誤
- missingParameter:未指定任何必要參數;
例如未指定
entryCount
- INVALIDParameterName:輸入參數名稱是
則無法辨識。
- invalidParameterValue::系統會識別輸入參數名稱,
但值無效;例如,
entryCount
是負數
或其資料類型不正確
指令 I/O |
指令輸入 |
{ "parameters": { "entryCount": 50, "maxThumbSize": 100 } } |
指令輸出 |
{ "results": { "entries": [ { "name": "abc", "fileUrl": "file URL", "size": file size, # of bytes, "dateTimeZone": "2014:12:27 08:00:00+08:00", "lat": 50.5324, "lng": -120.2332, "width": 2000, "height": 1000, "thumbnail": "ENCODEDSTRING", "isProcessed": true, "previewUrl": "" } ... { ... } ], "totalEntries": 250 } } |
指令輸出 (錯誤) |
{ "error": { "code": "invalidParameterValue", "message": "Parameter entryCount is negative." } } |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-08-21 (世界標準時間)。
[null,null,["上次更新時間:2024-08-21 (世界標準時間)。"],[[["Lists all images, videos, or both from the camera's storage, sorted by capture time in descending order."],["Allows retrieval of a specific number of files, starting from a designated position, with optional thumbnail generation."],["Returns file details like name, URL, size, capture timestamp, dimensions, and processing status."],["Includes error handling for missing or invalid parameters, prioritizing maximum camera capabilities over throwing errors when possible."],["Requires API level 2 or higher for compatibility."]]],["This command retrieves a list of files (images, videos, or both) from a camera's storage, sorted by capture time (newest first). Key actions involve specifying `fileType`, optional `startPosition`, desired `entryCount`, and `maxThumbSize`. The camera returns a list of `entries`, each with file details like name, URL, size, and capture time. Errors occur for invalid parameters, with the camera returning maximum supported capabilities for specific cases. Total entries are also provided.\n"]]