Solved

Help on streaming audio data with JMF !!

Posted on 1997-10-22
3
1,670 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
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
rembo earned 70 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
allswap challenge 6 79
Problem to start Neon 20 87
HTTPSessionBindingListernter not configured in deployment descriptor 2 38
factorial example 4 35
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now