Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change the sound volume of a live stream

I have something like this:

private var myVideo:Video;
public var videoDisplay:UIComponent;
...
videoDisplay.addChild(myVideo);
...
nsPlay = new NetStream(nc);
nsPlay.addEventListener(NetStatusEvent.NET_STATUS, nsPlayOnStatus);
nsPlay.bufferTime = 0;
nsPlay.play(pro);
myVideo.attachNetStream(nsPlay);

anybody knows how can I change the volume of this stream, I would like to bind the volume to a slider

like image 345
Omu Avatar asked Apr 20 '10 06:04

Omu


2 Answers

Use the NetStream::SoundTransform property.

nsPlay.soundTransform.volume = slider.value;

To bind the value of slider to the volume:

BindingUtils.bindProperty(nsPlay.soundTransform, "volume", slider, "value");

Set the slider range as 0 to 1

like image 120
Amarghosh Avatar answered Sep 29 '22 12:09

Amarghosh


Use the property soundTransform of the NetStream Object:

var st:SoundTransform=nsPlay.soundTransform;
st.volume=0.5; // 50% volume
nsPlay.soundTransform=st;
like image 45
Patrick Avatar answered Sep 29 '22 11:09

Patrick