Solved

Help on streaming audio data with JMF !!

Posted on 1997-10-22
3
1,683 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
javap bin 2 41
How  Can  I  resolve   this  Error "java.sql.SQLException: Invalid column index" 4 49
ejb entity bean example 2 17
ejb entity bean example issue 2 18
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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
The viewer will learn how to implement Singleton Design Pattern in Java.

807 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