Adding video in jframe?

help please.. how can i add a video in a jframe? is it possible?

how? i cant understand it. plesae teach me........T_TYou can do this. You just need JMF. Check out this code
import javax.swing.*;
import javax.media.*;
import java.net.*;
import java.io.*;
public class JMFVideo1
     public static void main(String args[]) throws Exception
          Player player;
          JFrame jframe=new JFrame();
          jframe.setSize(300,300);
          JPanel jpanel=new JPanel();
          jpanel.setLayout(new BoxLayout(jpanel,BoxLayout.Y_AXIS));
          player=Manager.createRealizedPlayer(new MediaLocator(new File("G:/java files1/jmf/love.mpg").toURL()));
          player.setMediaTime(new Time(30.0));
          jpanel.add(player.getVisualComponent());
          Control controls[]=player.getControls();
          CachingControl cc=null;
          for(int i=0;i<controls.length;i++)
               if(controls[i] instanceof CachingControl)
                    cc=(CachingControl) controls;
                    jpanel.add(cc.getProgressBarComponent());     
                    System.out.println("Found CachingControl");
          if(player.getControlPanelComponent()==null)
               System.out.println("Null");
          else
               jpanel.add(player.getControlPanelComponent());
          jframe.setContentPane(jpanel);
          jframe.setVisible(true);
          player.start();

Similar Messages

  • How to play video in JFrame?

    I want to play the video in the JFrame but unable to play
    import java.awt.EventQueue;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.Timer;
    import java.awt.Color;
    import java.awt.Font;
    import java.io.File;
    import javax.swing.*;     
    import javax.media.*;
       class Play extends JFrame 
         private static final long serialVersionUID = 1L;
         private  static        JPanel                          playVideoPanel;               
         private  static        JLabel                         displayLabel1;
         private  static      Timer                         timer;
         private  static      Player                          player;          
         private  static      JPanel                          videoPanel;
         public void playGUI(){         
                JFrame  frame= new JFrame();
              playVideoPanel               =     new JPanel();
              playVideoPanel.setBounds(0, 0, 1024, 768);
              playVideoPanel.setLayout(null);
              //      Label to show the Text     
              displayLabel1               =   new JLabel( "Playing The Video");
              displayLabel1.setBounds( 50, 150, 800, 50);///,
              displayLabel1.setFont( new Font("Serif", Font.BOLD, 36 ));
              // Adding video clip to the JPanel screen                    
              videoPanel=new JPanel();     
              try{               
              player     =     Manager.createRealizedPlayer(new MediaLocator( new File("C://DELTA.mpg").toURL() ) );          
              videoPanel.add(player.getVisualComponent());          
              videoPanel.setBounds( 30, 215, 500, 400 );          
              final Control controls[]=player.getControls();
              player.start();
              add(player.getControlPanelComponent());
              }catch(Exception ee){}
              playVideoPanel.add(displayLabel1);          
              frame.add(playVideoPanel);
              frame.add(videoPanel);
              //setSize(1024, 768);          
              timer = new Timer(10000, new AutoTimer());
                  timer.start();
              frame.setUndecorated(true);
              frame.setSize(1024, 768);
              frame.setDefaultCloseOperation(EXIT_ON_CLOSE);               
              frame.setVisible(true);
              // this will display the main screen after playing the video
              class AutoTimer implements ActionListener {
                   public void actionPerformed(ActionEvent e) {               
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                Play play=     new Play();
                play.playGUI();
    }

    Thanks for your help. in above code I am doing a bit mistake that's why after running the program the video is not starting.
    This is the modified code
    here I want to set loop for video. I am using timer to show it and invoke the media player specific time but wont work please help me where I am getting wrong.
    // This program will play the video in loop
         import javax.swing.Timer;
         import java.awt.Color;
         import java.awt.Font;
         import java.awt.event.ActionListener;
         import java.awt.event.ActionEvent;
         import java.awt.event.ComponentEvent;
         import java.io.File;
         import javax.swing.*;     
         import javax.media.*;
    public class PlayVideo extends JFrame    {
         public   static      PlayVideo                     playVideoFrame;
         private  static        JPanel                          playVideoPanel;               
         private  static        JLabel                         displayLabel1;
         private  static      Timer                         timer;
         private  static      Player                          player;          
         private  static      JPanel                          videoPanel;
         public static void main(String args[]){           
         PlayVideo play=     new     PlayVideo();
              play.createGUI();          
         public void createGUI(){     
              // Main Panel For this Frame
              playVideoFrame = new PlayVideo();
              playVideoPanel               =     new JPanel();
              playVideoPanel.setBounds(0, 0, 1024, 768);
              playVideoPanel.setLayout(null);
              displayLabel1               =  new JLabel( "Playing ");
              displayLabel1.setBounds(50, 150, 800, 50);
              // Adding video clip to the screen                    
              videoPanel=new JPanel();     
              try{               
              player     =     Manager.createRealizedPlayer(new MediaLocator( new File("C://1.mpg").toURL() ) );
              videoPanel.add(player.getVisualComponent());          
              videoPanel.setBounds( 30, 215, 500, 400 );     
              @SuppressWarnings("unused")
              final Control controls[]=player.getControls();
              videoPanel.add(player.getControlPanelComponent());
              player.start();
              }catch(Exception ee){}
              playVideoFrame.add(videoPanel);
              playVideoPanel.add(displayLabel1);
              playVideoFrame.add(playVideoPanel);          
              playVideoFrame.setUndecorated(true);
              playVideoFrame.setSize(1024, 768);
              playVideoFrame.setVisible(true);
              playVideoFrame.setDefaultCloseOperation(EXIT_ON_CLOSE);
              timer = new Timer(13000, new AutoTimer());
              player.start();
              timer.start();
         }                    //      End of myGUI block
              class AutoTimer implements ActionListener {
                   public void actionPerformed(ActionEvent e) {                
                        player.start();                    
      }          // end of class                                        

  • Adding videos without iTunes!

    I have a 30GB iPod and I want link from where I can download a software that can be used for adding videos in iPod without iTunes.
    I need that software because whenever I try to add videos to my iPod using iTunes, it displays the error like this:-
    " iTunes has encountered a problem and needs to be closed.We are sorry for inconvenience."
    So, please send me any link from where I can download such software free!
    Thank You.

    Same Here.
    iTunes doesn't work for me, I need software that will allow me to sync Videos DIRECTLY to my iPod.

  • HT5065 Trouble adding video .M4V to iBooks

    Is anyone having trouble with adding video to iBooks? I exported the files as the instructions said but it is still not working.

    What does that mean?
    Does iBA say the file format isn't allowed?
    Can you add it ok but it won't play at all?

  • Adding JApplet to JFrame

    Hi
    we can add an applet in JFrame(if it takes no parameters) e.g.
    jFrameObject.getContentPane( ).add(anAppletObject);
    but if an applet takes some parameters for initialization, then how i can pass parameters to that applet. means what is the code for passing parameters to an applet.
    Thanks in Advance
    Yahya Kamran

    Well the key to your problem is an interface called "AppletStub".
    What you need to do is define a own Class which implements AppletStub.
    Therefore define methods to retrieve parameters or a constructor doing that and the one to get the parameters in your custom AppletStub.
    The other methods must be implemented, too, but you can leave them blank, too. (eg. void foo() {} the empty braces are what makes the method implemented ;-) ).
    Now do follwing:
    // Creating the Applet you want to
    SillyApplet anAppletObject  = new SillyApplet();
    // Add it as you did
    jFrameObject.getContentPane().add(anAppletObject);
    // Now creating the parameters. This can be done how you like
    // (maybe an ArrayList maybe something more sophisticated)
    String[]  parameterList = new String[3];
    parameterList[0] = "one parameter";
    parameterList[1] = "another parameter" ;
    parameterList[2]  = "something special";
    parameterList[3] = "the last thing ever";
    // Assume your custom stub accepts a String[] of parameters int it's constructor
    // This is how to create such a mean Stub thing
    WeirdStub stub  = new WeirdStub(parameterList);
    // Handing the stub over to the applet
    anAppletObject.setStub(stub);
    // Now let the Applet get loose!
    anAppletObject.init();
    anAppletObject.start();Please note thus the Applet is added to the JFrame, you are still taklking to the same mean object!
    This is called reference semantics, since the variable actualy represents a pointer to the Object you are talking about.
    Another note this has to work a kind like that since the applet viewer is a java programm it self and various ide offer such a thing, too and are of course written in java, too.
    When stuck report in again.
    Greetings to your feetings,
    .o0|LIQID|0o.
    Found it in the java api source code.

  • Problem with adding Videos in itunes

    Can someone please please help me!
    Ever since i upgraded to the latest version of itunes I started encountering problems/difficulties in adding videos in itunes library. All the videos that I'm trying to upload are in the correct file format (mpeg4/mp4). I tried adding using Add File to Library, Add Folder to library and even Import..nothing happens..no prompt that its uploading. In the end can't add any video.
    I tried doing this using my PC and my laptop and i still encounter the same problem so I can say that th problem is not on my computers.
    Please help!
    Ipod Video 30GB   Windows XP  

    Hi,
    This article: http://support.apple.com/kb/TS1718 provides general tips that may resolve the issue.
    -Jason

  • Adding video to webpages

    Hi guys
    Can you help me out. I have added video to my website (10 mp4
    files) and embedded it using the active x function. Now when I test
    them on my Mac they work fine. I have checked it on other macs at
    work and everything runs great. The vids load quickly and play
    fine. But when it comes to PCs nothing works. All you get is what
    looks like a broken picture link. My friend says the videos try to
    load on his PC but after giving a warning about trying to find the
    Active X plugin it crashes his copy of IE6. All the PCs I've tested
    it on run IE5 and they don't crash but give the broken pic link.
    The link to the video gallery is
    http://thisismorley.com/thmfc/vidsMorleyCupFinal280609/galleryMorleyCupFinal.html'
    Could the problem be in the video files I'm using. Should
    they be something other than mp4. If anyone can have a look for me
    I'd be very greatful
    Cheers Thom

    On Tue, 29 Aug 2006 14:18:18 +0000 (UTC), "thomjcook"
    <[email protected]> wrote:
    http://thisismorley.com/thmfc/vidsMorleyCupFinal280609/galleryMorleyCupFinal.html
    >
    > Could the problem be in the video files I'm using.
    Should they be something
    >other than mp4. If anyone can have a look for me I'd be
    very greatful
    The mp4 format is relatively new. It's quite possible that a
    good number
    of machines won't have the proper codec to play it. FWIW, I
    looked at
    the first four or five. They all played fine in both Firefox
    and IE6,
    except the third video crashed IE6. I'd suggest you convert
    them to
    .mpg, or Flash video.
    Gary

  • Adding videos to the proper playlists?

    This is probably a question that has already been asked and answered, but I've been having trouble finding the answer.
    I have successfully added Video Podcasts to my iPod and they show up fine, play, etc.
    My question is how do I get them to show up under the Video Podcasts library on the iPod? Right now, they are in the Video Playlists in a playlist I called Video Podcasts.
    I haven't had a chance to change over any movies or tv shows yet to see if there would be the same problems.
    I've checked in the settings in iTunes, but the options only let me change the video kind to Music Video, Movie, TV Show.
    The genre on these videos say podcast.
    Does anyone have a clue as to what Im doing wrong here?
    Any help would be greatly appreciated.

    Okay.
    Do you have room on the other partition for everything?
    Do this to move it to the other partition.
    1 - Quit iTunes.
    2 - Move the entire iTunes folder to where you want.
    3 - Restat iTunes while holding Shift (Windows) or Option (Mac).
    4 - iTunes will ask to Create new library or Choose existing library. Select Choose existing library and select the iTunes library where you moved the iTunes folder.
    Drag the old iTunes folder to the trash but do NOT empty it yet.
    Restart iTunes and make sure it works. If so, empty the trash.

  • Final cut Express HD sound splits when adding video clips

    this have been happening recently. I set up my music and start add video and photos. Im new to FCE. Anway now when I add a clip the music bar splits seperating to the width of the clip.
    Whats causeing this and what is the fix.
    thank you

    Hi
    A. I don't know
    B. BUT it happens to me to and my strategy is
    - to add new material beyond the end of all material in TimeLine
    - then move it into place.
    This also happens to me when adding Video to another track ==> all splits - but by first add it beyond the end and move it into place always works.
    But to be able to put it (Video, Photos and Audio) into right place directly would have been great.
    Yours Bengt W

  • Adding videos to adobe muse

    I need help in adding videos to adobe muse. I don't want to use video.js becasue its complicated for me. I would like to add an html video. somehting very simple please. I am new to this so be very specific please

    If you attempt to use the embed code from YouTube, the likely result will be a crash in Muse.
    Google made a change to their video player recently that's exposed a crashing bug within Muse. While we work on a robust long-term fix, we've released an alternative YouTube widget on the Muse Exchange <http://muse.adobe.com/exchange-library/youtube-widget-without-poster>. You can double click on the .mulib file to add it to your Library panel. From there you can drag-n-drop the widget onto your page and enter the ID for your YouTube video and select the widget options. This updated widget shows just a static "YouTube" graphic in Muse Design view and the built-in Muse Preview, but works as expected in Preview in Browser or when pushed live.
    Sorry for the inconvenience.

  • Adding video tracks

    For some reason I can't seem to add more than 2 video tracks - i try to click within the sequence and it doesnt even show me the option of adding video tracks?
    1st Gen Intell Mac Pro 2.66 running FCE HD 3.5 and the OS is Snow Leopard.
    Thanks

    It's an old bug. Try dragging a clip into the space above and it will add new tracks.

  • Playing manually added Video Podcasts?

    I have a 5th Gen (60GB) and I update some podcasts manually and other automatically.
    When I manually add a Video Podcast to my iPod, it does not add to the Videos>Video Podcasts directory, nor to the music directory. I've managed to get around this issue by creating a podcast playlist which finds the video and allows access through Video>Video Playlists>
    Is there another, more reasonable option?
    P.S. I assume my issues are related to my desire to automatically sync some podcasts and add others manually (an option "available" in the iPod Preferences, right?) and my solution may ultimately be to do everything automatically or manually, but I'd rather not.
    Thanks in advance for all replies!

    I have exactly the same problem with a 5th Gen 30GB. The onlyu way to view manually-added video podcasts seems to be the way you suggest: to create a playlist. It's the same for audio podcasts, incidentally.

  • Adobe Acrobat Pro crashing after adding video

    Why is my Adobe Acrobat Pro crashing after adding video? It added video fine just weeks ago but now has crashed 11 times while trying to add video. I've tried to add video to a 30 page presentation, a 40 page presentation and a one page test presentation...all crash after adding video. Please help.

    http://helpx.adobe.com/acrobat/kb/acrobat-downloads.html

  • Can't play manually added videos since upgrading to IOS 8

    Since upgrading to IOS 8, my iPhone 5 won't play any videos that I copy to the device manually through iTunes.
    These are videos that I've played on the iPhone before, so I know they are compatible and of the correct format.
    Basically what is happening is that I can copy them across and they show as being on the device, yet when I eject the iPhone and open the Videos app, the video player immediately presents the message 'Cannot play video make sure you are connected to a wi-fi network'
    When I reconnect the iPhone to iTunes, the videos still show as being on the device, but they all have a small exclamation mark next to them.
    Has anyone else seen this behaviour?
    EDIT: I have just discovered that if I add the videos to my iTunes library first, then sync them to the iPhone, they play normally. However, I do not want to have to keep adding any video I want to play into iTunes first, I'd rather just copy them straight off my external HDD as I used too before.

    I have this problem too, but even adding first the video to iTunes isn't working. The videos I'm trying to add to my iPad are in my iTunes library and were in my iPad before the iOS8 upgrade (and played normally), but since the upgrade, none of them work. When transferred to the iPad in the video app show no content, and viewing the iPad content from iTunes just shows the video title in gray with the exclamation mark.
    Waiting for help too.

  • ITunes 12: All added video goes to "Home Videos", and cannot be moved.

    I have just updated to iTunes 12.01.26 on Windows 7 (Home Premium, Service Pack 1)
    I have checked both the 'Keep iTunes Media folder organised' and 'Copy files to iTunes Media folder when adding to library' in preferences.
    Whenever I add video files (TV or Film) by dragging into iTunes, the video file is copied into the 'Home Videos' folder.
    I then use 'Get Info' /options to set the 'Media Kind' to be Film or TV.
    Unlike the previous versions, although the video file now appears in the correct category (in iTunes) - the original video file still resides in the 'Home Videos' folder.
    Renaming the file (with show, name, title etc) has no effect on either the file name or the location.
    Furthermore, when selecting 'TV', there seems to be no option to label the episode with the correct episode ID - only the season/episode.
    Has there been a change in the nature of the way iTunes organises media files, or is this a fault in iTunes, or a problem with Windows?

    You can report problems via the relevant feedback form, e.g. iTunes Feedback, or sign up for a free Apple Developer Connection account and make use of Apple Bug Reporter. They don't generally talk back, but they do claim to read everything. I haven't reported the problem myself. I guess if nobody does they won't pick up on it, otherwise it is the sort of thing that usually gets fixed in the next release. Sadly there isn't an open bugs forum where you can see what issues have already been reported, although if you use the bug reporter you report may get closed as a duplicate which at least tells you that they are aware of the problem.
    tt2

Maybe you are looking for

  • Duplicate new messages in Mail???

    Mail seems to have moods swings in which it chooses to keep 2 copies of the same message in the inbox. Often the duplicate disappears but when is a variable it seems. Can someone help with this? I don;t know if its related, but Mail also does not qui

  • Parsing Data recieved from  Socket

    I am Recieveing Data from Socket BufferdReader bfReader = new BufferedReader(new InputStreamReader(requestSocket.getInputStream())); from sender side i am sending it using C# Application by Creating DataTable and Populating it(it has 6 columns) and t

  • My ipad2 app store is not opening nor responding

    It's my third day that my ipad2 is acting very weird and the app store is giving me a loading bar and nothing happens meanwhile safari is acting very weird with the facebook at the same time and it's not opening too. Anyone can help ???

  • SHMA - Shared Objects

    hi folks, we're using shared objects and are wondering how it could be easily achieved to build the "sharded objects" automatically on ALL !!!! application-server, or do we have to start the build-programs per each server manually ???? kind regards,

  • Photos in e-mails

    I have an IMac and an Air. In the Air any photos sent to me in an e-mail appear in the body of the e-mail. This is great if there are a few photos. But in the Mac they arrive as icons and so I have to click on each one to view them and they are only