Bringing up a button and an image using video cue points

Hi,
I have a 4:40 long video and I'd like to show a button and a background image (or a movie clip) at 4:30 and I want them stay on the screen after the video is complete. If someone could give me a step by step instructions for this I'd really appreciate it. By the way I use Flash CS5.
Have a great day!
Veli

Sorry if I confused you. Here's a little sample video I'd like to show you (only 10 seconds), so I can explain it more clearly. This is exactly the same thing except it is 10 seconds instead of 5 minutes.
http://www.relationsmith.com/hhosp/slideshow/jan12/slideshow.html
In this project I have 6 layers (from top to bottom); action, replay, button, bg, frame, video. The video plays and the button (btn1) comes up at 7, then the video ends and replay button comes up. So far so good.
When I hit replay button to watch the video again, the video starts to play but this time the video is on the top of everything. I cant see the blue frame, at the 7th second the button activates but is hidden behind the video, and so is the replay button. I think the answer lies in this code:
function replay(e:MouseEvent):void {
    addChild(flv_pb); 
    flv_pb.play();
You said this code "addChild(flv_pb);" would put the video on the top of everything. So I was wondering if there is a way to play the video without having it at the top most depth. I'm pasting the entire code for your reference.
Thanks!
import fl.video.MetadataEvent;
replay_btn.visible=false;
btn1.visible=false;
flv_pb.addASCuePoint(7,"show");
flv_pb.addEventListener(MetadataEvent.CUE_POINT,cuepointF);
flv_pb.addEventListener(Event.COMPLETE,completeF);
btn1.addEventListener(MouseEvent.CLICK, clickButton);
replay_btn.addEventListener(MouseEvent.CLICK, replay);
function completeF(e:Event):void{
replay_btn.visible=true;
function replay(e:MouseEvent):void {
    addChild(flv_pb);  // moves flv_pb to the top most depth
    flv_pb.play();
function cuepointF(e:MetadataEvent):void{
if(e.info.name=="show"){
bg.play()
btn1.visible=true;
var myURL:URLRequest=new URLRequest("http://www.ctwolfpackyouth.org/");
function clickButton(myevent:MouseEvent):void {
          navigateToURL(myURL);

Similar Messages

  • Need several buttons that each target a video cue point but only one works

    I have the code that works for one button to find a cue point but how can I make this work for several buttons and their respective cue points?
      "seek-btn2" to find cue 2(named "lou2")
    import fl.video.*;
    // Video component instance name
    var flvControl:FLVPlayback = display;
    var flvSource:String = "lou.flv";
    // Set video
    flvControl.source = flvSource;
    // Add seek functionality to the button
    function seekHandler(event:MouseEvent):void
       flvControl.seekToNavCuePoint("lou1")
    //seek_btn is the button instance name
    seek_btn.addEventListener(MouseEvent.CLICK, seekHandler);
    when i repeat the last part of the code it does not work, thanks for your time....

    Thanks but where would I insert that code and what would I take out from the original code I posted?
    i tried this....
    import fl.video.*;
    // Video component instance name
    var flvControl:FLVPlayback = display;
    var flvSource:String = "lou.flv";
    // Set video
    flvControl.source = flvSource;
    seek_btn1.cuePointName = new String();
    seek_btn1.cuePointName = "lou1";
    seek_btn1.addEventListener(MouseEvent.CLICK, onButtonPress);
    seek_btn2.cuePointName = new String();
    seek_btn2.cuePointName = "lou2";
    seek_btn2.addEventListener(MouseEvent.CLICK, onButtonPress);
    // onButtonPress function
    private function onButtonPress(evt:MouseEvent):void {
         flvControl.seekToNavCuePoint(evt.target.cuePointName);

  • Drag and drop images using tilelist in flex

    i just want the working code for drag and drop images using
    tilelist in flex

    Try JDK 1.4 and call setDragEnabled(true)
    I will also post updated version of MediaChest soon using custom TransferHandler for DnD different types of Objects.

  • How to sync image slides to video cue points?

    Hi, I'm working in AS3. What is the best way to sync some
    image slides to cue points I have embedded in a video? Ideally the
    video would play and and the image will change according to the cue
    points.

    Hi there.
    I encountered that same question just recently. Here's what I
    did:
    First, import your video, choosing to load an external video
    w/ FLYPlayback componant. Name it "vid". The video should already
    your embedded cue points. In this case, the cue points are called
    "Slide 1", "Slide 2" etc.
    Next, bring a UILoader componant to the stage and name it
    "myLoader"
    Specify where your images are (in "myImageHere") and away you
    go my friend.
    Here is the code:
    import fl.video.FLVPlayback;
    import fl.video.VideoEvent;
    import fl.video.MetadataEvent;
    import fl.containers.UILoader;
    vid.addEventListener(MetadataEvent.CUE_POINT, cueSlide);
    function cueSlide(e:MetadataEvent):void {
    var cuePointName=e.info.name;
    if (cuePointName=="Slide 1") {
    myLoader.source="yourImageHere1.jpg";
    } else if (cuePointName == "Slide 2") {
    myLoader.source="yourImageHere2.jpg";
    } else if (cuePointName == "Slide 3") {
    myLoader.source="yourImageHere2.jpg";
    }

  • Upload and Download images using API

    Hi
    I have an image catalog database where the actual images are stored on the database server filesystem and reduced size images are uploaded into the database. The user can browse and search the image catalog and see the reduced size images.
    I have created a collection to store the filenames of selected images (the user selects the images he likes, much like a shopping cart) and I would like to be able to get the corresponding full size images from the server to the client (which are not stored in the database but have the same filename in a folder in the OS).
    I am using XE so don't have room to store the full size images in the catalog.
    I need this to work at the click of a button on the apex form - say the user does a kind of checkout procedure and the files he needs are delivered to his desktop or memory stick or wherever.
    For this button process is it best to
    1) upload the big images into the database (temporarily) and then download them to the client before deleting them from the database - I can do the multi upload from pl/sql but not sure how to do the download.
    or
    2) write some kind of OS batch file to copy the files from the server to the client
    Any help gratefully received.
    I'm using Apex 3.1 on 10g XE on Windows XP
    Thanks
    Kathryn

    Hi
    I don't think bfiles will solve my problem. I need to get a file from a directory on the server to a user specified directory on the client. The database can't write bfiles to the client PC (security). I don't even need the files to be in the database.
    I'd like my applcation to either
    1) write a batch file and then run it. The contents of the batch file will be the copy commands to copy files form server to client
    or
    2) upload the files from the server directory into the database and then the use can download them to wherever he likes - but I need to do multiple files with just one click of a button by the user and the process needs to do the following steps : upload from server, download to client, delete from database
    I think I can do option 2) using Denes' code but it seems a bit OTT and a lot of database work just to copy some OS files.
    Just wondered if anyone else has done something similar
    Kathryn

  • How to  upload and display image using bsp application

    hi
    I  just wants to know that
    1- how to  upload image from BSP page with attachment into sap server .?
    2-how to display image in to BSP page(webpage).
    thanks

    Hello Gupta Prashant,
    Just to upload and display an image, import image in MIME repository. Not only still images but also flash files can also be uploaded in the MIME repository. Once you import the image in it, use normal html code for image call;
    <img src = "file.jpg/gif" width=  height=>
    Besides it, if your requirement is to store the image in the database and fetch it based on specified field-name, then you have to go for BLOBs i.e Binary Large Object, using this you can also store images, videos, pdfs, applications in the database.
    MBLOB - Medium BLOBs store videos and pdfs,
    LBLOB  - Large BLOBs store movie files and applications.
    You have got 2 ways to use it; some databases store BLOB objects into themselves and some store the path of the BLOB object maintained on the FTP server.
    You can also implement it in ABAP;
    read the following link and practice the tutorial;
    [ Use of MIME Types|http://help.sap.com/saphelp_45b/helpdata/en/f1/b4a6c4df3911d18e080000e8a48612/content.htm]
    also check this
    [TYPES - LOB HANDLE|http://help.sap.com/abapdocu/en/ABAPTYPES_LOB_HANDLE.htm]
    And looking at your question, in order to upload an image, you can make use of FILEUPLOAD tag provided by HTMLB.
    Step 1: FILEUPLOAD provides a browse button to choose desired image file.
    Step 2: Store that image in database using BLOBs.
    Step 3: Retrieve the image using normal select query and display it on the screen.
    Hope it helps you,
    Zahack

  • Problem in shuffling the button and puting image on button in the same code

    I'm trying to make 16 block puzzel game. The following code is showing desired output when I'm running it in textpad but it's showing the output in eclipse. Please tell me the reason behind it.
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.*;
    public class Puzzel extends JFrame{
              JButton[] arr = new JButton[15];
              public Puzzel(){
                        Image image;
                        Toolkit toolkit= Toolkit.getDefaultToolkit();
                        image=toolkit.getImage("icon.jpg");
                        ImageIcon icon=new ImageIcon("icon.jpg");
                        setIconImage(image);
                        setTitle("Puzzal");
                        JMenuItem pic = new JMenuItem("Solved");
                        pic.setMnemonic('a');
                        JMenuItem pict = new JMenuItem("Solved");
                        pict.setMnemonic('a');
                        JPanel jp = new JPanel(new GridLayout(4,4));
                        ArrayList list = new ArrayList();
                           for(int x = 0; x < arr.length; x++)
                              arr[x] = new JButton("Button "+(x+1));
                              list.add(arr[x]);
                        Collections.shuffle(list);
                        for(int x = 0; x < list.size(); x++)
                              jp.add((JButton)list.get(x));
                            getContentPane().add(jp);
                                 pack();
               public static void main(String[] args){
                    new Puzzel().setVisible(true);}
         }I want to add image on these buttons and I have tried it using the following code but its not running on eclipse but working fine when run through textpad. I dont know how to use it with shuffel.
    setLayout(new GridLayout(4,4));
             JButton img1 = new JButton("1.jpg", new ImageIcon("1.jpg"));
              getContentPane().add(img1);

    In the future Swing related questions should be posted in the Swing forum.
    I have tried it using the following code but its not running on eclipse I have no idea what "not running" means, but I'm assuming you are having trouble reading the image files.
    Read the section from the Swing tutorial on [How to Use Icons|http://java.sun.com/docs/books/tutorial/uiswing/TOC.html] for the proper way to read images so that is works in all environments.

  • Can i store and retrieve image using sql command?

    hi
    the following is what i enter to store image in table using sql*plus
    however i encounter some errors as shown below.
    i wondered if i actually can use sql to store image and retreive image
    or i need other developer beside sql to do.
    create table img_storage
    (id     number primary key,
    image     ORDSYS.ORDImage);
    CREATE or REPLACE procedure ADD_image (tmp_id number, file_name varchar2)
    as
         obj ORDSYS.ORDImage;
         ctx raw(4000) := null;
    begin
         INSERT INTO img_classifier (id, image) VALUES (tmp_id,
         ORDSYS.ORDImage (ORDSYS.ORDSOURCE(EMPTY_BLOB(),
         NULL,NULL,NULL,SYSDATE,NULL),
         NULL,NULL,NULL,NULL,NULL,NULL,NULL));
         COMMIT;
         SELECT image into obj FROM img_storage
         where id = tmp_id FOR UPDATE;
         obj.importFrom(ctx,'FILE','IMGDIR',file_name);
         obj.setproperties();
         UPDATE img_storage
         SET image = obj where id = tmp_id;
         COMMIT;
    end;
    show errors;
    create or replace directory imgdir as 'c:\image\';
    exec add_image(1,'argvseng.jpg');
    BEGIN add_image(1,'argvseng.jpg'); END;
    ERROR at line 1:
    ORA-00001: unique constraint (SYS.SYS_C002717) violated
    ORA-06512: at "SYS.ADD_IMAGE", line 7
    ORA-06512: at line 1
    how to reslove the error as shown above.
    or sql does not support ordsys.ordimage such command.
    hmm very confused ....
    what is the difference bet using blob for image and ordsys.ordimage?

    This has nothing to do with intereMedia.
    This is a basic SQL issue.
    A primary key cannot have duplicate entries in a table as the error message suggests.
    Before you call your peocedure you can delete the row with 1 as the primary key, or call the insert peocedure using a primary key that is not being used.

  • Where to find names for buttons and toolbars for use in userChrome.css?

    I'm trying to change the layout of the new beta 8 browser, I would like to put the tab bar up into the title bar. The only problem with this is that the Home button and the New Tab button then stop working. I know that the Home button is called "home-button" but I don't know what the new tab button is called. I was merely wondering if there was a way of finding this out at all and if so how I would go about it.
    Thanks.

    Yes, you need to inspect a Chrome window.
    The DOM Inspector (DOMi) has a menu item (Search > Select Element By Click) and a button to "Find a node to inspect by clicking on it" (left icon on the toolbar).<br />
    You first need to open the browser window in the DOMi (File > Inspect Chrome Document) and choose the first from the list or choose the window that you want to inspect if you ave opened more.<br />
    Click the Find button and use the keyboard (Alt Tab) or the Task bar to go back to the browser window (do not click in the browser window).<br />
    Click that element with the mouse and keep the button pressed until you see a red border to indicate the the DOMi has located that element in the DOM tree.<br />

  • Cropping and resizing Images using Adobe Photoshop Elements 12

    I am trying to edit pictures for my web site and previously used adobe photo shop 4 which I liked very well. When I try to crop and resize in photoshop 12 have been unable to adjust the images using pixels. As every photo on my website needs to be in pixels then this is a big problem for me! Is there anyway to change the preferences in the settings?  Thanks Tess

    You should head over to the Elements forums, this forum is for Photoshop. Go here : http://forums.adobe.com/community/photoshop_elements

  • Slideshow w/next previous buttons and linkable images

    I am attempting to create a slideshow that incorporates next and previous buttons and will allow the viewer to click on the slideshow images to be taken to a different URL for each image.  I can do the slide show.  I can do the linked images. However, when I try to add the buttons I am at a loss.  I have created N/P buttons, but I cannot get them to work with linked images. Any suggestions?

    Can you elaborate on how much, and what, you've created? When you say you can do the slide show and you can do the linked images, what exactly did you do?
    How do you envision the slideshow actually visually working? Will multiple images be visible at once? What visual transition? These things matter when coding the button functionality.
    Of course you can always google for a premade slideshow, plenty free out there and unless you're doing it to learn, no real reason to reinvent the wheel.

  • Hi there... I need a little help with buttons and their actions using flex builder 4.5

    I run a repo company and have zero experience in the developing applications and I could use some help from anybody that is willing to give it.... Here is a basic idea of what I need...  let's say there are 3 states... state 1 has a question that says "car you read this?" and a "yes" and a "no" button... when you select either answer, you go to slide 2.  Slide 2 with have a question like "Is the sky brown?" and a "yes" and a "no" button and when either button is selected, you are taken to Slide 3.  Slide 3 needs to be some sort of a text form that is created by the user selecting the buttons and the screen would say something like "yes, i can read this.  no, the sky is not brown", or "no, I can't read this.   yes, the sky is brown" .  I know how to get the buttons to take the user to the correct new slide, but I do not know how to get the buttons to insert specific text somewhere else when any button is selected.... Can anybody help me?  Youtube is only getting me so far, and my kids are driving me nuts while I'm trying to figure this monster out...  I've gotten several slides created and some screens have several buttons, I just need to see what I need to put in the code to get it to do this type of function 

    Also where can I read up on setting my .Xdefaults and xmonad.hs file? I ripped someones from this forum, and it works nice, but I want to make my onw, but cant find any decent documentation. Thanks.
    At the moment, the best source for configs are those posted in the screenshots thread (for both Xdefaults and xmonad.hs), the xmonad config archive (and the available docs from the root page on that site), and our own thread.  Unfortunately you'll have to sort of scrounge for good docs on the xmonad.hs at the moment, since most of the information was written for the 0.4 version of xmonad.  The configuration has since been made MUCH simpler.
    Hope that helps some.

  • Open camera and capture image using J2me.

    please I want J2me code to open the mobile camera and capture image....
    please reply me as quick as possible....(very urgent)...

    eng_amy wrote:
    please I want J2me code to open the mobile camera and capture image....Well..
    eng_amy wrote:
    please reply me as quick as possible....(very urgent).....(checks watch) ..it's obviously too late. Never mind.

  • How to play/record at same time and save image from video

    i started working on a project and that made my life hell although it was so simple. reason was that i couldnt find small/simple code to understand problems and no proper documents. . finally i have done that. and here is the code (without much complex code of interface). it shows vidoe, records a small part of it at start and takes a snapshot (no buttons or events involved). hope it might help someone starting to learn JMF.
    import java.io.*;
    import java.awt.*;
    import java.net.*;
    import java.awt.event.*;
    import java.util.Vector;
    import javax.media.*;
    import javax.media.rtp.*;
    import javax.media.rtp.event.*;
    import javax.media.rtp.rtcp.*;
    import javax.media.protocol.*;
    import javax.media.protocol.DataSource;
    import javax.media.format.AudioFormat;
    import javax.media.format.VideoFormat;
    import javax.media.Format;
    import javax.media.format.FormatChangeEvent;
    import javax.media.control.BufferControl;
    import javax.media.control.FrameGrabbingControl;
    import javax.imageio.ImageIO;
    import java.util.Date;
    import javax.media.util.BufferToImage;
    import java.awt.image.BufferedImage;
    * AVReceive2 to receive RTP transmission using the new RTP API.
    public class AVReceive2 implements ReceiveStreamListener, SessionListener,
    ControllerListener
    public static DataSource ds2, ds, ds3;
    String sessions[] = null;
    RTPManager mgrs[] = null;
    Vector playerWindows = null;
    boolean dataReceived = false;
    Object dataSync = new Object();
    public AVReceive2(String sessions[]) {
    this.sessions = sessions;
    public static DataSource getData() {
    return ds;
    protected boolean initialize() {
    try {
    InetAddress ipAddr;
    SessionAddress localAddr = new SessionAddress();
    SessionAddress destAddr;
    mgrs = new RTPManager[sessions.length];
    playerWindows = new Vector();
    SessionLabel session;
    // Open the RTP sessions.
    for (int i = 0; i < sessions.length; i++) {
    // Parse the session addresses.
    try {
    session = new SessionLabel(sessions);
    } catch (IllegalArgumentException e) {
    System.err.println("Failed to parse the session address given: " + sessions[i]);
    return false;
    System.err.println(" - Open RTP session for: addr: " + session.addr + " port: " + session.port + " ttl: " + session.ttl);
    mgrs[i] = (RTPManager) RTPManager.newInstance();
    mgrs[i].addSessionListener(this);
    mgrs[i].addReceiveStreamListener(this);
    ipAddr = InetAddress.getByName(session.addr);
    if( ipAddr.isMulticastAddress()) {
    // local and remote address pairs are identical:
    localAddr= new SessionAddress( ipAddr,
    session.port,
    session.ttl);
    destAddr = new SessionAddress( ipAddr,
    session.port,
    session.ttl);
    } else {
    localAddr= new SessionAddress( InetAddress.getLocalHost(),
    session.port);
    destAddr = new SessionAddress( ipAddr, session.port);
    mgrs[i].initialize( localAddr);
    // You can try out some other buffer size to see
    // if you can get better smoothness.
    BufferControl bc = (BufferControl)mgrs[i].getControl("javax.media.control.BufferControl");
    if (bc != null)
    bc.setBufferLength(350);
    mgrs[i].addTarget(destAddr);
    } catch (Exception e){
    System.err.println("Cannot create the RTP Session: " + e.getMessage());
    return false;
    // Wait for data to arrive before moving on.
    long then = System.currentTimeMillis();
    long waitingPeriod = 30000; // wait for a maximum of 30 secs.
    try{
    synchronized (dataSync) {
    while (!dataReceived &&
    System.currentTimeMillis() - then < waitingPeriod) {
    if (!dataReceived)
    System.err.println(" - Waiting for RTP data to arrive...");
    dataSync.wait(1000);
    } catch (Exception e) {}
    if (!dataReceived) {
    System.err.println("No RTP data was received.");
    close();
    return false;
    return true;
    public boolean isDone() {
    //return playerWindows.size() == 0;
    return false;
    * Close the players and the session managers.
    protected void close() {
    for (int i = 0; i < playerWindows.size(); i++) {
    try {
    ((PlayerWindow)playerWindows.elementAt(i)).close();
    } catch (Exception e) {}
    playerWindows.removeAllElements();
    // close the RTP session.
    for (int i = 0; i < mgrs.length; i++) {
    if (mgrs[i] != null) {
    mgrs[i].removeTargets( "Closing session from AVReceive2");
    mgrs[i].dispose();
    mgrs[i] = null;
    PlayerWindow find(Player p) {
    for (int i = 0; i < playerWindows.size(); i++) {
    PlayerWindow pw = (PlayerWindow)playerWindows.elementAt(i);
    if (pw.player == p)
    return pw;
    return null;
    PlayerWindow find(ReceiveStream strm) {
    for (int i = 0; i < playerWindows.size(); i++) {
    PlayerWindow pw = (PlayerWindow)playerWindows.elementAt(i);
    if (pw.stream == strm)
    return pw;
    return null;
    * SessionListener.
    public synchronized void update(SessionEvent evt) {
    if (evt instanceof NewParticipantEvent) {
    Participant p = ((NewParticipantEvent)evt).getParticipant();
    System.err.println(" - A new participant had just joined: " + p.getCNAME());
    * ReceiveStreamListener
    public synchronized void update( ReceiveStreamEvent evt) {
    RTPManager mgr = (RTPManager)evt.getSource();
    Participant participant = evt.getParticipant();     // could be null.
    ReceiveStream stream = evt.getReceiveStream(); // could be null.
    if (evt instanceof RemotePayloadChangeEvent) {
    System.err.println(" - Received an RTP PayloadChangeEvent.");
    System.err.println("Sorry, cannot handle payload change.");
    System.exit(0);
    else if (evt instanceof NewReceiveStreamEvent) {
    try {
    stream = ((NewReceiveStreamEvent)evt).getReceiveStream();
    //DataSource
    ds2 = stream.getDataSource(); // this original cant be used now
    // ds is used to play video
    ds = Manager.createCloneableDataSource(ds2);
    // ds3 is used to record video
    ds3 = ((SourceCloneable)ds).createClone();
    // Find out the formats.
    RTPControl ctl = (RTPControl)ds.getControl("javax.media.rtp.RTPControl");
    if (ctl != null){
    System.err.println(" - Recevied new RTP stream: " + ctl.getFormat());
    } else
    System.err.println(" - Recevied new RTP stream");
    if (participant == null)
    System.err.println(" The sender of this stream had yet to be identified.");
    else {
    System.err.println(" The stream comes from: " + participant.getCNAME());
    // create a player by passing datasource to the Media Manager
    Player p = javax.media.Manager.createPlayer(ds);
    if (p == null)
    return;
    p.addControllerListener(this);
    p.realize();
    PlayerWindow pw = new PlayerWindow(p, stream);
    playerWindows.addElement(pw);
    // Notify intialize() that a new stream had arrived.
    synchronized (dataSync) {
    dataReceived = true;
    dataSync.notifyAll();
    } catch (Exception e) {
    e.printStackTrace();
    return;
    else if (evt instanceof StreamMappedEvent) {
    if (stream != null && stream.getDataSource() != null) {
    DataSource ds = stream.getDataSource();
    // Find out the formats.
    RTPControl ctl = (RTPControl)ds.getControl("javax.media.rtp.RTPControl");
    System.err.println(" - The previously unidentified stream ");
    if (ctl != null)
    System.err.println(" " + ctl.getFormat());
    System.err.println(" had now been identified as sent by: " + participant.getCNAME());
    else if (evt instanceof ByeEvent) {
    System.err.println(" - Got \"bye\" from: " + participant.getCNAME());
    PlayerWindow pw = find(stream);
    if (pw != null) {
    pw.close();
    playerWindows.removeElement(pw);
    * ControllerListener for the Players.
    public synchronized void controllerUpdate(ControllerEvent ce) {
    Player p = (Player)ce.getSourceController();
    if (p == null)
    return;
    // Get this when the internal players are realized.
    if (ce instanceof RealizeCompleteEvent) {
    PlayerWindow pw = find(p);
    if (pw == null) {
    // Some strange happened.
    System.err.println("Internal error!");
    System.exit(-1);
    pw.initialize();
    pw.setVisible(true);
    p.start();
    try {
    // make it wait so that video can start otherwise image will be null. u must call this method with a button
    Thread.sleep(2500);
    catch (Exception e) {
    e.printStackTrace();
    // Grab a frame from the capture device
    FrameGrabbingControl frameGrabber = (FrameGrabbingControl) p.getControl(
    "javax.media.control.FrameGrabbingControl");
    Buffer buf = frameGrabber.grabFrame();
    // Convert frame to an buffered image so it can be processed and saved
    Image img = (new BufferToImage( (VideoFormat) buf.getFormat()).
    createImage(buf));
    BufferedImage buffImg = new BufferedImage(img.getWidth(null),
    img.getHeight(null),
    BufferedImage.TYPE_INT_RGB);
    Graphics2D g = buffImg.createGraphics();
    g.drawImage(img, null, null);
    // Overlay curent time on image
    g.setColor(Color.RED);
    g.setFont(new Font("Verdana", Font.BOLD, 12));
    g.drawString( (new Date()).toString(), 10, 25);
    try { // Save image to disk as PNG
    ImageIO.write(buffImg, "jpeg", new File("c:\\webcam.jpg"));
    catch (Exception e) {
    e.printStackTrace();
    // this will record the video for a few seconds. this should also be called properly by menu or buttons
    record(ds3);
    if (ce instanceof ControllerErrorEvent) {
    p.removeControllerListener(this);
    PlayerWindow pw = find(p);
    if (pw != null) {
    pw.close();
    playerWindows.removeElement(pw);
    System.err.println("AVReceive2 internal error: " + ce);
    * A utility class to parse the session addresses.
    class SessionLabel {
    public String addr = null;
    public int port;
    public int ttl = 1;
    SessionLabel(String session) throws IllegalArgumentException {
    int off;
    String portStr = null, ttlStr = null;
    if (session != null && session.length() > 0) {
    while (session.length() > 1 && session.charAt(0) == '/')
    session = session.substring(1);
    // Now see if there's a addr specified.
    off = session.indexOf('/');
    if (off == -1) {
    if (!session.equals(""))
    addr = session;
    } else {
    addr = session.substring(0, off);
    session = session.substring(off + 1);
    // Now see if there's a port specified
    off = session.indexOf('/');
    if (off == -1) {
    if (!session.equals(""))
    portStr = session;
    } else {
    portStr = session.substring(0, off);
    session = session.substring(off + 1);
    // Now see if there's a ttl specified
    off = session.indexOf('/');
    if (off == -1) {
    if (!session.equals(""))
    ttlStr = session;
    } else {
    ttlStr = session.substring(0, off);
    if (addr == null)
    throw new IllegalArgumentException();
    if (portStr != null) {
    try {
    Integer integer = Integer.valueOf(portStr);
    if (integer != null)
    port = integer.intValue();
    } catch (Throwable t) {
    throw new IllegalArgumentException();
    } else
    throw new IllegalArgumentException();
    if (ttlStr != null) {
    try {
    Integer integer = Integer.valueOf(ttlStr);
    if (integer != null)
    ttl = integer.intValue();
    } catch (Throwable t) {
    throw new IllegalArgumentException();
    * GUI classes for the Player.
    class PlayerWindow extends Frame {
    Player player;
    ReceiveStream stream;
    PlayerWindow(Player p, ReceiveStream strm) {
    player = p;
    stream = strm;
    public void initialize() {
    add(new PlayerPanel(player));
    public void close() {
    player.close();
    setVisible(false);
    dispose();
    public void addNotify() {
    super.addNotify();
    pack();
    * GUI classes for the Player.
    class PlayerPanel extends Panel {
    Component vc, cc;
    PlayerPanel(Player p) {
    setLayout(new BorderLayout());
    if ((vc = p.getVisualComponent()) != null)
    add("Center", vc);
    if ((cc = p.getControlPanelComponent()) != null)
    add("South", cc);
    public Dimension getPreferredSize() {
    int w = 0, h = 0;
    if (vc != null) {
    Dimension size = vc.getPreferredSize();
    w = size.width;
    h = size.height;
    if (cc != null) {
    Dimension size = cc.getPreferredSize();
    if (w == 0)
    w = size.width;
    h += size.height;
    if (w < 160)
    w = 160;
    return new Dimension(w, h);
    public void record(DataSource ds) {
    Format formats[] = new Format[1];
    formats[0] = new VideoFormat(VideoFormat.CINEPAK);
    FileTypeDescriptor outputType =
    new FileTypeDescriptor("video.x_msvideo");
    Processor p = null;
    try {
    p = Manager.createRealizedProcessor(new ProcessorModel(ds,formats,
    outputType));
    } catch (IOException e) {
    e.printStackTrace();
    } catch (NoProcessorException e) {
    e.printStackTrace();
    } catch (CannotRealizeException e) {
    e.printStackTrace();
    // get the output of the processor
    DataSource source = p.getDataOutput();
    // create a File protocol MediaLocator with the location
    // of the file to
    // which bits are to be written
    MediaLocator dest = new MediaLocator("file://vvv.mpeg");
    // create a datasink to do the file writing & open the
    // sink to make sure
    // we can write to it.
    DataSink filewriter = null;
    try {
    filewriter = Manager.createDataSink(source, dest);
    filewriter.open();
    } catch (NoDataSinkException e) {
    e.printStackTrace();
    } catch (IOException e) {
    e.printStackTrace();
    } catch (SecurityException e) {
    e.printStackTrace();
    // now start the filewriter and processor
    try {
    filewriter.start();
    } catch (IOException e) {
    e.printStackTrace();
    p.start();
    try {
    Thread.sleep(10000);
    }catch(Exception e) { }
    p.close();
    filewriter.close();
    // stop and close the processor when done capturing...
    // close the datasink when EndOfStream event is received...
    public static void main(String argv[]) {
    //     if (argv.length == 0)
    //     prUsage();
    String[] a = new String[1];
    a[0] = ("192.168.0.45/4002");
    AVReceive2 avReceive = new AVReceive2(a);
    if (!avReceive.initialize()) {
    System.err.println("Failed to initialize the sessions.");
    System.exit(-1);
    // Check to see if AVReceive2 is done.
    try {
    while (!avReceive.isDone())
    Thread.sleep(1000);
    } catch (Exception e) {}
    System.err.println("Exiting AVReceive2");
    static void prUsage() {
    System.err.println("Usage: AVReceive2 <session> <session> ...");
    System.err.println(" <session>: <address>/<port>/<ttl>");
    //System.exit(0);
    }// end of AVReceive2
    so here the code. all messed up. coz i have just completed it and havent worked on interface or formatting this code properly (didnt have much time). but hope it will help. ask me if u have any questions. dont want others to have those basic problems that i had to face.

    u did a good effort for the JMF beginners i appreciate that....thanks i lot....i need you help in a project in
    which i have to connect to a d-link 950G IP camera and process that
    mpeg-4 stream (i know there are some problems in JMF and mpeg4) and show it over applet of JFrame.
    IP is 172.25.35.22
    Edited by: alchemist on Jul 16, 2008 6:09 AM

  • Crop image using 2 clicked points on image.

    HI,
     I want to crop an image  based on 2 clicked points.
    For ex:
    this is an image to be crop:
    take 1st click point as center and 2nd click point as radius and crop that part as square and forms new image.
    And new image should be something like this:
     This is what I want.
    I have done getting center point using code below:
    OpenFileDialog op = new OpenFileDialog();
    ImageBrush ib = new ImageBrush();
    private void Image_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
    op.Title = "Select a picture";
    op.Filter = "All supported graphics|*.jpg;*.jpeg;*.png|" +
    "JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|" +
    "Portable Network Graphic (*.png)|*.png";
    if (op.ShowDialog() == true)
    imgBackground.Source = new BitmapImage(new Uri(op.FileName));
    private BitmapSource CutImage(BitmapImage img, Point p1, int width, int height)
    return new CroppedBitmap(img, new Int32Rect(Convert.ToInt32(p1.X), Convert.ToInt32(p1.Y), width, height));
    double xAxis = 0.00;
    double yAxis = 0.00;
    private void imgBackground_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    Point center = e.GetPosition(imgBackground);
    Point border = e.GetPosition(imgBackground);
    xAxis = center.X;
    yAxis = center.Y;
    ib.ImageSource = CutImage(new BitmapImage(new Uri(op.FileName)), new Point(xAxis, yAxis), 300, 300);
    CanvasPanel.Background = ib;
    XAML code:
    <Button Height="70" Width="70" Margin="6,1,892,929" Name="btnBrowseImage">
    <Image x:Name="browseIcon" Source="D:\WPF\Projects\TabControlVRI_18_12_2014\Images\img.png" MouseLeftButtonDown="Image_MouseLeftButtonDown_1"/>
    </Button>
    <Image Name="imgBackground" HorizontalAlignment="Center" VerticalAlignment="Center" Height="799" Width="799" MouseLeftButtonDown="imgBackground_MouseLeftButtonDown" Stretch="Uniform">
    </Image>
    I hope now question is understandable.
    Plz, suggest me the way to get this.
    Regards,
    Viswa.

    Hi,
    I want to do in WPF coding.
    I need to add that cropped image as background to canvas in WPF.
    User have to select image and he wants to crop image using 2 points then it has to reflect as background to canvas.

Maybe you are looking for

  • PR and G/L & WBS problem

    Hi, I am doing me51n to create a PR against a project, i have put these fields in: item acct. assignment category material plant storage location quantity WBS element G/L account i am getting this error: G/L account 400005 cannot be used (please corr

  • Unique instance names in distributed environment

    The 11.1.2.1 installation guide (http://download.oracle.com/docs/cd/E17236_01/epm.1112/epm_install_11121.pdf) says, on page 122 of the .pdf: +"When you configure in a distributed environment, provide a new, unique instance name as you configure each

  • TS4062 I have the latest iTunes update and can't sync my iPhone 5 with Windows 8.1.  iTunes not showing my device is connected.

    I recently updated from Windows 8 to 8.1.  Now I can't sync my iPhone 5.  I have the latest version of iTunes and my phone is updated as well.  It worked fine with Windows 8.  Now iTunes doesn't show my phone when it's connected. My computer does rec

  • A Challenge

    Here's a challenge for those of you running ZCM. How about a report that shows those machines with NO AV installed on them? (yes i'm being lazy - just wondered if anyone else had already written one)

  • What is this invisible files??

    Hey there I've just switched to MacBook a couple of months ago and every day past I find more and more trouble that cant find anyone to answer it!! 1. What is there file ._FILENAME.EXT or ._TRASH or ._FLODERNAME ?? you won't see them in Mac OS nut wh