开发者

Webcam Stream to CDN FMS

I don't have my own Flash Media Server. I can however use the Highwinds CDN. They run FMS on their CDN. When you schedule a live event, Highwinds gives you two urls: the "server" and "stream name". Examples:

server: rtmp://fli003.am4.hwcdn.net/XXXX/definst

stream name: fli/00000-streamname?encoderuser=XXX&encoderpassword=YYY

These two urls can be pasted into the Flash Media Live Encoder application to stream the live event. The respective field names in Flash Media Live Encoder are "FMS URL" and "Stream".

I now have successfully established a connection (I think?) to the FMS server. The problem: the stream is not showing on the web, and it seems it is not submitted to the CDN.

function onStatus(e:NetStatusEvent):void {

trace(e.info.code);

    switch(e.info.code) {

      case "NetConnection.Connect.Success":
        var ns:NetStream = new NetStream(conn);

        ns.addEventListener(NetStatusEvent.NET_STATUS, onStatus);

        var camera = Camera.getCamera();
            camera.setLoopback(true);
            camera.setQuality( 0, 100 );
            camera.setMode(640, 480, 25)
        var mic = Microphone.getMicrophone();

        if (camera != null){
            myVid.attachCamera(camera);
            ns.attachCamera(camera);
//            ns.play();
        }
        if (mic != null) {
            ns.attachAudio(mic);
        }
        
        ns.publish("fli/00000-streamname?encoderuser=XXX&encoderpassword=YYY", "live");
        break;
        //...
    }
}

var conn:NetConnection = new NetConnection();



conn.addEventListener(NetStatusEvent.NET_STATUS, onStatus);
conn.connect("rtmp开发者_如何学Go://fli003.am4.hwcdn.net/XXXX/_definst_");


//var counter:int = 0;
//conn.onBWDone = function(kbitDown:Number, deltaDown:Number, deltaTime:Number, latency:Number){ };
NetConnection.prototype.onBWDone = function(p_bw) {
   //trace("onBWDone: "+p_bw);
}
NetConnection.prototype.onBWCheck = function() {
   //return ++counter;
}

The smil file is there, but I suspect that no data arrives at the server. The player is only showing a loading animation.

And I now get an additional

NetStream.Failed NetStream.InvalidArg NetStream.InvalidArg after successfully connecting. No idea where that error came from.


check the NetStraem.publish() reference:

//...
conn = new NetConnection();
conn.addEventListener(NetStatusEvent.NET_STATUS, onStatus);
conn.connect('rtmp://fli003.am4.hwcdn.net/XXXX/definst');
//...
private function onStatus(e:NetStatusEvent):void {
    switch(e.info.code) {
        case "NetConnection.Connect.Success":
        ns = new NetStream(conn);
        ns.attachCamera(camera);
        ns.publish("fli/00000-name?encoderuser=XXX&encoderpassword=YYY", "live");
        break;
        //...
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜