473,396 Members | 1,945 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Help in Reading a .avi file

jeffbroodwar
118 100+
Hi,

I'm researching on how can i read a .avi file in java. I'm planning to use it in a dialog box (when deleting files in windows) with progress bar. Any ideas? Thanks.

Regards,
Jeff
Jul 5 '07 #1
5 3357
r035198x
13,262 8TB
Hi,

I'm researching on how can i read a .avi file in java. I'm planning to use it in a dialog box (when deleting files in windows) with progress bar. Any ideas? Thanks.

Regards,
Jeff
Are you using JMF?
Jul 5 '07 #2
jeffbroodwar
118 100+
nope, ^^; can you give me an idea how to do this? Thanks
Jul 5 '07 #3
r035198x
13,262 8TB
nope, ^^; can you give me an idea how to do this? Thanks
I'm not saying you should use it, I was just trying to make sure I understand your question. You can research about it and find out what it has to offer.
Jul 5 '07 #4
Sorry for non-optimized implementation ..
I think it would be useful for AVI reading
Expand|Select|Wrap|Line Numbers
  1.  ////////////////////////////////////////////////
  2. /**
  3. * @(#) jamp.java 0.0.1 07/05/10
  4. * The light-weighted panel for media player
  5. * with visual and contrilling components
  6. * based on JMF 2.1.x
  7. *
  8. *@author jlagoon aka Dmitry Starchenkoff
  9. *@version 0.0.1
  10. */
  11.  
  12. package org.smarts.jamp;
  13. import java.io.File;
  14. import java.net.MalformedURLException;
  15. import java.net.URL;
  16. import javax.swing.JFileChooser;
  17. import javax.swing.JFrame;
  18.  
  19. public class jamp
  20. {
  21.     public static void main( String args[] )
  22.    {
  23.       JFileChooser fileChooser = new JFileChooser();
  24.       int result = fileChooser.showOpenDialog( null );
  25.       if ( result == JFileChooser.APPROVE_OPTION ) // user chose a file
  26.       {
  27.          URL mediaURL = null;
  28.  
  29.          try
  30.          {
  31.             mediaURL = fileChooser.getSelectedFile().toURL();
  32.          }
  33.          catch ( MalformedURLException malformedURLException )
  34.          {
  35.             System.err.println( "Could not create URL for the file" );
  36.          } 
  37.  
  38.          if ( mediaURL != null )
  39.          {
  40.  
  41.             JFrame mt = new JFrame( "JAMP" );
  42.             //mt.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  43.             mt.setSize(300, 300);
  44.             mt.setVisible(true);
  45.             lwjamp mp = new lwjamp(mediaURL);
  46.             mt.add(mp);
  47.  
  48.          }
  49.       } 
  50.    } 
  51. }
  52.  
  53. ////////////////////////////////////////////////////////////////////////////
  54.  
  55. /**
  56. * @(#) jamp.java 0.0.1 07/05/10
  57. * The light-weighted panel for media player
  58. * with visual and contrilling components
  59. * based on JMF 2.1.x
  60. *
  61. *@author Dmitry Starchenkoff
  62. *@version 0.0.1
  63. */
  64.  
  65. package org.smarts.jamp;
  66. import java.awt.*;
  67. import java.awt.event.*;
  68. import java.io.IOException;
  69. import java.net.URL;
  70.  
  71. import javax.media.CannotRealizeException;
  72. import javax.media.Manager;
  73. import javax.media.NoPlayerException;
  74. import javax.media.Player;
  75.  
  76. import javax.swing.*;
  77. import javax.swing.event.*;
  78.  
  79. public class lwjamp extends JPanel
  80. {
  81.    public lwjamp(URL murl)
  82.    {
  83.       //THE LIGHT-WEIGHTED MEDIA PLAYER RENDERER ASSUMED
  84.       Manager.setHint( Manager.LIGHTWEIGHT_RENDERER, true );
  85.  
  86.       try
  87.       {
  88.  
  89.          Player mpl = Manager.createRealizedPlayer(murl);
  90.  
  91.          Component video = mpl.getVisualComponent();
  92.          Component controls = mpl.getControlPanelComponent();
  93.  
  94.          if ( video != null ) 
  95.             add( video, BorderLayout.CENTER );
  96.  
  97.          if ( controls != null ) 
  98.             add( controls, BorderLayout.SOUTH );
  99.  
  100.          //THE PLAYBACK
  101.          mpl.start();
  102.       }
  103.       catch ( NoPlayerException noPlayerException )
  104.       {
  105.          System.err.println( "No media player found" );
  106.       }
  107.       catch ( CannotRealizeException cannotRealizeException )
  108.       {
  109.          System.err.println( "Could not realize media player" );
  110.       }
  111.       catch ( IOException IOException )
  112.       {
  113.          System.err.println( "Error reading from the source" );
  114.       } 
  115.    }
  116.  
  117. }
Jul 5 '07 #5
jeffbroodwar
118 100+
Hi jLagoon,

Thanks for the code... I'll test it right away ! Atleast i have something to start with... thanks.

Kind Regards,
Jeff
Jul 6 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: nephish | last post by:
Hey there, i am trying to write an online application using the cgi module. what i want to do is have an html form display a drop-down list and have the values of that list be the lines of text...
1
by: Hafeez | last post by:
I am having real trouble compiling this code http://www.cs.wisc.edu/~vganti/birchcode/codeHier/AttrProj.tgz The attachment shows errors when compiled using the current version of g++ in a...
2
by: Parker.Jim | last post by:
I need to write a program which performs word subsitutions on a text file. The program should input the names of three text files: the source file that will be "edited", a text file that contains...
3
by: Chi | last post by:
what is the "unable to write data to the transport connection" I use the oreilly , programming c# using System; using System.Net.Sockets; using System.Text; using System.IO; // get a file...
36
by: felixnielsen | last post by:
What i really wanna do, is defining my own types, it doesnt really matter why. Anyway, i have run into some problems 1) typedef unsigned short U16; U16 test = 0xffffffff; // There should be a...
66
by: genestarwing | last post by:
QUESTION: Write a program that opens and read a text file and records how many times each word occurs in the file. Use a binary search tree modified to store both a word and the number of times it...
2
by: -D- | last post by:
I'm taking my first stab at using xml, so please bear with my novice questions and understanding of xml. I'm trying to create an xml file that holds all my website navigation. If I understand...
1
by: syhzaidi | last post by:
How can we do Parsing of Hexdecimel in C# reading string from stream file for eg.. i have a file like.......... 0f 2f 12 2d 3a.......in hexa decimal save in a file.txt and i m reading it from...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
22
by: Amali | last post by:
I'm newdie in c programming. this is my first project in programming. I have to write a program for a airline reservation. this is what i have done yet. but when it runs it shows the number of...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.