Please select Into the mobile phone version | Continue to access the computer ver.
Convert to swift
92 2 9-4 03:01
Uploading and Loding Picture ...(0/1)
o(^-^)o
djiuser_0wZiRVZwQQOj
lvl.2
Flight distance : 131860 ft
Israel
Offline

Hello,
i build camera app from this guide : https://developer.dji.com/mobile-sdk/documentation/ios-tutorials/index.html
and write averything in swift .
Can someone help to convert this to swift ?

[color=rgba(0, 0, 0, 0.85098)]-(void)videoFeedDJIVideoFeed *)videoFeed didUpdateVideoDataNSData *)videoData {
[color=rgba(0, 0, 0, 0.85098)]    [[DJIVideoPreviewer instance] pushuint8_t *)videoData.bytes lengthint)videoData.length];
[color=rgba(0, 0, 0, 0.85098)]}



when i convert this to swift like this :
[color=rgba(0, 0, 0, 0.85098)]func videoFeed(_ videoFeed: DJIVideoFeed, didUpdateVideoData videoData: Data) {
[color=rgba(0, 0, 0, 0.85098)]        DJIVideoPreviewer.instance().push(UInt8(videoData?.bytes ?? 0), length: (videoData?.count ?? 0))
[color=rgba(0, 0, 0, 0.85098)]    }


i got errors:


Cannot convert value of type 'UInt8' to expected argument type 'UnsafeMutablePointer<UInt8>?'

Cannot convert value of type 'UnsafeRawPointer' to expected argument type 'Int?'

Please help.

This is the stackoverflow : https://stackoverflow.com/questions/63739868/swift-convert-from-objc


9-4 03:01
Use props
DJI_Lisa
Second Officer
United States
Offline

Can you try reposting your code without the formatting and emoticons?
Also, you may find what you need here in this Swift Sample: https://github.com/dji-sdk/Mobile-SDK-iOS/blob/798b8f2579cb08c643c18cd16b36cdfd3b0962f7/Sample%20Code/SwiftSampleCode/DJISDKSwiftDemo/Camera/VideoPreviewerAdapter.swift
9-8 13:55
Use props
djiuser_0wZiRVZwQQOj
lvl.2
Flight distance : 131860 ft
Israel
Offline

This is working thanks.
9-9 00:05
Use props
Advanced
You need to log in before you can reply Login | Register now

Credit Rules