Home > Articles > Programming > Java

Build Your Own Media Player

  • Print
  • + Share This
Java expert Geoff Friesen shows how to use the Java Media Framework (JMF) to create a media player program that plays MP3s, MPEGs, and other kinds of media files.
Like this article? We recommend

Goals and Assumptions

We start our media player project by outlining some goals for this player. These goals help determine how much source code we'll write and its complexity. I've chosen the following list of goals for this article's media player:

  • The media player will be an application that presents a simple menu-driven graphical user interface (GUI) based on the Abstract Windowing Toolkit (AWT).

  • The media player will provide a single menu containing menu items for opening a media file, choosing whether to play media files once (the default) or repetitively (in a loop), and exiting the program.

  • The media player will run on multiple platforms.

In addition to the above goals, I've made assumptions about the environment in which the media player is to be built and tested—as well as exposure to JMF knowledge. These assumptions include the following:

  • Java 2 Standard Edition SDK 1.3 has been installed on your computer. (Note: I've compiled and tested this media player using Sun's SDK 1.3 on a Windows 98 SE platform.)

  • JMF 2.1 has been installed on your computer with a performance pack. (Note: I've tested this media player using JMF 2.1 and the Windows performance pack.)

  • You're familiar with basic JMF concepts and APIs.

Given that I'm only using SDK 1.3 on a Windows 98 SE platform, it's impossible for me to ensure that the third goal for media player—running on multiple platforms—is met. Although I've endeavored to write this program in a platform-independent manner, it's possible that you might experience difficulties on your platform. Should this be the case, feel free to send a question to ITworld.com's Java Beginner forum, where you'll find someone (including me) who can provide you with assistance.

  • + Share This
  • 🔖 Save To Your Account