• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Play Avi File Using Jmf

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello i m using this code to play avi file and mp3 files i can heard mp3 files but cant play avi files
can any one tell whats problems


Could not realize media player

import java.awt.BorderLayout;
import java.awt.Component;
import java.io.IOException;
import java.net.URL;
import javax.media.CannotRealizeException;
import javax.media.Manager;
import javax.media.NoPlayerException;
import javax.media.Player;
import javax.media.Time;
import javax.media.format.VideoFormat;
import javax.swing.JPanel;

public class MediaPanel extends JPanel {

public MediaPanel(URL mediaURL) {
setLayout(new BorderLayout()); // use a BorderLayout

// Use lightweight components for Swing compatibility
Manager.setHint(Manager.MAX_SECURITY, true);

try {
// create a player to play the media specified in the URL
Player mediaPlayer = Manager.createRealizedPlayer(mediaURL);

// get the components for the video and the playback controls
Component video = mediaPlayer.getVisualComponent();
Component controls = mediaPlayer.getControlPanelComponent();

if (video != null) {
add(video, BorderLayout.CENTER);
} // add video component
VideoFormat vf = new VideoFormat(mediaURL.toString());
String ff = vf.MJPG;
System.out.println(ff);
if (controls != null) {
add(controls, BorderLayout.SOUTH);
} // add controls
Time m = mediaPlayer.getMediaTime();
System.out.println(m.getSeconds());

mediaPlayer.start(); // start playing the media clip
} // end try
catch (NoPlayerException noPlayerException) {
System.err.println("No media player found");
} // end catch
catch (CannotRealizeException cannotRealizeException) {
System.err.println("Could not realize media player");
} // end catch
catch (IOException iOException) {
System.err.println("Error reading from the source");
} // end catch
} // end MediaPanel constructor

} // end class MediaPanel


when i m selecting avi then it will give me error like = "Could not realize media player
"

so what can i do for that
urgently help
thanks in advance
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does this have to do with HTML? Please take the time to choose an appropriate forum for your posts. This forum is for questions on HTML and javaScript. For more information, please click this link ⇒ CarefullyChooseOneForum.

This post has been moved to a more appropriate forum.
 
She's out of the country right now, toppling an unauthorized dictatorship. Please leave a message with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic