nsdictionary - iOS ,NSDocumentDirectory get the nsurl or path file -
i have code saving mp3 files
nsarray *documentpath = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *docdirectory = [documentpath objectatindex:0]; nsstring *filename = [[nsstring alloc] initwithformat:@"%@%@.mp3", datestring ,timestring ]; nsurl* fileurl = [nsurl urlwithstring:mystring]; nserror* error = nil; nsdata* data = [nsdata datawithcontentsofurl:fileurl options:0 error:&error]; nsstring *savepath = [docdirectory stringbyappendingpathcomponent:filename]; [data writetofile:savepath atomically:yes]; now want read file mpmovieplayercontroller
how can path or nsurl file
--- somthing code same
nsurl * urlv = [[nsurl alloc] initwithstring:mystring]; avplayer = [[mpmovieplayercontroller alloc] initwithcontenturl:urlv]; [avplayer preparetoplay]; [avplayer play]; please searching mystrig or nsurl source
nsstring *filename = @"whatever you've saved filename as"; nsarray *patharray = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask,yes); nsstring *documentsdirectory = [patharray objectatindex:0]; nsstring *yoursoundpath = [documentsdirectory stringbyappendingpathcomponent:filename]; if ([[nsfilemanager defaultmanager] fileexistsatpath:soundpath]) { nsurl *soundurl = [nsurl fileurlwithpath:soundpath isdirectory:no]; } //then init player contents of url
Comments
Post a Comment