Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8098575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:06:53+00:00 2026-06-05T22:06:53+00:00

I am trying to play a video file using JMF but it gives me

  • 0

I am trying to play a video file using JMF but it gives me No Media Player found exception.

Here is my code, can anyone tell me what I am doing wrong here?

public class MediaPanel extends JPanel {
public MediaPanel(URL mediaURL) {
    setLayout(new BorderLayout());

    try {
        Manager.setHint(Manager.LIGHTWEIGHT_RENDERER, true);
        Player mediaPlayer = Manager.createRealizedPlayer(mediaURL);
        Component video = mediaPlayer.getVisualComponent();
        Component controls = mediaPlayer.getControlPanelComponent();

        if (video != null)

            add(video, BorderLayout.CENTER);

        if (controls != null)
            add(controls, BorderLayout.SOUTH);

        mediaPlayer.start();
    } 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");
    }
}
}



public class MediaTest {

public static void main(String args[]) {
    // create a file chooser
    JFileChooser fileChooser = new JFileChooser();

    // show open file dialog
    int result = fileChooser.showOpenDialog(null);

    if (result == JFileChooser.APPROVE_OPTION) // user chose a file
    {
        URL mediaURL = null;
        Player mediaPlayer = null;

        try {
            // get the file as URL 
            mediaURL = fileChooser.getSelectedFile().toURL();
        } catch (MalformedURLException malformedURLException) {
            System.err.println("Could not create URL for the file");
        }

        if (mediaURL != null) {
            JFrame mediaTest = new JFrame("Media Tester");
            mediaTest.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

            MediaPanel mediaPanel = new MediaPanel(mediaURL);
            mediaTest.add(mediaPanel);

            mediaTest.setSize(300, 300);
            mediaTest.setVisible(true);
        }
    }
}
}

The exception that I am getting is No media player found

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:06:55+00:00Added an answer on June 5, 2026 at 10:06 pm

    What kind of video are you trying to play? JMF is a pretty old library and won’t be able to play most of modern video formats, only a few old ones (i am not even sure which ones).

    Actually, if I am right, to play something specific you will have to write/add your own video-encoders into JMF or at least download and use existing ones, which are usually outdated.

    If you really want to have something like tunable video player that could play any modern video there are two options (in my opinion):

    1. Use vlcj library to embed VLC video player into your Java-application

    2. USe JavaFX media player

    I am offering only those two because I have dig through tons of libraries some time ago and there were nothing else even close to these two. Plus most of other libraries are outdated as well as JMF itself and these two are getting frequent updates and are supported with lots of users so those two are the best choice.

    In case you don’t mind embedding Java FX player into your application – that might be your choice.

    On the other hand – vlcj is stable and easily integrated into Swing applications (its not like its hard with Java FX, but vlcj might be better for some cases).

    Anyway, it is your call what to choose.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to play video from youtube using this code but I get this
I am trying to play the Video file on IE8 using quick time but
I'm trying to play a youtube video on my Android app, but I can't
I've heard that Windows Media Player has problems trying to play H.264 video over
I'm trying to play a video using opencv (the video is an avi file
Hi I am trying to play a video (wmv) file using MediaElement. I have
I'm trying to play a video file with this code: MediaController mc = new
I'm trying to use JMF (Java Media Framework) to play a video. I've tried
I am trying to play .avi file in video lightbox by over riding it's
So I'm trying to play a video and the following code has worked for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.