Skip to main content
June 5, 2006
Question

Streaming audio volume level

  • June 5, 2006
  • 1 reply
  • 287 views
Hi,
How could I change volume level for streaming FLV file by actionscript?


Here is my code:

/////

function initStreams() {
client_nc = new NetConnection();
client_nc.connect(rtmpServerPath);
client_nc.onStatus = function(info) {
trace("audio Level: " + info.level + " Code: " + info.code);
}
myAudio= new NetStream(client_nc);
}
initStreams();

myAudio.play(fileName);

/////

Can I do it without FLVPlayback component?
The way I am trying to do it now : voiceOver.setVolume(50) does not work.

Thanks you.
    This topic has been closed for replies.

    1 reply

    June 6, 2006
    I've found the best way to do it is to attach the sound to a movie clip, and create a sound object to control the volume:

    createEmptyMovieClip("audio_mc", this.getNextHighestDepth());
    myAudio= new NetStream(client_nc);
    myAudio.play(fileName);
    soundControl = new Sound(audio_mc);
    audio_mc.attachAudio(myAudio);

    Now just call setVolume on the soundConrol object.

    You could just attach the stream audio to the sound object (without using a movieClip), but that would affect all of the sound in the movie... instead of just the stream you want to control.

    I've heard reports of audio and video getting out of sync when using a movieClip to manage the volume, but I haven't experienced it myself.
    June 6, 2006
    Works great!
    Thanks