首页 > 解决方案 > M300 - 如何挑选镜头和拍照?SDK IOS

问题描述

我正在尝试使用 iOS SDK 使用 M300 RTK 拍照。我正在调整一个正常工作的 Mavic 2 Pro 应用程序,但无法使其与带有 H20 的 M300 RTK 一起工作。

我试过以下代码:

camera?.setFlatMode(DJIFlatCameraMode.photoSingle, withCompletion: { (e:Error?) in
   // some error handling                
   // take the photo
   camera?.startShootPhoto(completion: { (error:Error?) in
      // other error handling
   })
})

此代码不会发送任何错误,但无人机不会拍摄任何照片。PhotoInterval我已经成功地使用了两次拍照,但现在设置了TimeIntervalSetting回报DJI SDK has come across unknown error code(217). Please update SDK or contact DJI Developer Relations to know more information on this error

即使在拍照时,我也无法选择使用哪个镜头(H20 有两个镜头:变焦和广角),我尝试了以下代码但没有成功:

camera?.setFlatMode(DJIFlatCameraMode.photoInterval, withCompletion: { (e:Error?) in
  // error handling...
  camera?.setPhotoTimeIntervalSettings(DJICameraPhotoTimeIntervalSettings.init(captureCount: 2, timeIntervalInSeconds: 5), withCompletion: { (e:Error?) in
    // error handling...

   camera?.setCameraVideoStreamSource(DJICameraVideoStreamSource.zoom, withCompletion: { (e:Error?) in

     // take the photo
     camera?.startShootPhoto(completion: { (error:Error?) in
       // error handling         

     })
   })
  })
})

知道我做错了什么吗?

谢谢!

标签: iosdji-sdk

解决方案


显然你需要使用 DJICamera.setCaptureStreamSources。我尝试使用 Mobile iOS SDK 和 ObjC 应用程序,但调用只是崩溃了。他们将此添加到新版本 4.14-trial1 中,但我也无法使其工作。

https://developer.dji.com/api-reference/ios-api/Components/Camera/DJICamera.html?search=djicamera&i=0&#djicamera_multilenses_setcapturecamerastreamsettings_inline


推荐阅读