ios - I have an error with video settings when creating a video from an array of images in swift -
so i've been having problem while. when creating video file array of images, i've been getting errors linking video settings
let paths = nsfilemanager.defaultmanager().urlsfordirectory(.documentdirectory, indomains: .userdomainmask) let documentsurl = images[0] let videowriter: avassetwriter = avassetwriter(url: documentsurl, filetype: avfiletypequicktimemovie, error: nil) var videosettings: nsdictionary = nsdictionary() videosettings = [ avvideocodeckey: avvideocodech264, avvideowidthkey: 1080, avvideoheightkey: 1920 ] var exportpath: nsstring = nstemporarydirectory().stringbyappendingformat("/video.mov") var exporturl: nsurl = nsurl.fileurlwithpath(exportpath string) var exporter = avassetexportsession(asset: videosettings, presetname: avassetexportpresethighestquality) exporter.outputurl = exporturl exporter.exportasynchronouslywithcompletionhandler({ let library = alassetslibrary() library.writevideoatpathtosavedphotosalbum(exporturl, completionblock: { (asseturl:nsurl!, error:nserror?) -> void in }) })
so in block of code should create video file array called "images", line
var exporter = avassetexportsession(asset: videosettings, presetname: avassetexportpresethighestquality)
gives error @ "videosettings" don't understand why happening. error "cannot convert value of type 'nsdictionary' expected argument type 'avasset'"
the line
let videowriter: avassetwriter = avassetwriter(url: documentsurl, filetype: avfiletypequicktimemovie, error: nil)
also gives error @ 'avassetwriter'
the error "cannot invoke initializer of type 'avassetwriter' argument list of type (url: uiimage, filetype: string, error:_)'"
please can problem, thanks
Comments
Post a Comment