Skip to main content
Participating Frequently
August 26, 2010
Question

Stream Videos(playlist) to a cdn

  • August 26, 2010
  • 1 reply
  • 552 views

Hallo,

normal I stream a livestream from Fme to a Fms and than to 2 cdn´s like justinTv. Now I´ve got the problem that i want to change the Script that it streams Viedos to the CDNs. Can Someone help me doing that or tell me what to read?

Thats the Script I use right now to push the livestream:

var nc1=null;

var nc2=null;

var ns1=null;

var ns2=null;

application.onPublish = function(client, myStream) {


if (application.name == "rushTV/_definst_"){
   trace("Republishing the stream to justinTV");

       nc1 = new NetConnection();
       nc1.connect("rtmp://live.justin.tv/app");
       ns1 = new NetStream(nc1);
        //called when the server NetStream object has a status
       ns1.onStatus = function(info) {
    trace("Stream Status: " + info.code)
    if (info.code == "NetStream.Publish.Start") {
        trace("The stream is now publishing to ustream");
    }         
      }
 
       ns1.setBufferTime(150);
       ns1.attach(myStream);
       ns1.publish( "xxxxxxxxx","live" );
      
      
     trace("Republishing the stream to bit");

       nc2 = new NetConnection();
       nc2.connect("rtmp://rtp1.xxxxxxx");
       ns2 = new NetStream(nc2);
        //called when the server NetStream object has a status
       ns2.onStatus = function(info) {
    trace("Stream Status: " + info.code)
    if (info.code == "NetStream.Publish.Start") {
        trace("The stream is now publishing to bit");
    }         
      }
 
       ns2.setBufferTime(150);
       ns2.attach(myStream);
       ns2.publish( "cccxxxxxx","live" );
}
}

    This topic has been closed for replies.

    1 reply

    Adobe Employee
    August 26, 2010

    I guess you want something like this.. See if that works.Correct code syntactically.

    function addVODSource()

    {
       
        flvStream = Stream.get("myStream");
       
        flvStream.onStatus = function(info)

         {   
            if(info.code == "NetStream.Publish.Start")

              {
                ret = ns.attach(flvStream);           
                if(ret ==true)

                {               
                    MPPFLV();
                }
            }
        }
       
        flvStream.play("vodFile",0,-1,true);// voDFile is your video file
    }

    function MPPFLV()

    {
          ret = ns.publish(flvStream.name, "live");
    }

    For more on Stream.play http://www.adobe.com/livedocs/flashmediaserver/3.0/hpdocs/help.html?content=00000095.html