Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8601777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:55:22+00:00 2026-06-12T01:55:22+00:00

I’m working on a project that needs to implement live video streaming from webcam

  • 0

I’m working on a project that needs to implement live video streaming from webcam on server into applet on remote client.

I have a code for capturing live stream from webcam through JMF on server & deploy streaming on rtp & an applet that receive streaming from the rtp address then play it into it.

But the problem that it’s only working within my own pc (server) & doesn’t work over local network (it loads applet but doesn’t run the video player).

Server Code:

public class Streaming_Server {

    /**
     * @param args the command line arguments
     */
    private static String PORT = "10000";
    private static InetAddress addr;
    static final Format[] FORMATS = { new VideoFormat("rgb") };
    static final ContentDescriptor CONTENT_DESCRIPTOR = new ContentDescriptor("raw.rtp");

    public static void main(String[] args) throws IOException, NoDataSourceException, NoProcessorException, CannotRealizeException, NoDataSinkException {
        // TODO code application logic here
        try
        {
            addr = InetAddress.getLocalHost();
            String ipAddr = addr.getHostAddress();
            String hostname = addr.getHostName();
            System.out.println("Your IP is " + ipAddr);
            System.out.println("Your Host Name is " + hostname);
        }
        catch (UnknownHostException e){}


        CaptureDeviceInfo webcamInfooo = new CaptureDeviceInfo("Camera", new MediaLocator("vfw://0"), null);
        MediaLocator camDeviceMediaLocator = webcamInfooo.getLocator();
        DataSource source = Manager.createDataSource(camDeviceMediaLocator);
        Processor mediaProcessor = Manager.createRealizedProcessor(new ProcessorModel(source, FORMATS, CONTENT_DESCRIPTOR));
        //MediaLocator outputMediaLocator = new MediaLocator("rtp://" + addr.getHostAddress() + ":" + PORT + "/video");
        MediaLocator outputMediaLocator = new MediaLocator("rtp://192.168.1.4:20000/video");
        DataSink dataSink = Manager.createDataSink(mediaProcessor.getDataOutput(), outputMediaLocator);

        mediaProcessor.start();
        dataSink.open();
        dataSink.start();
    }
}

Client Code:

public class Streaming_Client extends Applet implements ControllerListener {

    /**
     * Initialization method that will be called after the applet is loaded into
     * the browser.
     */
    Player player = null;
    private MediaLocator mediaLocator;
    private static String PORT = "10000";
    private static InetAddress addr;

    public void init() {
        // TODO start asynchronous download of heavy resources
        //mediaLocator = new MediaLocator("rtp:/192.168.1.4:10000/video");
        mediaLocator = new MediaLocator("rtp:/192.168.1.4:20000/video");
        setLayout(new BorderLayout());
        try {
            player = Manager.createPlayer(mediaLocator);
            player.addControllerListener(this);
        } catch (IOException | NoPlayerException ex) {
            Logger.getLogger(Streaming_Client.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void start(){
        player.start();
    }

    public void stop(){
        player.stop();
        player.deallocate();
    }

    public void destroy(){
        player.close();
    }
    // TODO overwrite start(), stop() and destroy() methods

    @Override
    public void controllerUpdate(ControllerEvent ce) {
        if ((ce instanceof RealizeCompleteEvent))
        {
        Component comp;
        if ((comp = this.player.getVisualComponent()) != null)
            add("Center", comp);
        if ((comp = this.player.getControlPanelComponent()) != null)
            add("South", comp);
        validate();
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T01:55:23+00:00Added an answer on June 12, 2026 at 1:55 am

    After some research, i found that MediaLocator in server takes the Destination IP not the source one.

    It’s an annoying thing as you must know where you are streaming.

    So, after this edit..

    CaptureDeviceInfo webcamInfooo = new CaptureDeviceInfo("Camera", new MediaLocator("vfw://0"), null);
    MediaLocator camDeviceMediaLocator = webcamInfooo.getLocator();
    DataSource source = Manager.createDataSource(camDeviceMediaLocator);
    Processor mediaProcessor = Manager.createRealizedProcessor(new ProcessorModel(source, FORMATS, CONTENT_DESCRIPTOR));
    //MediaLocator outputMediaLocator = new MediaLocator("rtp://" + addr.getHostAddress() + ":" + PORT + "/video");
    MediaLocator outputMediaLocator = new MediaLocator("rtp://192.168.1.6:20000/video");
    DataSink dataSink = Manager.createDataSink(mediaProcessor.getDataOutput(), outputMediaLocator);
    

    i can stream live video capturing from 192.168.1.4 to 192.168.1.6 over Intranet only.

    but i can’t find till now how to stream over internet as i must assign remote pc ip.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.