MACROMEDIA FLASH COMMUNICATION SERVER MX-SERVER-SIDE COMMUNICATION ACTIONSCRIPT DICTIONARY Specifikace Strana 151

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 369
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 150
Application Development Tips and Tricks 73
In the following client-side ActionScript code in doc_thumbnails.fla, the server records the
incoming stream until the user chooses to stop the recording. Then, with the call to
thumb_ns.play("myRecording", 0, 0, true), only the first frame of that recording is
returned to the client.
#include "NetDebug.as"
stop();
// Recording state variable
recState = 0;
// Initialize button label
Record_btn.setLabel("Record");
// Show the recording in a thumbnail
showThumb();
// Connect to the thumbnails app and get connection status
function doConnect()
{
client_nc = new NetConnection();
// If connection is closed, clear the History and the list
// Handle status message
client_nc.onStatus = function(info) {
trace("Level: " + info.level + newline + "Code: " + info.code);
}
client_nc.connect("rtmp:/doc_thumbnails/room_01");
}
// Create a stream for recording and getting the thumbnail
function initStreams()
{
out_ns = new NetStream(client_nc);
out_ns.onStatus = function(info)
{
if (info.code == "NetStream.Publish.Success") {
var description = "You have published.";
trace(description);
}
};
thumb_ns = new NetStream(client_nc);
}
// Get a camera instance and attach it to the local
// video, Live_video, and the output stream
function initMovie()
{
client_cam = Camera.get();
Live_video.attachVideo(client_cam);
out_ns.attachVideo(client_cam);
}
// Button event handler for publishing and showing the thumbnail
function doRecord()
{
if (recState == 0) {
Zobrazit stránku 150
1 2 ... 146 147 148 149 150 151 152 153 154 155 156 ... 368 369

Komentáře k této Příručce

Žádné komentáře