Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
MP3 Player
Last Revision: | Version 1.0, 2003-01-14 How to wrap a command-line UNIX/Linux application in a Cocoa GUI, calling a the command-line app through NSTask. |
Build Requirements: | Project Builder 2.0 or higher |
Runtime Requirements: | Mac OS X, mpg123 for playing mp3 files |
This sample shows how to wrap a command-line UNIX/Linux application in a Cocoa GUI, calling out to the command-line app through NSTask. MP3 Player is just what its name suggests - an MP3 player, and it calls through to the open-source mpg123 command-line mp3 player to do the real work of playing music. What the Cocoa code provides is a nice window with a tableview for holding MP3s which you can drag-and-drop onto the table from the Finder. The tableview handles double-clicking a song to play it, or you can press the play or stop buttons in the window to play the currently selected song. The custom tableview provided also now shows how to highlight every other row in blue, a la iTunes. See the ReadMe file for information on downloading and building mpg123.
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14