Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Help on streaming audio data with JMF !!

Posted on 1997-10-22
3
Medium Priority
?
1,713 Views
Last Modified: 2008-03-06
We are simulating an Audio Conferencing System in java.
We are using java native methods to capture audio samples. We want to send these samples through Sockets (TCP/IP or UDP) while it is being captured, and play it using JMF player at the other end. But JMF player requires URL (of audio ) to be specified to play it.We want to know whether JMF supports playing audio samples from inputstream of a Socket.
     

Thanking You,

ECS Development Team
DSQ S/W Ltd, Chennai,
India.

0
Comment
Question by:ecsdsq
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
rembo earned 210 total points
ID: 1229377

You can't actually do this directly because the only
two constructors for MediaLocators are URLs and
Strings.  However, you could be sneaky about it.  

You could subclass URL and create:

public class MyURL extends URL
{
  Socket s;
  //In your constructor, set up your socket connection
  //
  public MyURL(String host, int port)
  {
    s = new Socket(host, port);
  }

  // Then you just need to override the openStream()
  // method since this is most likely the only one that
  // will get used.  If you get errors from other methods
  // go ahead and implement those.  This is not the cleanest
  // solution, but it should work.

// Hope that helps,


-Tony

0
 

Author Comment

by:ecsdsq
ID: 1229378

Thanks for your  answer.

Actuallly we have done creating new URL and implemented openStream() and it is working fine.

But the problem is while sending wav samples it needs wav header,
in which we need to specify the file length( wave file size)which is unknown while we are recording online. If we specify some size
say 1MB, it accepts only 1MB of samples and plays. It is not accepting the rest of the samples that we are sending continuously. Is it possible to send the wave header without specifying the file length or whether we can specify the  
file length as unknown.

Thanking You

Regards
ECS Team Members
DSQ Software Ltd.,
Chennai - 35
India.
0
 
LVL 4

Expert Comment

by:rembo
ID: 1229379

I do not believe there is a way to specify that the
filesize is unknown, but you could set it to an
arbitrarily large number, say 1GB.  Then, since you've
overriden your URL class, you can send a stop to the
player when you've reached the end of your Stream.

-Tony

0

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question