
124
SERVER-SIDE ACTIONSCRIPT LANGUAGE REFERENCE FOR ADOBE MEDIA SERVER 5.0.1
Server-Side ActionScript Language Reference
Last updated 7/2/2013
Example
ns = new NetStream(nc);
ns.onStatus = function(info){
if (info.code == "NetStream.Publish.Start"){
trace("It is now publishing");
}
ns.publish("foo", "live");
}
NetStream.publish()
ns.publish(name, howToPublish)
Publishes a stream to a remote server. Check the status in the NetStream.onStatus() handler to make sure that the
remote server has accepted the publisher. If the stream has been published by another client, the
publish() call can
fail when it reaches the remote server. In this case, the remote server sends a status message of
"NetStream.Publish.BadName" to the NetStream.onStatus() method.
Availability
Flash Media Server 3
Parameters
name A string identifying the stream to publish. If you pass false, the stream stops publishing. Use the following
syntax:
howToPublish An optional string specifying how to publish the stream. Valid values are "record", "append",
"appendWithGap", and "live". The default value is "live". If you omit this parameter or pass "live", live data is
published but not recorded. If a file with this name already exists on the remote server, it is deleted.
Note: If the file is read-only, live data is published and the file is not deleted.
If you pass "record", the stream is published and the data is recorded to a new file. If the file exists, it is overwritten.
If you pass
"append", the stream is published and the data is appended to the existing stream specified by name. If no
file is found, it is created.
"NetStream.Record.Start" "status" Recording was started.
"NetStream.Record.Stop" "status" Recording was stopped.
"NetStream.Unpublish.Success" "status" An attempt to stop publishing a stream was successful.
File format Syntax
FLV ns.publish("filename")
MP3 ns.publish("mp3:filename")
ns.publish("id3:filename")
MP4 ns.publish("mp4:filename")
ns.publish("mp4:filename.mp4")
ns.publish("mp4:filename.f4v")
Code property Level property Description
Commenti su questo manuale