# Play two videos - Flash Media Server

**URL:** <https://forum.kirupa.com/t/play-two-videos-flash-media-server/325711>\
**Category:** flash\
**Created:** [November 1, 2011, 1:08pm UTC](https://forum.kirupa.com/t/play-two-videos-flash-media-server/325711 "2011-11-01T13:08:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![black\_pearl](https://avatars.discourse-cdn.com/v4/letter/b/aeb1de/32.png) [@black\_pearl](https://forum.kirupa.com/u/black_pearl)\
**Post date:** [November 1, 2011, 1:08pm UTC](https://forum.kirupa.com/t/play-two-videos-flash-media-server/325711/1 "2011-11-01T13:08:12Z")

</div>

Hi,  
I am working on a karaoke project where there are two video screens.

The first one shows karaoke video and the second one records users video  
I have successfully recorded users video but when I try to play back the recorded video it does not work properly when I am testing online

When I work in local server, it is working fine. But when I see this online, the two videos don’t synchronize properly. I guess, there is some issue with buffering video.

Here is my code

```auto
var RTMP:String = "rtmp://localhost/salim/samples";

var first_nc:NetConnection = new NetConnection();
first_nc.connect(RTMP);
var first_ns:NetStream = new NetStream(first_nc);

myVideo1.attachVideo(first_ns);
first_ns.setBufferTime(20);
first_ns.play("karaoke");
first_ns.pause();

var second_nc:NetConnection = new NetConnection();
second_nc.connect(RTMP);
var second_ns:NetStream = new NetStream(second_nc);

myVideo2.attachVideo(second_ns);
second_ns.setBufferTime(20);
second_ns.play("recorded");
second_ns.pause();

playVideo_mc.onRelease = function(){
    first_ns.pause();
    second_ns.pause();
}

```

I was thinking to preload both the videos and then start playing when say after 20% loaded. But I don’t know how to preload a streaming video.

I will highly appreciate any suggestions.

Thanks
