How to build a Java Swing You Tube Player

Few days ago, I wanted to write a simple you tube player in java. I searched the internet and ultimately found few relevant articles. not much :(
but this article motivate me to find out more details about creating the player.
finally i found out a way!

First of all I have to tell you that these all codes are belongs to Sun Micro systems and for more details click this link
https://jdic.dev.java.net/documentation/incubator/JDICplus/index.html

These codes can be downloaded from the above site and read all the page content and then you can understand how it goes.

What is JDIC ?

The JDesktop Integration Components (JDIC) project aims to make Java™ technology-based applications ("Java applications") first-class citizens of current desktop platforms without sacrificing platform independence. Its mission is to enable seamless desktop/Java integration.

JDIC provides Java applications with access to functionalities and facilities provided by the native desktop. It consists of a collection of Java packages and tools. JDIC supports a variety of features such as embedding the native browser,
launching the desktop applications, creating tray icons on the desktop, registering file type associations, creating JNLP installer packages, etc.

JDICplus project

Currently the JDICplus is a Java Win32-extension development kit, enabling developers to use extended Microsoft Windows API functionality. Mainly the project implements the semi-lightweight wrapper component around Microsoft Internet Explorer (IE).

Demo Application(A You Tube player and many more features)

DocViewDemo.jnlp

Instructions to execute and build:

1.) Go to this link

https://jdic.dev.java.net/servlets/ProjectDocumentList?folderID=9441&expandFolder=9441&folderID=9441

2.) Download both zip files which contain binary execution

files and source files and extract into your hard drive.

3.) To run demos, just double click .jar files in the binary

zip file

4.) To build samples, I used Netbenas IDE and it'll build
without any single error :)

For an example, Go to folder called 'demo' in the source zip file. It contains source files for several samples that you have executed in the 3rd step.
In here i explain how to build 'FlashPlayer' sample

- Open a new project in the Netbeans
- Add a new Java class same as to the java file name in that sample foldercalled 'FlashPlayer'
- Then copy all the source code in that java file into the newly created class body.(do not modify the package declaration)
- Next, go to folder that you have extracted from binary demo zip file. In that folder, go to another folder called 'Lib'
- In the outside of the folder you can see it contain 3 .jar files. Add those jar files into the library of the netbeans project.(I assume that you know how to add libraries to a netbenas project)
- Congratulations ! You have successfully configure all the settings.
- Now, run the project. It appears nice, cute java swing frame with 3 buttons. Click 'Sample Movie (FLV)' button to play a vedio from the You Tube. Check out the oher 2 buttons also.

*note:
If you want to play a different video from the you tube, just go to the source and change the video id in relevant places (with in the html syntax)

Enjoy !!! I'll see you later
Have a nice weekend

4 comments:

  1. Hi!
    I was trying to compile the FlashPlayer.java class, but I miss a lot of other required classes.
    What are the exact jar files to be included, in order to get the FlashPlayer class compiled?

    Thanks!

    Flavio

    ReplyDelete
  2. Hi,
    you need to include all the JDICplus jar files into your project before compile. you can download it from here. https://jdic.dev.java.net/documentation/incubator/JDICplus/index.html

    best regards
    Lahiru

    ReplyDelete
  3. Hi there, is there any way to not include the control panel?

    ReplyDelete
  4. hi, do you mean control panel in youtube player?

    ReplyDelete