I am a Java developer, designer, public speaker and a JAS 39 Gripen instructor fighter pilot. A somewhat unusual combination I guess, but I like challenges. I have created miglayout.com, migcalendar.com and Wing, a flight planning system used in several Air Forces. I find end user usability to be the most important part of a system and have therefore specialized in creating such applications. Mikael has posted 10 posts at DZone. View Full User Profile

Creating the Perfect Media Player in Java - Part 1

09.24.2008
| 32870 views |
  • submit to reddit

Not a title that is easy to live up to… Well, at least I am going to try. If you are interested I invite you to tag along for the ride. It is going to be some technical stuff, in Java mostly, and some design related stuff. Lets get right to it why don’t we?

What I’m creating is a Medial Player that will actually help you when listening to music, looking at pictures or watching movies. The goal is that anyone should be able to use it, even your mother, and her mother. And it should look darn good too. In all it should look better than iTunes, be more versatile than WinAmp and at least play all files that your OS plays (but probably more). As I said, not an easy task..

Design. Very Light. I like light designs. Vista black is nice too, but it’s to high in contrast for my taste. Light it is. I do have something of a blueprint in my head and I have just finished some preliminary GUI design using Adobe Fireworks.

Here is a screenshot of a first take and the main view shown when the player is in “full mode”.

Main Window

Main Window (Click to Enlarge)

I am not a big fan of menus. They are a scrap heap where you put stuff you didn’t think of putting in the GUI. Therefore one of the main goals, of which there will be many, trust me, is to create a UI where you can reach all functionality directly. WYSIWYG UI…

Next, I will add something sliding in from the side…

Published at DZone with permission of its author, Mikael Grev.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Vincent DABURON replied on Wed, 2008/09/24 - 3:34am

Hello Mikael,

What technology or API do you use to play video ?

- JavaFx ?

- java DirectShow ?

- java Videolan ?

- Quicktime for java ?

- java for ffmpeg ?

other ...

 

Vincent

 

Mikael Grev replied on Wed, 2008/09/24 - 4:47am

Hello Vincent,

I am still in the desig phase using Adobe Fireworks so I have not considered technology for playback yet. I have just checked that there is in fact ways to play what I want. In update 10, which I will need in any case, you can always play what the system can play. What is important is that my mother, and her mother, will be able to play the most common formats in a super simple way. But of course the geeks will have options as well.

As soon as I get to the coding I will start to look into the codec issues and I will blog about it then as well.

Cheers,
Mikael

Carl Antaki replied on Wed, 2008/09/24 - 9:48am

Michael slick design. I don't think that you can compete with iTunes though with the features (have you tried the genius feature in iTunes 8) they have, the integration with the iPod.

Mikael Grev replied on Wed, 2008/09/24 - 9:56am

Thanks Carl,

Actually I was a bit disappointed when I saw Genie. Not because it was bad but because that was going to be one of the cool features in this media player. My version of Genie will be a bit broader and I hope it will be good. The main advantage towards iTunes will be speed, better usability (IMO) and absolutely no lock-ins.

Cheers,
Mikael

Carl Antaki replied on Wed, 2008/09/24 - 12:11pm

Good luck Michael. Are you going to set up an open source project? It's going to be hard to beat iTunes.Do you know how much time will it take to include synching capabilities?

With Swing the UI won't be faster than the natively built iTunes. I can still tell that an application is a Java app even though we have Java 6 Update 10, the problem is that widget creation time which include classloading is still not negligible and the memory consumption is higher.

Mikael Grev replied on Wed, 2008/09/24 - 12:20pm

Carl,

Nope, not a OSS project per se, but it will be free once completed.

Syncing will all be done by plugins. I will just provide the threading and queueing and a plugins just have to do the last device specific part if needed. Syncing will be in phase two though.

Swing can be made fast, but you need to know how. Using decorators insted of many components is one trick. On our Macs iTunes is actually not that fast to start up and a lot of times it freezes when there are background activities. I guess they don't have the best threading model in the background...

At least I aim at faster. Let's see how it goes... :)

Carl Antaki replied on Wed, 2008/09/24 - 1:38pm in response to: Mikael Grev

Mikael,

I've created many Swing apps and I've worked on Swing apps perfromance. There's still some time associated with the control creation ex. when you load a dialog the first time notice the time it takes. Pre-creating all controls so that is one option which isn't my favourite. I still prefer applications written in native languages because of the speed of their toolkit. What do you mean by decorators instead of many components can you elaborate on that? I don't see how this could help.

I know that users don't care about the speed of the toolkit but about perceived performance but I have yet to see seen a single Java app that's faster that native ones, ex. that can display large images as fast as acdsee for example, I've tried myself and couldn't get anything close with a pure Java solution.

 

Thanks,


Carl

Mikael Grev replied on Wed, 2008/09/24 - 1:40pm in response to: Carl Antaki

Carl,

Decorators can be seen as custom light weight components that which purpose is to encapsulate Java2D painting. Go to http://www.migcalendar.com/demos.php and check out the topmost demo. I think it is pretty fast, at least when dragging the activities.

Using a decent LayoutManager is also key. MiGLayout.com will make you use much less panels in panels, which is good for performance.

Carl Antaki replied on Wed, 2008/09/24 - 1:51pm in response to: Mikael Grev

Migcalendar is very cool but there aren't many components and the UI is not very complex. I already use JGoodies, haven't used MigLayout yet but it seems comparable. I think that the performance bottlnecks are in classloading and the fact that Java has to create the controls.

Mikael Grev replied on Wed, 2008/09/24 - 1:52pm in response to: Carl Antaki

> there aren't many components

Yes, that is the secret. Not many components but lots and lots of decorators... Classloading is at least only a startup problem.

Carl Antaki replied on Wed, 2008/09/24 - 2:06pm

In your case you're in control in what you're doing but in a business app you have no control you have to have x numbers of JTextFields, JTable, JXTreeTables, JTrees, etc. Classloading happens after the startup also. Try the -verbose VM argument and see it for yourself.

Michael Bien replied on Thu, 2008/09/25 - 3:47am

i don't see a reason why classloading should be a problem in his case. I mean its (in a nutshell) a one windowed application with almost all custom components displayed at startup.

 Don't overengeneer and everything should be fine regarding classloading (its a media player no appserver ;-)).

@Mikael

It is currently a bit difficult to create fluent annimations with JavaFX, i am already looking forward to read which technoligy you finally desided to use for components like the cover flow widget. (JOGL would be an option too but swing-gl interop. is a bit buggy on old hardware and certain drivers->intel)

 btw: its a shame that it wont be OSS :P

Spiritus Umbrarum replied on Sat, 2013/05/11 - 4:36pm

 Good Day.

I Tried to Make A Fully Featured Java Multimedia Player... I Am Not Really A Programmer, So I Gave Up When I Could Not Add Codecs For All Media Formats.

I Just Saw And Tried Your Media Player And I Liked It.  I Want To Ask You To Participate In My Project Or Help Me To Do It While You Finish Yours Or Join Both Projects And Release Them Separately With Each One's Style Of GUI, Name, Etc. (It Is Almost The Same You Are Doing But With Different GUI Structure). 

My Project Is Named "Ars De Yaxche En Xibalba Regnum". I Thought It Basing On MusicBee, Nightingale, MediaMonkey, Etc... And It Is Basically The Same But With All Existing Functions, Codecs, Etc. And Some New Ones I Thought Joined In This Player / Manager.

It Shalt Be Open Source (Add-Ons).

Please Answer Me If you Are Interested Or Not. I really Want To Do This Project And You Seem To Be the Right Person To Help Me.

Cheers.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.