When FMLE stopped,Remote RTMP stream to FMS 4.5 with rtmfp?

When FMLE stopped,Remote RTMP stream to FMS 4.5 with rtmfp?
edit  "applications/multicast/main.asc" ?
HELP ME !!! THANKS!!!
* File: main.asc
* The server-side portion of the multicast sample application.
* This app accepts publish and unpublish requests from FMLE, and republishes
* the live stream from FMLE into a target Flash Group.
// General Constants
// "Constants" representing multicast event types.
var TYPE_FUSION = 1;
var TYPE_IP = 2;
var TYPE_P2P = 3;
// StreamContext Description, Constants and Functions
* Type: StreamContext
* This application tracks the context for live streams published to the server
* that are being republished into a Flash Group. The StreamContext "type" used
* for this is just an Object containing the following members:
*   client         - The encoding/publishing client.
*   streamName     - The source Stream name as published by the client.
*   type           - The multicast event type.
*   groupspec      - The groupspec identifying the Flash Group and capabilities.
*   address        - IP multicast address (optional for pure P2P events).
*   netConnection  - A loopback NetConnection used for the mcastNetStream.
*   mcastNetStream - The NetStream used to republish the source Stream into
*                    the Flash Group.
*   netGroup       - An (optional) NetGroup handle for the target Group.
*                    Only present for Fusion or P2P events.
*   state          - One of the state constants defined immediately below
*                    this comment.
var STATE_INIT            = 0; // Starting state for a StreamContext.
var STATE_CONNECTING      = 1; // Establishing loop-back connection.
var STATE_CONNECTED       = 2; // Connection established.
var STATE_PUBLISH_PENDING = 3; // Attempting to publish.
var STATE_REPUBLISHING    = 4; // Actively republishing to multicast.
var STATE_UNPUBLISHING    = 5; // Shutting down multicast republish.
var STATE_UNPUBLISHED     = 6; // Unpublished successfully.
var STATE_DISCONNECTING   = 7; // Shutting down loopback connection.
var STATE_DISCONNECTED    = 8; // Connection shut down. Done.
* Registers a source Stream published by the specified client, along with the
* context for the multicast event, as a StreamContext Object.
* @param client - The Client publishing the stream.
* @param streamName - The source Stream name.
* @param params - The parameters resulting from parsing the source Stream's
*                 query string.
* @return The new StreamContext Object for the registered Stream.
function registerStream(client, streamName, params)
    var streamContext = { "client": client,
                          "streamName": streamName,
                          "type": params["fms.multicast.type"],
                          "groupspec": params["fms.multicast.groupspec"] };
if (params["fms.multicast.interface"])
  streamContext["interfaceAddress"] = params["fms.multicast.interface"];
    if (params["fms.multicast.address"])
        streamContext["address"] = params["fms.multicast.address"],
    streamContext.state = STATE_INIT;
    updateStreamContextLookups(streamContext);
    trace("Registered multicast context for source stream: " + streamName);
    return streamContext;
* Updates the indexed lookups installed for the passed StreamContext Object
* with the application.
* @param streamContext - The StreamContext Object to (re)index.
function updateStreamContextLookups(streamContext)
    application.streamTable[streamContext.streamName] = streamContext;
    if (streamContext.netConnection)
        application.netConnTable[streamContext.netConnection] = streamContext;
    if (streamContext.mcastNetStream)
        application.mcastNetStreamTable[streamContext.mcastNetStream] = streamContext;
    if (streamContext.netGroup)
        application.netGroupTable[streamContext.netGroup] = streamContext;
* Provides access to the StreamContext Object for a registered source Stream
* by name.
* @param streamName - A registered source Stream name.
* @return The associated StreamContext Object; undefined if the source Stream
*         name is not registered.
function getStreamContextForSourceStream(streamName)
    return application.streamTable[streamName];
* Provides access to the StreamContext Object for a given server-side
* NetConnection hosting a multicast NetStream.
* @param netConnection - A server-side NetConnection.
* @return The associated StreamContext Object; undefined if the passed
*         NetConnection is not indexed to a StreamContext.
function getStreamContextForNetConnection(netConnection)
    return application.netConnTable[netConnection];
* Provides access to the StreamContext Object for a given multicast NetStream.
* @param netStream - A multicast NetStream.
* @return The associated StreamContext Object; undefined if the passed
*         NetStream is not indexed to a StreamContext.
function getStreamContextForMulticastNetStream(netStream)
    return application.mcastNetStreamTable[netStream];
* Provides access to the StreamContext Object for a given NetGroup associated
* with a multicast NetStream.
* @param netGroup - A NetGroup.
* @return The associated StreamContext Object; undefined if the passed
*         NetGroup is not indexed to a StreamContext.
function getStreamContextForNetGroup(netGroup)
    return application.netGroupTable[netGroup];
* Unregisters the StreamContext from the application.
* @param streamContext - The StreamContext Object to unregister.
function unregisterStreamContext(streamContext)
    if (streamContext.netConnection)
        delete application.netConnTable[streamContext.netConnection];
    if (streamContext.mcastNetStream)
        delete application.mcastNetStreamTable[streamContext.mcastNetStream];
    if (streamContext.netGroup)
        delete application.netGroupTable[streamContext.netGroup];
    trace("Unregistered multicast context for source stream: " +
          streamContext.streamName);
// Application callback functions
* Initializes global StreamContext lookup tables.
application.onAppStart = function()
    application.streamTable = {};
    application.netConnTable = {};
    application.mcastNetStreamTable = {};
    application.netGroupTable = {};
* Handles a publish event for the application by validating the request
* and bridging the published stream into a target Flash Group. Invalid
* publish requests are ignored and the publishing client's connection
* is closed.
* @param client - The publishing client.
* @param stream - The published stream.
application.onPublish = function(client, stream)
    //trace("Handling publish request for source stream: " + stream.name);
    var params = parseQueryString(stream.publishQueryString);
    if (!validateStreamParams(params))
        application.disconnect(client);
        return;
    var prevContext = getStreamContextForSourceStream(stream.name);
    if (prevContext)
        forceCloseStreamContext(prevContext);
    // Register source Stream, and kick off the async process that will
    // eventually wire-up the associated multicast NetStream.
    var streamContext = registerStream(client, stream.name, params);
    openMulticastConnection(streamContext);
* Handles an unpublish event for the application by shutting down
* any associated multicast NetStream.
* @param client - The unpublishing client.
* @param stream - The source stream being unpublished.
application.onUnpublish = function(client, stream)
    trace("Handling unpublish request for source stream: " + stream.name);
    var streamContext = getStreamContextForSourceStream(stream.name);
    if (streamContext && (streamContext.state <= STATE_REPUBLISHING))
        destroyStreamContext(streamContext);
// Callback functions for NetConnection and multicast NetStream/NetGroup wiring.
* First step in setting up a republished multicast NetStream; open the loopback
* connection it requires.
* @param streamContext - The StreamContext Object for the publish event.
function openMulticastConnection(streamContext)
    var nc = new NetConnection();
    nc.onStatus = netConnectionStatusHandler;
    streamContext.netConnection = nc;
    updateStreamContextLookups(streamContext);
    streamContext.state = STATE_CONNECTING;
    nc.connect(resetUriProtocol(streamContext.client.uri, "rtmfp"));
* Status event handler for the loopback NetConnection used by the multicast
* NetStream. Advances setup upon successful connection, or triggers or advances
* tear-down as a result of connection loss or an unpublish and clean shutdown.
* @param info - The status info Object.
function netConnectionStatusHandler(info)
    var streamContext = getStreamContextForNetConnection(this);
    trace("Multicast NetConnection Status: " + info.code +
          (streamContext ? ", Source stream: " + streamContext.streamName : ", Not associated with a source stream."));
    if (streamContext)
        switch (info.code)
        case "NetConnection.Connect.Success":
            streamContext.state = STATE_CONNECTED;
            // If event type is Fusion or P2p, wire up a NetGroup for neighbor
            // bootstrapping and maintenance ahead of (re)publishing the stream.
            var type = streamContext.type;
            if (type == TYPE_FUSION || type == TYPE_P2P)
                initNetGroup(streamContext);
            else
                initMulticastNetStream(streamContext);
            break;
        case "NetConnection.Connect.Failed":
        case "NetConnection.Connect.Rejected":
        case "NetConnection.Connect.AppShutdown":
            trace("MULTICAST PUBLISH ERROR: Failed to establish server-side NetConnection for use by multicast NetStream. " +
                  "Status code: " + info.code + ", description: " + info.description + ", Source stream: " +
                  streamContext.streamName);
            streamContext.state = STATE_DISCONNECTED;
            destroyStreamContext(streamContext);
            break;
        case "NetConnection.Connect.Closed":
            if (streamContext.state < STATE_DISCONNECTING)
                trace("MULTICAST PUBLISH ERROR: Unexpected server-side NetConnection close. " +
                     "Status code: " + info.code + ", description: " + info.description + ", Source stream: " +
                     streamContext.streamName);
            streamContext.state = STATE_DISCONNECTED;
            destroyStreamContext(streamContext);
            break;
        default:
            // Ignore.
* Initializes the multicast NetGroup following a successful connection of its
* underlying loopback NetConnection. This hook is optional and only runs for
* event types of Fusion and pure P2P.
* @param streamContext - The StreamContext Object for the multicast publish.
function initNetGroup(streamContext)
    var ng = null;
    try
        ng = new NetGroup(streamContext.netConnection, streamContext.groupspec);
    catch (e)
        trace("MULTICAST PUBLISH ERROR: Failed to construct NetGroup. Error: "
              + e.name + (e.message ? " " + e.message : "") +
              ", Source stream: " + streamContext.streamName);
        destroyStreamContext(streamContext);
        return;
    ng.onStatus = netGroupStatusHandler;
    streamContext.netGroup = ng;
    updateStreamContextLookups(streamContext);
* Status event handler for the multicast NetGroup. Advances to initializing the
* multicast NetStream upon successful NetGroup connect. Otherwise, triggers
* shut down.
* @param info - The status info Object.
function netGroupStatusHandler(info)
    var streamContext = getStreamContextForNetGroup(this);
    trace("Multicast NetGroup Status: " + info.code +
          (streamContext ? ", Source stream: " + streamContext.streamName : ", Not associated with a source stream."))
    if (streamContext)
        switch (info.code)
        case "NetGroup.Connect.Success":
            initMulticastNetStream(streamContext);
            break;
        case "NetGroup.Connect.Failed":
        case "NetGroup.Connect.Rejected":
            trace("MULTICAST PUBLISH ERROR: Failed to connect multicast NetGroup. " +
                  "Status code: " + info.code + ", description: " + info.description +
                  ", Source stream: " + streamContext.streamName);
            destroyStreamContext(streamContext);
            break;
        case "NetGroup.MulticastStream.UnpublishNotify":
            // At this point, multicast publishers will be notified;
            // continue shut down.
            destroyStreamContext(streamContext);
            break;
        default:
            // Ignore.
* Initializes the multicast NetStream following a successful connection of its
* underlying loopback NetConnection.
* @param streamContext - The StreamContext Object for the multicast publish.
function initMulticastNetStream(streamContext)
    var ns = null;
    try
        ns = new NetStream(streamContext.netConnection, streamContext.groupspec);
    catch (e)
        trace("MULTICAST PUBLISH ERROR: Failed to construct multicast NetStream. Error: " +
              e.name + (e.message ? " " + e.message : "") +
              ", Source stream: " + streamContext.streamName);
        destroyStreamContext(streamContext);
        return;
    var type = streamContext.type;
    if (type == TYPE_FUSION || type == TYPE_IP)
  var iAddr = (streamContext.interfaceAddress) ? streamContext.interfaceAddress : null;
        try
            trace("Multicast NetStream will publish to IP address: " + streamContext.address +
      " on interface address: " + ((iAddr) ? iAddr : "default") +
                  ", Source stream: " + streamContext.streamName);
            ns.setIPMulticastPublishAddress(streamContext.address, iAddr);
        catch (e2)
            trace("MULTICAST PUBLISH ERROR: Failed to assign IP multicast address and port for publishing. Address: "
                  + streamContext.address + " on interface address: " + ((iAddr) ? iAddr : "default") +
      ", Source stream: " + streamContext.streamName);
            destroyStreamContext(streamContext);
            return;
    ns.onStatus = netStreamStatusHandler;
    streamContext.mcastNetStream = ns;
    updateStreamContextLookups(streamContext);
    streamContext.state = STATE_PUBLISH_PENDING;
* Status event handler for the multicast NetStream. Advances state upon successful
* connect and publish, or upon successful unpublish. Triggers tear-down if we fail
* to attach to a source Stream to republish.
* @param info - The status info Object.
function netStreamStatusHandler(info)
    var streamContext = getStreamContextForMulticastNetStream(this);
    trace("Multicast NetStream Status: " + info.code +
          (streamContext ? ", Source stream: " + streamContext.streamName : ", Not associated with a source stream."))
    if (streamContext)
        switch (info.code)
        case "NetStream.Connect.Success":
            if (!this.attach(Stream.get(streamContext.streamName)))
                trace("MULTICAST PUBLISH ERROR: Failed to attach multicast NetStream to source. Source stream: " +
                      streamContext.streamName);
                destroyStreamContext(streamContext);
    //var stream;
            //stream = Stream.get("liveStream");
                //return;
            }else{
            this.publish(streamContext.streamName, "live");
            break;
        case "NetStream.Publish.Start":
            streamContext.state = STATE_REPUBLISHING;
            break;
        case "NetStream.Unpublish.Success":
            streamContext.state = STATE_UNPUBLISHED;
            // Wait for unpublish notify event if the context has a NetGroup;
            // otherwise continue shut down now.
            if (!streamContext.netGroup)
                destroyStreamContext(streamContext);
                break;
        default:
            // Ignore.
* The common tear-down hook. Other functions that manage or shut down
* the StreamContext Object delegate to this function upon detecting a fatal
* error or during shut down.
* @param streamContext - The StreamContext Object for the source Stream and
*                        (potentially wired-up) multicast NetStream.
function destroyStreamContext(streamContext)
    // Unregister by Stream name immediately; lookups by NetConnection, NetGroup
    // and multicast NetStream remain in place until tear-down is complete.
    delete application.streamTable[streamContext.streamName];
    switch (streamContext.state)
    case STATE_REPUBLISHING:
        streamContext.mcastNetStream.attach(false);
        streamContext.mcastNetStream.publish(false);
        streamContext.state = STATE_UNPUBLISHING;
        return;
    case STATE_CONNECTING:
    case STATE_CONNECTED:
    case STATE_PUBLISH_PENDING:
    case STATE_UNPUBLISHED:
        // Delete status handler callbacks and cleanup in case we arrived here
        // as a result of a force close.
        if (streamContext.netGroup)
            delete streamContext.netGroup.onStatus;
        if (streamContext.mcastNetStream)
            streamContext.mcastNetStream.attach(false);
            delete streamContext.mcastNetStream.onStatus;
        streamContext.netConnection.close();
        streamContext.state = STATE_DISCONNECTING;
        return;
    default:
        // Fall-through.
    // At this point, we either never got to the republishing state or we've
    // proceeded through the clean shut down steps above. Everything for this
    // StreamContext can go away.
    unregisterStreamContext(streamContext);
* Utility function used to force close a StreamContext in the event that we
* start handling a republish of a Source stream before the context for its
* prior incarnation has been torn down.
* @param streamContext - The StreamContext Object for the source Stream.
function forceCloseStreamContext(streamContext)
    trace("Force closing previous multicast context for source stream: " + stream.name);
    prevContext.state = STATE_UNPUBLISHED;
    destroyStreamContext(prevContext);
// Client callback functions
* A no-op. Answers the RPC in the fashion expected by encoders, but the real
* work happens in application.onPublish.
* @param streamName - The name of the stream being published.
Client.prototype.FCPublish = function(streamName)
    this.call("onFCPublish",
              null,
              {code:"NetStream.Publish.Start", description:streamName});
* A no-op. Answers the RPC in the fashion expected by encoders, but the real
* work happens in application.onUnpublish.
* @param streamName - The name of the stream being unpublished.
Client.prototype.FCUnpublish = function(streamName)
    this.call("onFCUnpublish",
              null,
              {code:"NetStream.Unpublish.Success", description:streamName});
* If the client invoker's ip matches what was captured for a currently publishing
* stream, assume it's the same client and reset the stream. Otherwise, ignore.
* @param streamName - The name of the stream being released.
Client.prototype.releaseStream = function(streamName)
    var streamContext = getStreamContextForSourceStream(streamName);
    if (streamContext &&
        (streamContext.client.ip == this.ip) &&
        (streamContext.state <= STATE_REPUBLISHING))
        // Only tear-down an orphaned stream if it's not
        // already shutting down (see state check above).
        destroyStreamContext(streamContext);
// Helper functions
* Validates that a newly published stream has correct metadata (e.g. query
* string parameters) to republish into a Flash Group. This function also
* writes a message to the application log for any validation failures.
* @param params - The quiery string parameters for the source Stream.
* @return true if valid; otherwise false.
function validateStreamParams(params)
    var empty = true;
    for (var param in params)
       empty = false;
       break;
    if (empty)
        trace("MULTICAST PUBLISH ERROR: Stream query string is empty.");
        return false;
    if (!params["fms.multicast.type"])
trace("MULTICAST PUBLISH ERROR: Stream query string does not specify a 'fms.multicast.type'.");
        return false;
    var type = params["fms.multicast.type"];
    if (type != 1 && type != 2 && type != 3)
        trace("MULTICAST PUBLISH ERROR: 'fms.multicast.type' has invalid value: " + type);
        return false;
    if (!params["fms.multicast.groupspec"])
        trace("MULTICAST PUBLISH ERROR: Stream query string does not specify a 'fms.multicast.groupspec'.");
        return false;
    // Fusion and IP require an address:port.
    if ((type == 1 || type == 2) &&
        !params["fms.multicast.address"])
        trace("MULTICAST PUBLISH ERROR: Stream query string does not specify a 'fms.multicast.address'.");
        return false;
    // No obvious validation issues.
    return true;
* Parses the supplied query string, and if valid, returns an Object populated
* with the name-value pairs contained in the query string. The simple processing
* here does not preserve multiple name-value pairings having the same name; the
* last value seen wins. Parameters with no value are mapped to "" (empty String)
* in the returned Object.
* @param queryString - A query string portion of a URI, not including the leading
*                     '?' character.
* @return An Object containing a key-value mapping for each name-value parameter
*         defined in the query string; Object is empty if the query string is
*         invalid.
function parseQueryString(queryString)
    var result = {};
    var decoded = "";
    try
        decoded = decodeURIComponent(queryString);
    catch (e) // Invalid URI component; return empty result.
        return result;
    if (decoded.length)
        var params = decoded.split('&');
        for (var i in params)
            var pair = params[i];
     var sepIndex = pair.indexOf('=');
            if (sepIndex != -1)
                var name = pair.substr(0, sepIndex);
                result[name] = pair.substr(sepIndex + 1);
            else
                result[pair] = "";
    return result;
* Utility function used to swap out the protocol (scheme) portion
* of a given URI with an alternate.
* @param uri - The full URI.
* @param desiredProtocol - The replacement protocol.
* @return The URI with its protocol replaced.
function resetUriProtocol(uri, desiredProtocol)
    var sepIndex = uri.indexOf("://");
    return desiredProtocol + uri.substr(sepIndex);

HELP ME !!! THANKS!!!

Similar Messages

  • Problem playing remote live stream from FMS

    Hello all,
    I'm having problems playing remote live streams from FMS (server-side) that I can play with any other player (client-side)
    Example of server-side application which plays a remote live stream:
    nc = new NetConnection();
    nc.connect("rtmp://remoteserver/live");
    stream = Stream.get("localStream");
    stream.play("remoteStream.flv", -1, -1, true, nc);
    This code works only sometimes.
    Most of the times, FMS is able to connect to remote string and the localStream dispatches events:
       NetStream.Publish.Strart
       NetStream.Play.Reset
    In this case, FMS is publishing the local stream but it is not playing the remoteStrem on it.
    The rest of the times, localStream dispatches events:
       NetStream.Publish.Strart
       NetStream.Play.Reset
       NetStream.Play.Start
       NetStream.Data.Start
    In this case FMS plays the remoteStream correctly.
    Any hint to solve this issue?
    Regards.

    Thanks, I tried your code and it works when playing a remote live stream on another FMS.
    But the remote live stream is not on a FMS but on a Wowza Server which re-streams an RTSP stream over RTMP.
    With this code:
    var nc;
    var myStream;
    application.onAppStart = function(){
         nc = new NetConnection();
         myStream = Stream.get("localstream");
         myStream.onStatus= function(info){
               trace(info.code);
         nc.onStatus = function(info){
               trace (info.code);
               if(info.code == "NetConnection.Connect.Success" ){
                    myStream.play("remoteLive.sdp", -1, -1, true, nc);
         nc.connect("rtmp://remoteServer/live");
    Every live stream player I tried was able to play the remote stream "remoteLive.sdp", but FMS play it only sometimes. This is the output log of the FMS application:
    NetConnection.Connect.Success
    NetStream.Publish.Start
    NetStream.Play.Reset        <--------------------------------- Stuck there, stream won't play
    Unloaded application instance wowza4/_definst_ <--- Reload app
    NetConnection.Connect.Success
    NetStream.Publish.Start
    NetStream.Play.Reset        <--------------------------------- Stuck there, stream won't play
    Unloaded application instance wowza4/_definst_ <--- Reload app
    NetConnection.Connect.Success
    NetStream.Publish.Start
    NetStream.Play.Reset
    NetStream.Play.Start         <--------------------------------- Stream is playing just fine
    NetStream.Data.Start
    Unloaded application instance wowza4/_definst_ <--- Reload app
    NetConnection.Connect.Success
    NetStream.Publish.Start
    NetStream.Play.Reset       <--------------------------------- Stuck there, stream won't play
    Any idea? Why FMS won't play it everytime?
    Regards

  • Problem of republishing remote rtmp live stream with AMF

    Hi, Guys
    I am trying recieving one live stream from a remote rtmp server and republishing this stream in AMF.
    a remote rtmp (rtmp://192.168.1.100/live/remotestream)
    AMF instance(codes in application/app/main.asc) recieve and republish to another AMF instance.
    I can watch with url(rtmp://192.168.1.100/live/remotestream ) in a player (ex. OSMF player).
    But,no data from remote rtmp streaming can be recieved in AMF.
    Here is the log:
    NetConnection.Connect.Success
    Sending error message: Method not found (onBWDone).
    mystream.onStatus: NetStream.Publish.Start
    mystream.onStatus: NetStream.Play.Reset
    My codes in application/app/main.asc
    application.onAppStart = function()
              mystream = Stream.get("myvideo");
              myRemoteConn = new NetConnection();
              myRemoteConn.connect("rtmp://192.168.1.100/live");
              myRemoteConn.onStatus =function(info){
               trace(info.code);
               if(info.code == "NetConnection.Connect.Success"){
                    mystream.play("remotestream", -1, -1, true, myRemoteConn);
                    //mystream.play("sample", 0, -1, true);<-----if play a local flv video file ,it works.republish fine.
              nc = new NetConnection();
              nc.connect("rtmp://localhost/demo");
              ns = new NetStream(nc); 
              ns.setBufferTime(2);
        mystream.onStatus = function(sinfo)
            trace("mystream.onStatus: "+sinfo.code);
            if(sinfo.code == "NetStream.Publish.Start")
                                  attach_retVal = ns.attach(mystream);
                if(attach_retVal==true){
                        ns.publish(mystream.name,"live");

    On the Macintosh side there is the Camtwist app which allows you to do this and it works smoothly with FMLE. On the PC side I´m not sure but there just got to be more apps capable of this than on the mac side.

  • Archiving live stream at FMS and injecting metadata: VP6 good h264 not

    When I record a live stream at FMS, one in which I've injected  metadata in my main.asc file, the archived file plays back fine.  The  metadata plays back too.  I'm able to retreive it just fine - if I  encode VP6.
    If I encode h.264 the file plays back but  the metadata does not.  The fact that the archived file is created and  plays back tells me things are wired correctly.  The only thing I  changed is the format.
    According to FMS docs (http://help.adobe.com/en_US/FlashMediaServer/3.5_SS_ASD/WS5b3ccc516d4fbf351e63e3d11a11afc9 5e-7e42.html#WS5b3ccc516d4fbf351e63e3d11a11afc95e-7f35)
    ..."The recording format is determined by the filename you pass to the Stream.get()
    method."
    So my record code looks like the following:
    application.onPublish = function(client, stream) {
         trace("onPublish");
         s = Stream.get("mp4:streamname.f4v");
         if(s){
             s.record();
         this.doRepublish(this.nc, stream);
    My code that injects the data in to the stream looks like this:
    Client.prototype.sendDataEvent = function(data) {
         trace("Call to sendDataEvent...");
         this.newStream = Stream.get("mp4:streamname.f4v");
         this.newStream.send("onTextData",data);
    All must be wired  correctly because the metadata comes through during the live stream.  On  play back of the archive though, the metadata doesn't appear to be  there.
    Any thoughts?
    Thanks

    My apologies on the s.play() confusion.  I had been trying different versions of the code and posted the one without it.
    Whether I include s.play() or not the file gets created.  Here are the various versions of the onPublish() function I've tried (differences in red):
    1.
    application.onPublish = function(client, stream) {
        trace("onPublish");   
        s = Stream.get("mp4:streamname.f4v");
        if(s){
            s.record();
            s.play("mp4:streamname.f4v");
        this.doRepublish(this.nc, stream);
    2.
    application.onPublish = function(client, stream) {
        trace("onPublish");   
        s = Stream.get("mp4:streamname.f4v");
        if(s){
            s.record();
            s.play(stream);
        this.doRepublish(this.nc, stream);
    3.
    application.onPublish = function(client, stream) {
         trace("onPublish");   
         s = Stream.get("mp4:streamname.f4v");
         if(s){
             s.record();
         this.doRepublish(this.nc, stream);
    All produce the same result - an archived file called mp4:streamname.f4v in my streams folder.  This file plays back fine but does not play back the commands.
    On your other question, about things working fine for VP6, it works fine for FLV.  A file called streamname.flv is produced.  This file plays back fine and does indeed play back commands baked into the file as well.  This is what makes me believe the code is not the problem.  If it works perfectly for one format, there would seem to be very little I could do in my code to break things for the other.
    Can you try this using the record() code snippets in the live docs Stream.record() section?
    http://help.adobe.com/en_US/FlashMediaServer/3.5_SS_ASD/WS5b3ccc516d4fbf351e63e3d11a11afc9 5e-7e42.html#WS5b3ccc516d4fbf351e63e3d11a11afc95e-7f35
    All you'd need is the code snippets there to record your live stream and another server side function to inject commands into that live stream. Here is that function:
    Client.prototype.sendDataEvent = function(data) {
        trace("Call to sendDataEvent...");
        this.newStream = Stream.get("mp4:streamname.f4v");
        this.newStream.send("onTextData",data);
    Do something simple like call onTextData and pass some text in the data parameter.  Then on the client side viewer, handle the onTextData method.  It will receive the text.  Display it in a text area or something.
    If you record while injecting this text into your stream, the text should display on playback of the archived file.  It will if you encode VP6/FLV, but not if you encode H.264/F4V.
    Let me know what you discover.

  • Multiple RTMP sources streaming to FMS without stop?

    I have some .mov files want to stream to Flash media server by ffmpeg.
    i have already tried to stream a single .mov by FFMPEG command in terminal and it works, the FMS can display the thing i streaming in live.
    ffmpeg -re -i file1.mov -vcodec libx264 -f flv rtmp://localhost/livepkgr/livestream
    Now i want to stream multiple files as one source, i tried to use above command one by one,
    but it seems Flash media server stop the streaming when file1 is finished, then start the stream with file2.
    It makes the stream player stopped when file1 is finish, and i have to refresh the web page in order to continue on file2.
    i am calling the FFMPEG command by a C program in linux,
    i wonder is there any method that i can prevent the FMS stopped when i switch the file source in FFMPEG?
    or is that possible to let FFMPEG constantly deliver the stream by multiple files source without stopped when a file finish?
    Sorry have for asking a lot recently... but this is urgent to me... thank you

    i am trying to prevent fms pause the publishing the video after publisher stop.
    i tried to comment out all the codes in this 3 method in main.asc 
    application.onUnpublish = function(clientObj, streamObj)
    Client.prototype.FCUnpublish = function( streamname )
    Client.prototype.releaseStream = function(streamname)
    but still when publisher stop, the client side player stop imeediately.
    Also i am can fms receive the stream as soon as possible, and let the video play until the end?
    for example
    i have a video have 5mins length, my publisher software can fast enough deliver the video
    within 30 secs, so that fms should already have 5mins content for broadcasting, can fms
    keep on the broadcasting even the connection from publisher to fms is finish?

  • Live stream on FMS issues when reaching 1600 concurrent users

    Hey all,
    We have an FMS 4.5.2 installation with 1x Origin and 2x Edge setup only for Live streaming. We are using FMLE latest version to stream to the Origin server and Edge servers are connecting to the Origin server. We are running four applications stream1, stream2, stream3 and stream4 all for live streaming (copied live) application. All servers have default configuration except edge/origin setup.
    All servers have 4Gbit connections in bonding and network traffic is nicely distributed across all bonds and uplink is 10Gbit to the ISP.
    Server is a 2 CPU / Quad Core HP DL 380 with 64Gbit of memory running Ubuntu 10.04 LTS
    Now to the problem.
    We are streaming live stream from FMLE with 700kbit/s to for example stream1 application and when we hit around 1600 concurrent users with 50% on edge1 and 50% on edge2 (800 concurrent users on each edge) in the player buffer drops and all people experience buffering issues at approx 30secs - 2minutes intervals. (network is not congested because if at that time do an SCP from the server outside network it copies 1Gbyte file within seconds.
    Funny thing is that If I start a second FMLE and stream live stream to for example stream2 application at same time and open up second player on client the video runs great without any buffer issues from the same server at the same time.
    edge1 server:
    application: stream1 with 800 concurrent users, player has buffer issues
    application: stream2 with 4 concurrent users, player has no issues
    edge2 server
    same as above
    So my current conclusion is that it has to be something per application since other application does not have this issues when running simultaneously? We tried changing fmscore number settings and some buffer settings but nothing helped.
    at the time when we get buffering issues this are the only problematic things that get in the log and its in edge.00.log on both EDGE servers but not at same times:
    Edge1:
    2012-04-23    12:50:21    29270    (e)2661034    Connect failed ( , 8134 ) : Connect failed: Connection refused (111)    -
    2012-04-23    12:55:30    29270    (e)2661034    Connect failed ( , 8134 ) : Connect failed: Connection refused (111)    -
    2012-04-23    12:56:42    29270    (e)2661034    Connect failed ( , 8134 ) : Connect failed: Connection refused (111)    -
    2012-04-23    12:56:42    29270    (e)2661034    Connect failed ( , 8134 ) : Connect failed: Connection refused (111)    -
    2012-04-23    13:14:40    29270    (e)2661034    Connect failed ( , 8134 ) : Connect failed: Connection refused (111)    -
    2012-04-23    13:20:30    29270    (e)2661034    Connect failed ( , 8134 ) : Connect failed: Connection refused (111)    -
    Edge2:
    2012-04-23    12:56:32    9625    (e)2661034    Connect failed ( , 8134 ) : Connect failed: Connection refused (111)    -
    2012-04-23    13:02:23    9625    (e)2661034    Connect failed ( , 8134 ) : Connect failed: Connection refused (111)    -
    2012-04-23    13:08:03    9625    (e)2661034    Connect failed ( , 8134 ) : Connect failed: Connection refused (111)    -
    there is no packet loss between edge and origin servers and latency is at 0.2ms and nothing in the logs of the origin server
    We even tried to deploy Wowza Medis Servers with edge / origin setup and were able to handle around 4000 (2000 on one and 2000 on second edge) concurrent users without any issues.
    Anyone has any ideas or at least what are our next options to do and what settings to change on the FMS? or how to debug and what to check when buffering issue appears? any more debugging we can enable on the FMSs? too se if we hit some kind of limit somewhere?
    thanks

    hey, i got the similar problem, logging like this
    2012-11-12
    18:50:12
    23434
    (e)2661034
    Connect failed ( , 5779212 ) : Connect failed: Connection refused (111)
    2012-11-12
    18:50:54
    23434
    (e)2661034
    Connect failed ( , 5779212 ) : Connect failed: Connection refused (111)
    2012-11-12
    18:51:36
    23434
    (e)2661034
    Connect failed ( , 1166880400 ) : Connect failed: Connection refused (111)
    2012-11-12
    18:54:14
    23434
    (e)2661034
    Connect failed ( , 1175301776 ) : Connect failed: Connection refused (111)
    2012-11-12
    18:54:55
    23434
    (e)2661034
    Connect failed ( , 1164775056 ) : Connect failed: Connection refused (111)
    2012-11-12
    18:55:37
    23434
    (e)2661034
    Connect failed ( , 16 ) : Connect failed: Connection refused (111)
    2012-11-12
    19:13:08
    23434
    (e)2661034
    Connect failed ( , 1158459024 ) : Connect failed: Connection refused (111)
    it seems that the port number is invalid, but we never use such ports.

  • How to stop threads, process, streams when closing a (internal) JFrame?

    Dear all,
    I read a Javaworld article about Runtime.exec(), which will output the process outputs and error outputs to either a file or System.out. Now I want to practice it by outputing the process output/error to a Swing JTextArea. It works fine if the process ends successfully.
    My problem is that I want to stop all the output threads and clear all the streams when user click close JFrame button before the process finished. The code is shown below. Note that this frame is poped up by a click from another main frame. ( it is not exiting the main Swing application). This happened when I want to kill a process when it is running.
    I tried to implements a WindowListener and add
    public void windowClosing(WindowEvent e) to the JFrame.
    Inside this method I used process.destroy() and errorGobbler = null, outputGobbler = null, or outputGobbler.interrupt(), errorGobbler.interrupt(). But all these seems does not work. Sometimes thread was not stopped, sometimes process was not destroyed (because the stream was still print out something), sometimes the error stream was not successfully closed - by printing out interruptted by user error message.
    How can I make sure all the underlying streams and threads, including the PrintStream in StreamGobbler class are closed?
    Again this Frame could be a Dialog or InternalFrame, i.e, when I close the frame, the main frame does not exit!
    import java.util.*;
    import java.io.*;
    class StreamGobbler extends Thread
        InputStream is;
        String type;
        OutputStream os;
        StreamGobbler(InputStream is, String type, JTextArea out)
            this(is, type, null, out);
        StreamGobbler(InputStream is, String type, OutputStream redirect, JTextArea out)
            this.is = is;
            this.type = type;
            this.os = redirect;
        public void run()
            try
                PrintWriter pw = null;
                if (os != null)
                    pw = new PrintWriter(os);
                InputStreamReader isr = new InputStreamReader(is);
                BufferedReader br = new BufferedReader(isr);
                String line=null;
                while ( (line = br.readLine()) != null)
                    if (pw != null)
                        pw.println(line);
                    out.append(type + ">" + line);   
                if (pw != null)
                    pw.flush();
            } catch (IOException ioe)
                ioe.printStackTrace(); 
    public class Test extends JFrame
        private JTextArea output;
        private StreamGobbler outputGobbler;
        private StreamGobbler errorGobbler;
        public Test (String file)
            super();
            output = new JTextArea();
            try
                FileOutputStream fos = new FileOutputStream(file);
                Runtime rt = Runtime.getRuntime();
                Process proc = rt.exec("java jecho 'Hello World'");
                errorGobbler = new
                    StreamGobbler(proc.getErrorStream(), "ERROR", out);           
                outputGobbler = new
                    StreamGobbler(proc.getInputStream(), "OUTPUT", fos, out);
                errorGobbler.start();
                outputGobbler.start();
                int exitVal = proc.waitFor();
                output.append("ExitValue: " + exitVal);
                fos.flush();
                fos.close();       
            } catch (Throwable t)
                t.printStackTrace();
         setSize(400,400);
         show();
    }Thanks !

    Thread.interrupt() doesn't stop a thread. You'll have to read the API for more specifics. You could use something like interrupt to force interruption of the thread for the reason of checking the terminating case though. I believe you would want to use this in the case where operations can take a long time.
    Setting your reference to the thread to be null won't stop the thread since it's running. You just lose your reference to it.
    I believe once the thread stops running your streams will be closed, but possibly not cleanly. Someone who has more knowledge of threads might be able to answer this better, but I would generally say clean up after yourself especially if you are writting out data.

  • Recording Live Streams on FMS remotely

    Hi,
    We're using FMSS 3 to stream live feeds from cameras.
    However, we'd also like to have the ability to (via an
    administration site) record these live streams and allow the user
    to view pre-recorded streams instead of the live ones.
    Does anyone know of an example of how I can tell FMS to start
    recording a stream (via a web service or AS), and then how to stop
    it? Just for clarification - we don't want FMS to record a stream
    from the user's own camera. We want to record the live streams that
    are already streaming on FMS.
    Thanks,
    Filip Stanek
    bloodforge.com

    you can creat an app folder in fms folder which is inside of
    ur setup folder,
    for details u can mail at [email protected]

  • Can use another software (not FMLE) to publish stream to FMS?

    Hi all,
    I have a question:
    Can use another software (not FMLE) to publish stream to FMS?
    I ask this question because I want to use Authentication add-in to prevent user publish stream to FMS. This add-in only affect with FMLE, so, if user use another encoder software, they still can publish stream to my FMS

    You can use any encoder to publish to FMS - you can write you own add-in to restrict any publisher - but you are right that FMLE add-in will work only for FMLE.
    Actually i am not clear with your questions - Are you concerned that other publishers apart from FMLE would publish or you want add-in for other encoders - meaning do you plan to use another encoder?
    If its first problem - you can do simple thing - turn SWF verification on - make exception for FMLE and have FMLE add-in - in this case only valid clients would be able to connect - even other encoders wont be able to connect - so if someone cant connect there is no way they can publish.

  • RTMP Streaming Works, HTTP Streaming Does Not

    I am using the following to stream video live:
    - Windows Server 2008 with Flash Media Server 5.
    - Flash Media Live Encoder 3.2
    - This tutorial step by step to setup the manifests: Stream live multi-bitrate video over HTTP to Flash and iOS - YouTube
    - In FMLE the following settings:
         - H264 Format, Main Profile, Level 3.1, Keyframe freq 4, 150, 500 and 1000 kpbs bit rates.
         - FMS URL: rtmp://<my-static-ip>/livepkgr
         - Stream: livestream%i?adbe-live-event=liveevent
    - The liveevent.f4m and liveevent.m3u8 files are saved in the webroot folder
    - Built in administrator console OSMF video player, with the following URL: http://<my-static-ip>/livepkgr/liveevent.f4m
    FMLE is saying it connects without issue and that it publishes, and the server shows that the stream is connecting in the admin console. The one thing that does not appear to work is playing the stream back itself. I've tried any number of different  URLS to play the stream, none work, they just give me a generic "We are having problems with playback. We appologize for the inconvenience." I know the stream connects because when I replace http://<my-static-ip>/livepkgr/liveevent.f4m with rtmp://<my-static-ip>/livepkgr/liveevent it plays the rtmp version.
    Is there some further configuration I am missing on the server side? Something else I am missing?

    Still nothing I can verify the embedded player is trying to access the stream URL I setup. I can still verify stream publishing in the admin console, but I cannot embed the video, still getting the same generic error.. I am streaming to my private server running Windows Server 2008 R2 that I host multiple sites with. I am beginning to think the URL doesnt recognize that I am trying to access the webroot folder for the manifests, but I don't know how to tell if this is the case or how to change this setting. Can anyone provide me an example of a proper html code to embed a video using the FMLE stream I am publishing that they can verify works with a similar setup to what I have?
    Dustin Rogers
    [email protected]
    (780) 250-0200

  • FMLE stops encoding

    Recently we installed FMLE 3x, we stream to two servers using the FMS and backup URLs. We are finding with some frequence that FMLE stops encoding to one of the URLs. I will appreciate a lot some information about a possible cause/solution for this problem if some one here has experienced this behaviour.
    Thanks in advance !!

    Are you getting any status message in Encoding Log tab of FMLE related to connectino break with that FMS server.
    If any disconnection message is there then FMS is dropping connection from FMLE
    If not then please check the RTMP buffer value from Publishing stats at Encoding Log tab. If buffer value is increasing then that means FMLE is not able to push complete data to FMS either due to network congestion or due to Network latency. If this is the case then you can try using Auto Adjust feature of FMLE for single stream as for MBR Auto Adjust feature does not work.

  • FLVPlayback issue loading RTMP stream

    Hi, I'm currently having a problem with FLVPlayback refusing to play a stream from a certain site. The flvplayback was playing streams from a different remote site fine, the stream that it is attempting to play work in other AS2 FLVPlayback components on different sites using the same skin, and the stream is pointing to the right file. When tracing the FLVPlayback streams, the streams that work show the states buffering, playing while the stream that doesn't work only hits the state "loading." During the entire process no errors are thrown. When I run the FLVPlayback locally it has no trouble loading from either remote rtmp site.
    Thanks,
    Ed

    Updated the FLVPlayback component with the very latest.
    Updated my project from Flash 9 to Flash 10.
    It's working like a charm !

  • Not Found RTMP streams and Buffering Message

    I'd like to provide our clients with something that indicates that a VOD file isn't found when requested via RTMP.
    Using the Strobe player, the default behavior from FMS 4.5 is to throw up a continuous "Buffering" message when the file isn't found.
    When it's a live stream, we can control the return a response with FCSubscribe; so if it's not there, we can send back a response. HTTP (HDS/HLS) do return a file not found when requesting a missing file.
    I tried this from a stock version of FMS using the /vod directory and any time that I place in a vod rtmp location that doesn't exist I get a buffering message.
    I know that I could add a timeout to the client side - but I'm trying to stick to stock OSMF and make it work from the server side with multiple players.
    Is there server side actionscript /or c++ plugin that I can add that will check the presence of the file and return a "not found" when the play is requested?
    How/where would I exactly add that? Seems realitively simple, but not seeing any reference or information about how to set it up.
    Much thanks in advance.
    -Will

    Thank you for the response.
    Not getting that response from the stock version of FMS 4.5:
    1320069319931: *** NetConnection.Connect.Success ****)
    1320069319936: Manual switching enabled
    1320069319936: buffer length: 5
    1320069319937: play() called. isLive = false, is multibitrate = false
    1320069319938:     PlayArgs:[object DynamicStreamBitrate]
    1320069319940: Set rate limit to 1 kbps
    1320069319940: Starting with stream index 0 at 1 kbps
    1320069319941: Transition complete to index 0 at 1 kbps
    1320069319942: ***_ NetStream.Play.TransitionComplete ***
    1320069320138: *** onNetStatus: NetStream.Play.Reset
    1320069320139: *** onNetStatus: NetStream.Play.Start
    This is using an OVP player base - the strobe player just spins as well.
    The issue appears with a stock version of FMS, and the stock OSMF Strobe Playback.
    So should I report this as an FMS 4.5 and OSMF issue?
    Thanks.

  • Publish Live stream to FMS on RTMPE protocol

    Hi,
    I am trying to publish Live Stream to FMS using FMLE or third party encoders.
    Is it possible to have RTMPE or RTMPTE protocol used between encoder and FMS?
    Very urgent.
    thanks,
    Pooja Jain

    FMLE can only publish via rtmp or rtmpt.

  • Using your own AMS, how can you use BitmapData.draw() on an RTMP stream with no security exception?

    We have an Adobe AIR app written in AS3 that can view live video streams from other parties.  That being said, when trying to call BitmapData.draw() on one of those remote video streams (technically we're calling ImageSnapshot.captureImage()), we're getting a 2123 error - a security sandbox exception.  I've seen a lot of people refer to a real simple configuration in the AMS that will allow this to work for RTMP streams, but they keep posting broken links, links to posts that only vaguely mention this configuration, etc.  The one thing I did find is something that I'm having trouble applying:
    http://help.adobe.com/en_US/FlashMediaServer/3.5_SS_ASD/WS5b3ccc516d4fbf351e63e3d11a11afc9 5e-7ec3.html#WS5b3ccc516d4fbf351e63e3d11a11afc95e-7fcb
    Please don't just give me another link, unless it's to a quick, clear explanation.  How do you configure the AMS to allow people to capture screenshots from RTMP video streams?  For the above article, I've tried setting videoStreamAccess and audioStreamAccess both to "/", and even it didn't work.  We also need to be able to do this for P2P RTMFP streams, but that's really a different question.  Thanks.

    You will get a better luck if you post this question on media server forum:
    http://forums.adobe.com/community/adobe_media_server?view=discussions

Maybe you are looking for

  • I need an external DVD burner!

    Does anybody know of a external superdrive or burner for a mac mini? I don't really feel like taking a putty knife to it so it has to be USB/FireWire, and compatible with leopard.

  • Level 2 Tabs - Buggy or is it just me?

    I'm on 1.6. I've been trying to successfully create a 2 level tab application. I am using the default "Business Look" template although I've tried switching themes to try and get this to work to no avail. Even though I set the application default pag

  • CSS error ...

    Hi All, I am getting the following error while installing the ASM for Oracle 10.2.0.1.0 on HP-UX 11 machine. # $ORACLE_HOME/bin/localconfig reset $ORACLE_HOME Successfully accumulated necessary OCR keys. Creating OCR keys for user 'root', privgrp 'ot

  • Query in IDOC.

    Hi, Could you please clarify me the following 1) In which transaction code we can find the all the segements assigned to a MEASSAGE type. 2) In which transaction code we can find all the fields available under the Segement type. 3) where we can see a

  • Mac Pro (Early 2008) Won't Bootup

    I have an early 2008 Mac Pro that for the last couple of months would randomly restart, or shutdown, or even startup when it was off. I was running OS 10.8.3 and read there were some problems with random restarts, or logouts. However, I'm running 3 o