• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1344
  • Last Modified:

embed JMF player in html page

I am new to JMF.
I need to embed a player in html to render a video stream of H.264 codec. I went through the following link http://grack.com/downloads/school/enel619.10/report/java_media_framework.html, and added the below lines between html tags then saved the file as test.html.

<APPLET CODE=PlayerApplet WIDTH=320 HEIGHT=300>
<PARAM NAME=FILE VALUE="sparkle2.mpeg">
</APPLET>

But if i try to open the html file I got an error. Below I pasted the JavaConsole information.

java.io.IOException: Permission Denied: From an applet cannot read media file with extension mpeg
java.io.IOException: Permission Denied: From an applet cannot read media file with extension mpeg
Got exception javax.media.NoPlayerException: Error instantiating class: com.sun.media.protocol.file.DataSource : java.io.IOException: Permission Denied: From an applet cannot read media file with extension mpeg
java.lang.NullPointerException
      at PlayerApplet.start(PlayerApplet.java:47)
      at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
Exception: java.lang.NullPointerException

Help me...
0
Sumanbabu
Asked:
Sumanbabu
  • 3
  • 2
  • 2
  • +1
1 Solution
 
CEHJCommented:
You need to load the media file with the following technique
getClass().getResourceAsStream(getParameter("FILE"));

Open in new window

0
 
for_yanCommented:

That's what is written in this article:
http://en.wikipedia.org/wiki/Java_Media_Framework

Many JMF developers have complained that the JMF implementation supplied in up-to-date JRE's supports relatively few up-to-date codecs and formats. Its all-Java version, for example, cannot play MPEG-2, MPEG-4, Windows Media, RealMedia, most QuickTime movies, Flash content new
0
 
SumanbabuAuthor Commented:
Could you please tell me where can I add the above line ?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
SumanbabuAuthor Commented:
Thanks for your help folks. It worked with .avi format.

How ever please suggest me where can I get the plug-ins to support other formats like wmv,mpeg, mpg, mp3 etc :)
0
 
CEHJCommented:
>> It worked with .avi format.

What did you do to get it working?
0
 
objectsCommented:
0
 
objectsCommented:
and if you want to use an applet to access files on the local disk then you'll need to sign its jars
0
 
SumanbabuAuthor Commented:
hello @CHEJ,

I did not change any thing to work with .avi format. I simply used .avi file instead of .mpeg file.
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now