實際上,你不得不開始使用相機API所需的第一步。您現在需要解析上述xml以獲取正確的ActionList_URL。您需要的是具有「相機」的ServiceType的那個。這意味着您將收到網址「http://192.168.122.1:8080/sony」。現在,您需要做的是對此URL執行POST調用,爲您要調用的API endPoint提供正文。
如果要拍一張新照片,你可以撥打actTakePicture端點通過JSON這樣
{
"method": "actTakePicture",
"params": [],
"id": 1,
"version": "1.0"
}
然後,您將得到類似下面的結果:
{
"result": [
["http://ip:port/postview/postview.jpg"]
],
"id": 1
}
正如你所看到的圖像的網址被返回,現在你可以下載它。您如何下載它取決於您使用的編程語言。這裏是一個鏈接,如何從URL中使用下載圖像,安卓 Best method to download image from url in Android
如果你想看到所有的圖像和視頻的攝像頭,並下載他們,你會使用getContentList API調用
{
"method": "getContentList",
"params": [
{
"uri": "storage:memoryCard1",
"stIdx": 0,
"cnt": 50,
"view": "date",
"sort": ""
}
],
"id": 1,
"version": "1.3"
}
這會給你的結果是這樣的:
{
"result": [
[
{
"uri": "image:content?contentId=XXXXXXXXXX",
"title": "",
"content": {
"original": [
{
"fileName": "DSC00001.JPG",
"stillObject": "jpeg",
"url": "http://ip:port/contentstransfer/orgjpeg/xxxxxxxx-xxxxxxxx"
}
],
"smallUrl": "http://ip:port/contentstransfer/vga/xxxxxxxx-xxxxxxxx",
"largeUrl": "http://ip:port/contentstransfer/scn/xxxxxxxx-xxxxxxxx",
"thumbnailUrl": "http://ip:port/contentstransfer/thumb/xxxxxxxx-xxxxxxxx"
},
"createdTime": "2014-08-18T12:34:56+09:00",
"contentKind": "still",
"folderNo": "100",
"fileNo": "0001",
"isPlayable": "false",
"isBrowsable": "false",
"isProtected": "",
"remotePlayType": null
}
]
],
"id": 1
}
請讓我知道如果您將n eed more information
請閱讀[在什麼情況下,我可以在我的問題中添加「緊急」或其他類似的短語,以獲得更快的答案?](// meta.stackoverflow.com/q/326569) - 摘要這不是解決志願者問題的理想方式,而且可能會對獲得答案產生反作用。請不要將這添加到您的問題。 – halfer