I need to play multiple (66) synchronized .flv videos in flash. What I do:
I create a new NetConnection (one for all NetStreams)
var connection: NetConnection,
clipper: MovieClip;
connection = new NetConnection();
connection.connect(null);
I have a function to create all the netstream
function addCamera(id, url, pos_x, pos_y) {
var player: Video = new Video(stageSize.x, stageSize.y),
stream: NetStream,
clip: MovieClip;
clip = new MovieClip();
stage.addChildAt(clip, 0)
stream = new NetStream(connection);
stream.client = this;
clip.addChild(player);
player.attachNetStream(stream);
stream.bufferTime = 1;
stream.receiveAudio(false);
stream.receiveVideo(true);
stream.inBufferSeek = true;
stream.play(url)
player.visible = false;
if (!camera[pos_x]) {
camera[pos_x] = [];
trace("new camera row:" + pos_x.toString());
planeSize[0] = planeSize[0] + 1;
}
trace("new camera: [" + pos_x.toString() + ", " + pos_y.toString() + "]");
camera[pos_x][pos_y] = {
"stream": stream,
"player": player,
"pos_x": pos_x,
"pos_y": pos_y,
"buffered": false,
"buffer": 0,
"id": id
}
Only one video is visible at a time:
camera[currentCamera[0]][currentCamera[1]].player.visible = true;
(rest has .visible=false
)
This works great for new computers, but on older ones it's a nightmare. Is it possible to have the hidden videos keep their timestamps going on, but for the flash not to render them?
Also, when I seek:
function seekTo(time) {
trace("Seek to: " + time.toString());
for each(var pos_x in camera) {
for each(var curCamera in pos_x) {
seeking = true;
curCamera.stream.seek(time);
}
}
}
it takes a while.