# Problem with soundObject with Video.... please help!

**URL:** https://forum.kirupa.com/t/problem-with-soundobject-with-video-please-help/232885
**Category:** flash
**Created:** [July 18, 2007, 2:54pm UTC](https://forum.kirupa.com/t/problem-with-soundobject-with-video-please-help/232885 "2007-07-18T14:54:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![hyperhappy](https://avatars.discourse-cdn.com/v4/letter/h/b5e925/32.png) [@hyperhappy](https://forum.kirupa.com/u/hyperhappy)
#### Post date: [July 18, 2007, 2:54pm UTC](https://forum.kirupa.com/t/problem-with-soundobject-with-video-please-help/232885/1 "2007-07-18T14:54:01Z")

</div>

hi guys,

I created a FLV player that worked pretty well (play, pause, audio controls, scrubber). However, I implemented the dynamic bandwidth detection ([http://www.adobe.com/devnet/flashcom/articles/flvideo\_bandwidth.html](http://www.adobe.com/devnet/flashcom/articles/flvideo_bandwidth.html)) and had to make a few tweaks to my player but now my audio controls don’t work and neither does my scrubber! Here’s the code I am using to connect to the stream:

=======

nc = new NetConnection();  
nc.onStatus = function(info) {  
trace("Level: “+info.level+” Code: “+info.code);  
if (info.code == “NetConnection.Connect.Success”) {  
trace(”— connected to: " + this.uri);  
initStream();  
}  
};  
nc.connect(“rtmp://…”); // URL to stream

initStream = function(){  
if(detected\_bw \>= 256){  
useVideo = “256kbps\_Stream”;  
bufferlength = 2;  
} else if (detected\_bw \<256 && detected\_bw \>=100){  
useVideo = “100kbps\_Stream”;  
bufferlength = 3;  
} else {  
// bandwidth is too low, you best alert the user at this stage or load an alternative, very low bandwidth clip  
trace(“bandwidth too low”);  
// take action here  
}  
// create a netstream  
ns = new NetStream(nc);  
// optional onStatus handler  
ns.onStatus = function(info) {  
trace("Level: " + info.level + " Code: " + info.code);  
};  
ns.setBufferTime(bufferlength);  
// attach the Netstream to a video object called videoDisplay on stage  
videoDisplay.attachVideo(ns);  
ns.connect(useVideo);  
}  
stop();

======

Here’s the code I am using to control the audio (which isn’t working now):

\_root.createEmptyMovieClip(“vSound”, \_root.getNextHighestDepth());  
vSound.attachAudio(ns);  
var so:Sound = new Sound(vSound);

so.setVolume(50);  
volBarsOver\_mc.gotoAndStop(6);

// unmute button action  
unmute.onPress = function() {  
so.setVolume(50);  
volBarsOver\_mc.gotoAndStop(6);  
mute.\_visible = true;  
this.\_visible = false;  
};

// mute button actionv  
mute.onPress = function() {  
so.setVolume(0);  
volBarsOver\_mc.gotoAndStop(1);  
unmute.\_visible = true;  
this.\_visible = false;  
};

======

ANY help would be greatly appreciated as I am confused as to why it stopped working…!!!

THANK YOU! THANK YOU! THANK YOU!
