1

I am working on a camera&recorder project in Corona which executes as follows:

Upon touch, the camera takes picture, and audio starts recording. Upon next touch:

  1. the previous picture is saved as "image1.jpg"
  2. recording stops and audio file saved as "audio"
  3. next picture is taken 4.next audio starts recording.

This is the recording/capturing part, which is working fine.

Next I have to play the recorded material. for example: from a menu, if image3 is selected, image 3 is displayed on the screen and audio3 starts playing. Now this requires linking the audio files with the images using XML.

I am totally new to XML and I dont know how to use it in Corona. I couldn't find an example to learn from.

Could anyone please tell me how to make the XML file, how to link it to corona and how to achieve the required goal?

If anyone could help me do this in JSON, that would be great too.

Thanks a lot

Ali Ayyaz
  • 11
  • 1
  • 3

1 Answers1

0

Why do you need XML for this (or JSON for that matter)? Are you uploading these to a server? If you just have them local to your device and are not sharing them, just keep the entries in a table to access them. You can then save that table to a file to load the next time your app runs. Now JSON becomes useful here since JSON and Lua tables work really well together.

See: http://developer.coronalabs.com/code/super-simple-lua-table-save-and-load-file-functions

for an easy table saver/loader.

XML is tricker in Lua. This blog post covers XML for Corona.

Rob Miracle
  • 3,053
  • 1
  • 13
  • 12