Results 1 to 3 of 3
  1. #1
    jonsamwell is offline Member
    Join Date
    Aug 2008
    Posts
    11
    Rep Power
    0

    Default JMF: Cannot connect to device

    Hi,

    I'm just playing about with JMF at the moment and want to capture video from my webcam and mic, i have the following so far (not complete) but everytime it compiles with the error

    "java.io.IOException: Could not connect to capture device
    javax.media.NoDataSourceException: Error instantiating class: com.sun.media.protocol.vfw.DataSource : java.io.IOException: Could not connect to capture device
    at javax.media.Manager.createDataSource(Manager.java: 1012)
    at test1.FindDevices.main(FindDevices.java:74)
    "
    but only after opening a capture source dialog to select my webcam. any thoughts?

    The error is something to do with this line:

    Java Code:
    DataSource videoDataSource1 = Manager.createDataSource(get_video);
    Full Code

    Java Code:
    import javax.swing.UIManager;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.Vector;
    import java.io.*;
    
    import javax.media.*;
    import javax.media.datasink.*;
    import javax.media.format.*;
    import javax.media.protocol.*;
    import javax.media.util.*;
    import javax.media.control.*;
    
    /**
     *
     * @author Jon
     */
    public class FindDevices {
        
        
      public static void main(String[] args) throws IOException, NoPlayerException {
          
    
        //Capture Video Device info
        Vector videoList = CaptureDeviceManager.getDeviceList(new VideoFormat(VideoFormat.RGB));
        System.out.println("Number of Video Capture Devices Found: " +videoList.size());
        System.out.println("Video Elements: " +videoList.elements());
        
        //Capture Audio Device info
        Vector audioList = CaptureDeviceManager.getDeviceList(new AudioFormat(AudioFormat.LINEAR));
        System.out.println("Number of Audio Capture Devices Found: " +audioList.size());
        System.out.println("Video Elements: " +audioList.elements());
        
        //Gets Devices Info + Name @ Element[0] in array
        CaptureDeviceInfo video_device = (CaptureDeviceInfo) videoList.elementAt(0);
        CaptureDeviceInfo audio_device = (CaptureDeviceInfo) audioList.elementAt(0);
        
            System.out.println();
            
       System.out.println("Video Device Name: "+video_device.getName());
       System.out.println("Video Device Format: "+video_device.getFormats());
        
       System.out.println("Audio Device Name: "+audio_device.getName());
       System.out.println("Audio Device Format: "+audio_device.getFormats());
       
            System.out.println();
            
        //Location of Video Device @ Element[0]    
        MediaLocator get_video = video_device.getLocator();
        System.out.println("Video Location: "+get_video);
        
         //Location of Audio Device @ Element[0]    
        MediaLocator get_audio = audio_device.getLocator();
        System.out.println("Audio Location: "+get_audio);
        
            try {
                
                //Add a datasource and creates a processor object
                DataSource videoDataSource1 = Manager.createDataSource(get_video);
               
                Processor p = Manager.createProcessor(videoDataSource1);
                
                //Prepares the processor for configuration
                p.configure();
                System.out.println("Data Output: " +p.getDataOutput());
                
                
                
            } catch(NoDataSourceException e) {
    			e.printStackTrace();
                    
                
            }
    
      }

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,453
    Rep Power
    20

    Default

    Thread hijack deleted. tinoaff, if you have a question start your own thread. They're free.

    db

Similar Threads

  1. USB Device Copy
    By Mir in forum New To Java
    Replies: 3
    Last Post: 08-25-2008, 12:44 PM
  2. Porting to a Nokia Device
    By David55 in forum CLDC and MIDP
    Replies: 1
    Last Post: 06-30-2008, 02:44 PM
  3. Redirect to null device
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-05-2008, 10:05 AM
  4. Replies: 0
    Last Post: 01-20-2008, 07:07 AM
  5. enter data from an optic device
    By bbq in forum Advanced Java
    Replies: 2
    Last Post: 07-04-2007, 09:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •