/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * VideoStreamingform.java
 *
 * Created on 29 Mar, 2011, 7:01:42 PM
 */

package audivideotransmit;

import javax.media.MediaLocator;
import javax.swing.JOptionPane;

/**
 *
 * @author ajay
 */
public class VideoStreamingform extends javax.swing.JFrame {
    String sourcevideo,ipvideo,portvideo;
    VideoTransmit at;

  


    private void port3ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }

    private void audiostreamActionPerformed(java.awt.event.ActionEvent evt) {
    //end.enable(true);
    try
    {
    sourcevideo=this.src3.getText();
    }
    catch(Exception e)
    {
     JOptionPane.showMessageDialog(this,"Bad Source","Error",JOptionPane.ERROR_MESSAGE);
     return;
    }
    try
    {
    ipvideo=this.ip3.getText();
    }
    catch(Exception e)
    {
     JOptionPane.showMessageDialog(this,"Bad IP","Error",JOptionPane.ERROR_MESSAGE);
     return;
    }
    try
    {
    portvideo=this.port3.getText();
    }
    catch(Exception e)
    {
     JOptionPane.showMessageDialog(this,"Bad Port","Error",JOptionPane.ERROR_MESSAGE);
     return;
    }
    VideoTransmit at = new VideoTransmit(new MediaLocator(sourcevideo),
                ipvideo,
                portvideo);
    
 String result = at.start();
 if (result != null) {
            System.err.println("Error : " + result);
            System.exit(0);
        }

        System.err.println("Start transmission for 60 seconds...");


        try {
            Thread.currentThread().sleep(60000);
        } catch (InterruptedException ie) {
        }

        // Stop the transmission
        at.stop();

        System.err.println("...transmission ended.");

        System.exit(0);


    }

    private void endActionPerformed(java.awt.event.ActionEvent evt) {
    at.stop();
    }

    

    /**
    * @param args the command line arguments
    */
   

    

}

The problem is that I need to call at.stop() on end button action. Where to define the object at(Videostream) so that I can call it in endActionPerformed? I have not included all the code.
please help me..
thanks.

On line 61, you are defining a local version of "VideoTransmit" that eclipses the one you declared on line 23. Just state:

at = new VideoTransmit(new MediaLocator(sourcevideo),
                ipvideo,
                portvideo);

and it will use the variable you declared on line 23.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.