[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Sending Audio to a Server Using NetStream (or similar) in Flex (not Mic or webcam)

Posted on 2010-01-03
4
Medium Priority
?
1,419 Views
Last Modified: 2012-05-08
Hi,

I am trying to ascertain if it is possible to stream audio to a server using NetStream in the same way you can with a microphone.

To clarify I know how to send webcam or microphone content (using AttachAudio and AttachVideo).  What I am trying to achieve is have a button in the flex app to play a soundfile and have that sound file streamed to the server.

I can't find any way of doing it currently and am hoping someone might know a workaround.

Oli

0
Comment
Question by:olifarago
  • 2
  • 2
4 Comments
 
LVL 14

Expert Comment

by:TanLiHao
ID: 26168740
It's possible, just call the publish method of your NetStream instance without calling attachAudio.
0
 
LVL 9

Author Comment

by:olifarago
ID: 26170300
And what will that transmit over the stream?
0
 
LVL 14

Accepted Solution

by:
TanLiHao earned 2000 total points
ID: 26177420
It will still be Audio.

Look at the example below using attachAudio

var conn:NetConnection = new NetConnection();
     conn.connect("rtmp://server.domain.com/path");
     var stream:NetStream = new NetStream(conn);
     var live_mic:Microphone = Microphone.get();
     live_mic.rate = 8;
     live_mic.setSilenceLevel(20,200);
     var soundTrans:SoundTransform = new SoundTransform();
     soundTrans.volume = 6;
     live_mic.soundTransform = soundTrans;
     stream.attachAudio(live_mic);
     stream.publish("mic_stream","live");


See how the attaching of the mic allows you to use the mic as an audio with a name of mic_stream.

Therefore if you want to publish normal audio, you need to give your audio a name and attach it. However, the thing is how would the publish method know you are publishing audio?

So here's another example demonstrating how you should do it.

Given audio id is :sample_music.mp3

Then the code would be like this:

var conn:NetConnection = new NetConnection();
     conn.connect("rtmp://server.domain.com/path");
     var stream:NetStream = new NetStream(conn);
     stream.publish("mp3:sample_music","live");
0
 
LVL 9

Author Closing Comment

by:olifarago
ID: 31672113
I have had to abandon this project for now so this is untested.  I thought this solution starts on demand streaming an MP3 that is stored on a server to the client over the netstream but the answer is suggesting it will stream form the client to the server.

I don't have time to test so I have accepted in case it is useful for others.
0

Featured Post

New Tabletop Appliances Blow Competitors Away!

WatchGuard’s new T15, T35 and T55 tabletop UTMs provide the highest-performing security inspection in their class, allowing users at small offices, home offices and distributed enterprises to experience blazing-fast Internet speeds without sacrificing enterprise-grade security.

Question has a verified solution.

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

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
Currently, there is an issue with being able to copy values from an external application to a dropdown list in Project Web Access (PWA).  The standard copy and paste methods don't seem to work properly. Here is a way to accomplish this task to s…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month19 days, 7 hours left to enroll

872 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