# Buffering in AS3

**URL:** <https://community.wowza.com/t/buffering-in-as3/303>\
**Category:** Wowza Streaming Engine\
**Created:** [April 14, 2008, 8:05am UTC](https://community.wowza.com/t/buffering-in-as3/303 "2008-04-14T08:05:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/system/32/447_2.png) [@system](https://community.wowza.com/u/system)\
**Post date:** [April 14, 2008, 8:05am UTC](https://community.wowza.com/t/buffering-in-as3/303/1 "2008-04-14T08:05:20Z")

</div>

Hello,

I got my application to record video fine (using AS3) but when I play back my recorded stream plays too choppy. If I add buffering to my code would this help it? I check out the recording sample but it’s written in AS2 and the buffering commands don’t work in AS3. Can anyone please give me pointers as to how to add buffering or what can I do so that I get a better flow on my recorded stream?

Thanks for your help,

Louis

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [April 14, 2008, 10:36am UTC](https://community.wowza.com/t/buffering-in-as3/303/2 "2008-04-14T10:36:37Z")

</div>

Louis,

Here is how to set buffer in AS3:

```auto
nsPlay.bufferTime=1;

```

But also look at the streamType in the wowza\_install/conf/yourapp/Application.xml file. Try “record”, or “live-record”, or “live-record-lowlatency”.

Richard

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [April 15, 2008, 6:35am UTC](https://community.wowza.com/t/buffering-in-as3/303/3 "2008-04-15T06:35:10Z")

</div>

I suggest you use our VideoRecording example as a starting point for your code. When you use a client side buffer you need to properly close the stream when the recording stops. This post describes the process:

[https://www.wowza.com/forums/showpost.php?p=2513&postcount=2](https://www.wowza.com/forums/showpost.php?p=2513&postcount=2)

Charlie

---

<div class="post-metadata">

**Author:** ![Louis\_Castro](https://avatars.discourse-cdn.com/v4/letter/l/eb9ed0/32.png) [@Louis\_Castro](https://community.wowza.com/u/Louis_Castro)\
**Post date:** [April 15, 2008, 2:04am UTC](https://community.wowza.com/t/buffering-in-as3/303/4 "2008-04-15T02:04:03Z")

</div>

Thanks Richard,

I have tried these settings for Recording (AS3):

```auto
cam.setMode(320, 240, 30, false);
cam.setQuality(0,88);
cam.setKeyFrameInterval(10);
mic.rate = 11;

```

Play Button:

```auto
ns.play(StreamName);
ns.pause();
ns.resume();

```

Record Button:

```auto
vid_screen.attachCamera(cam);
ns.close();
ns = new NetStream(nc);
ns.client = client;
ns.attachCamera(cam);
ns.bufferTime = 2;
ns.attachAudio(mic);

```

I have played with the bufferTime ranging from .1 to 100 and it doesn’t make a difference. Am I not using bufferTime correctly? It records better without the buffering, but my recording still not smooth it looks like it plays and stops, although the sound plays just perfect even when the video stops and goes. I am using AS3. It seams that buffering is handled different in AS3 than AS2.

What can I do, please help,

Thanks again,

Louis

---

<div class="post-metadata">

**Author:** ![Louis\_Castro](https://avatars.discourse-cdn.com/v4/letter/l/eb9ed0/32.png) [@Louis\_Castro](https://community.wowza.com/u/Louis_Castro)\
**Post date:** [April 16, 2008, 7:29am UTC](https://community.wowza.com/t/buffering-in-as3/303/5 "2008-04-16T07:29:51Z")

</div>

Thanks Charlie,

I finally got the buffering to work on AS3.

One more question. Is there a chart that will tell me at how many seconds to set the buffer depending on the connection speed etc.

Louis
