-
Just wondering if anyone has set up the comm server to stream just audio... no video. How is this different from the video method? Any suggestions would be much appreciated.
-
Hey -
It's definitely doable - both use the netStream object. It's roughly the same as doing video:
Code:
function init() {
// create NetConnection object
connection = new NetConnection();
// connect to server
connection.connect("rtmp:/my_app");
myMic = Microphone.get();
};
init();
//Broadcast
function BroadCast() {
inStream.close();
outStream = new NetStream(connection);
outStream.attachAudio(myMic);
outStream.publish("MyAudio","live");
}
function stopBroadCast() {
outStream.publish(false);
outStream.close();
}
//Listening
function Listen() {
//Audio
inStream = new NetStream(connection);
inStream.receiveAudio(true);
inStream.play("MyAudio");
}
That should get you going - You'll probably want 2 files - the first being the broadcaster, and would include the "init", "broadcast", and "stopBroadcast" functions. The second file would need just the "init" and "Listen" functions I believe. A few changes would be needed in init, basically you don't need to attach a mic.
Psx
-
What I am trying to do won't be in real time... Just sort of a re-broadcast of a previously recorded audio piece. What format would this audio need to be in? FLV? SWF? or can it handle mp3?
-
Danny Gomez Creations ®
to record a stream, simply replace the "live" in:
Code:
outStream.publish("MyAudio","live");
to:
Code:
outStream.publish("MyAudio","record");
the filename will be saved as "MyAudio.flv" in a streams folder. I read somewhere in the macromedia site that the streams could be saved as a mp3 instead, however I havent found any instructions for such thing...
Oh, and if you dont want to be replacing the file , you should store a variable on a shared object and add that as the filename. Something like:
Code:
var recordnum=mysharedObject_so.data.amount;
//after user selects recording
recordnum=recordnum+1;
mysharedObject_so.data.amount=recordnum;
outStream.publish("MyAudio"+recordnum,"record");
this is not a great copy/paste code like john's but it might give u an idea or something. A similar solution is found among the sample apps
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|