实际上,你不得不开始使用相机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