Is this possible with xcode ?

lf2


Joined
Mar 13, 2012
Messages
3
Reaction score
0
Points
1
I am making an iphone camera app.

I would like to know if this is possible:

When you push the camera button, it starts a recording but also makes a file with the exact time (maybe a php file that requests actual server time ?)

does anyone know if this is possible ?
 
Joined
Aug 13, 2011
Messages
200
Reaction score
7
Points
18
Location
West Sussex
OP
L

lf2


Joined
Mar 13, 2012
Messages
3
Reaction score
0
Points
1
is there a way to export the exact time when someone pushes the button to a text file
 
Joined
Aug 13, 2011
Messages
200
Reaction score
7
Points
18
Location
West Sussex
Yes you can do that, but you would not use the UIImagePickerController to create the time,
but would use a NSDate and NSDateFormatter to create an NSString that could be saved to
a file.

You would properbly create these other classes and NSString in one of the UIImagePickerController's delegate methiods, possably the

UIImagePickerController : didFinishPickingMediaWithInfo :

method would be a good choice.

Hope this gives you some ideas and guidance.

Regards Mark
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
You can actually write meta data to the QuickTime file. Well, at least using AV Foundation.

And of course you can create an independent file with what ever you want. You'll want to set sharing of your Documents folder so that iTunes can see the files for transferring. That I believe is just a plist entry.
 
OP
L

lf2


Joined
Mar 13, 2012
Messages
3
Reaction score
0
Points
1
hmm i came up with another idea

lets i make a record app

so someone opens the app and he can use the app to record with the camera but i want to make sure that when he starts recording (he pushes the button to record) he gets the server time (from my server) not the iPhone time.. and that time should be stored somewhere (or in the meta data of the video file !)

what is the best way to to this...any heads up ?
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
I haven't been here for a while and just saw your response.

You'll have to figure out how to get the server timestamp, but what if the server ins't available. I think I'd have the app sync to the server and keep track of the time offset from UTC.

As far as the meta data, look into AVMutableMetadataItem. Here is a bit of sample code.

Code:
NSMutableArray * myMetadata = [[NSMutableArray new] autorelease];
AVMutableMetadataItem * metadataItem;

metadataItem = [AVMutableMetadataItem metadataItem];
metadataItem.keySpace = AVMetadataKeySpaceCommon;		
metadataItem.key = AVMetadataCommonKeySoftware;
metadataItem.value = @"CameraTime 1.1";
[myMetadata addObject: metadataItem];		

outputWriter = [AVAssetWriter assetWriterWithURL: [projectPaths movieURLPath] fileType: AVFileTypeQuickTimeMovie error: &error];
[outputWriter retain];

<A a bunch of setup here for outputWriter>

// [COLOR="Red"]You must do this before starting the outputWriter.[/COLOR]
outputWriter.metadata = myMetadata;
		
[outputWriter startWriting];

The key you're looking for may be AVMetadataCommonKeyCreationDate or AVMetadataCommonKeyLastModifiedDate.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top