"Java" "JMF" uses the JMF test camera windows7 JMF camera __java under Win7

Source: Internet
Author: User

JMF Structure

DataSource (data source)

Interception equipment (Capture Device, including video and audio interception devices)

Viewer (player)

Processor (Processor)

Data formats (format)

Manager (manager)

Directly paste code:

Package B110; Import Java.awt.BorderLayout; Import java.awt.Component; Import java.awt.Dimension; Import Java.awt.Toolkit; Import javax.swing.*; Import javax.media.*; Import Sun.org.mozilla.javascript.internal.Kit; public class Test extends jframe{public static player player = null; private Capturedeviceinfo deviceinfo = null; private Medialocator medialocator = null; Private Component Component = null; Private JPanel mainpanel = null; Private JPanel vediopanel = null; String str1 = "Vfw:logitech USB video camera:0"; String str2 = "Vfw:microsoft WDM Image Capture (WIN32): 0"; Test () {super ("test for the vedio ..."); Init (); private void Init () {Mainpanel = (JPanel) this.getcontentpane (); deviceinfo = Capturedevicemanager.getdevice (STR2); Medialocator = Deviceinfo.getlocator (); try{//using Medialocator to obtain a player player = Manager.createrealizedplayer (medialocator); component = Player.getvisualcomponent (); if (component!= null) {Vediopanel = new JPanel (); Vediopanel.add (component, BorderlAyout. North); Mainpanel.add (Vediopanel); This.pack (); Automatically allocate form size this.setresizable (false); This.setdefaultcloseoperation (Exit_on_close); This.setvisible (TRUE); Player.start (); }}catch (Exception e) {//Todo:handle Exception e.printstacktrace ();}} public static void Main (string[] args) {Test atest = new Test ();}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.