OSC API 規格的 API 層級 1 著重於影像類型,而影片支援已在 API 層級 2 新增。建議相機製造商定義自訂命令和/或視需要延伸標準命令的參數集。 這些稱為「廠商命令」或「廠商參數」。
廠商特定命令與參數的名稱必須為英數字元,而且前面必須加上底線 ( _ )。
廠商特定功能會在四個位置出現:
- /osc/info API 的輸出
- /osc/state API 的輸出
- OSC API 規格,/osc/commands/execute 的命令
- OSC API 規格,命令參數,例如
setOptions
與getOptions
命令的參數。
範例 | |
---|---|
要求 (API 1) | POST /osc/commands/execute HTTP/1.1 Host: [camera ip address]:[httpPort] Content-Type: application/json;charset=utf-8 Accept: application/json Content-Length: {CONTENT_LENGTH} X-XSRF-Protected: 1 { "name": "camera.setOptions", "parameters": { "sessionId": "12ABC3", "iso": 200, "exposureCompensation": -2, "captureMode": "_video" } } |
回應 | HTTP/1.1 200 OK Content-Type: application/json;charset=utf-8 Content-Length: {CONTENT_LENGTH} X-Content-Type-Options: nosniff { "name": "camera.setOptions", "state": "done" } |
要求 | POST /osc/commands/execute HTTP/1.1 Host: [camera ip address]:[httpPort] Content-Type: application/json;charset=utf-8 Accept: application/json Content-Length: {CONTENT_LENGTH} X-XSRF-Protected: 1 { "name": "camera._startRecording", "parameters": { "sessionId": "12ABC3", ... } } |
回應 | HTTP/1.1 200 OK Content-Type: application/json;charset=utf-8 Content-Length: {CONTENT_LENGTH} X-Content-Type-Options: nosniff { "name": "camera._startRecording", "state": "done" } |