
Chapter 472
} else {
// Stop publishing recorded stream
out_ns.publish(false);
// Close the stream so that we can use the same to publish again
out_ns.close();
// Set the label to "Record"
Record_btn.setLabel("Record");
// Update the recording state
RecState_box.text = 0;
showSnapshot();
}
}
// Show the snapshot by attaching the stream to the SnapView_video
// video object and playing it
function showSnapshot() {
// Create a new movie clip from the exportable movie clip View_mc,
// which contains a video object, SnapView_video. Provide a new name, and
// depth (a number relative to the other View_mcs on the stage used
// to prevent collision)
_root.attachMovie("View_mc", "Snapshot_mc", numSnaps);
// Attach the input stream to the SnapView_video video object
// in the v instance of the View_mc movie
Snapshot_mc.SnapView_video.attachVideo(in_ns);
Snapshot_mc._x=375;
Snapshot_mc._y=225;
// Play the recording
in_ns.play("myRecording"+numSnaps);
// Update the counter for the number of snapshots for next time.
numSnaps++;
}
// Connect to the server
doConnect();
// Initialize the streams
initStreams();
Thumbnails
Thumbnails are a smaller, discrete version of an original recording. Like snapshots, they provide
single-frame representations of recorded video stream. In the snapshot example, you are only
sending one frame of data. In this sample, you are playing only the first frame of a recorded
stream.
In the previous example, you used the snapShotMilliseconds property of the
NetStream.attachVideo object to get a snapshot of your stream. In this sample, you also need
to get a one frame picture of a stream. Here, however, you use a call to
NetStream.play:
thumbStream.play("myRecording", 0, 0, true)
If you look at the NetStream.play entry in the Client-Side Communication ActionScript
Dictionary, you can see that the first parameter describes what to play,
"myRecording"; while the
second is where to begin on the stream (0 means at the start of a recorded stream); the third,
where to end (0 means play only one frame); and the fourth tells the Player to flush any previous
play streams.
Commentaires sur ces manuels