Thursday, February 14, 2008

Adventures in Cocoa

Back in January, I obligated myself to write an app for http://www.intersectartcollective.com and http://www.realtime08.org that would display video and still photography captured by a mobile device. The mobile lab was using a solution which relied on an applescripted folder to open an new movies with quicktime in fullscreen. The problem with quicktime and applescript is that every time a new movie would come in quicktime would have to leave fullscreen, close itself, reopen itself and animated back into fullscreen which interrupted the show. The scripts back end used a mail application called eudora to save the attachments to a specified folder so as users emailed their content, euroda save the attachments in the scripted folder which opened quicktime.



Problems


Quicktime can't be scripted to perform like a slideshow dynamically. Inter.sect needed to be able to display multiple videos at the same time. Inter.sect wanted to display the text of the current prompt. (go to their website to see what that's about)



Solution


Cocoa! I decided to write an application for the Mac OS 10.4 platform. I had wanted to use 10.5 for core animation but some of the machines that we were going to be using weren't 10.5 capable. The application utilizes the core video package using the opengl and quicktime libraries. The applications opens a quicktime movie from the saved attachments folder, grabs the latest frame and slaps it onto an opengl primitive as a texture. I decided to switch to Mail instead of Eudora so that I could have more flexibility using applescript and the Mail rules. I used one applescript to save the attachments and another to save the prompts.

 

Download and Install


I've uploaded the latest build and xcode project for the applications that realtime08.org will be using. The source is hacktastic right now but it builds on an updated 10.4 machine.



spectacle download

To Install:

  1. Create a new folder in your ~/Movies directory called "Realtime."

  2. Add a new account to Mail and set up a rule for any mail whose "To:" contains your new accounts email address. Set the rules action to run the save attachments script which came in the zip file. saveAttachments.scpt is for leopard and the other is for tiger obviously.

  3. Run spectacle



New content will appear as you email new content to the email address in mail.

No comments: