[AS3.0] Error #2044: 未处理的 NetStatusEvent:。 level=error, code=NetStream.Record.NoAcces 解决办法

突然又需要FMS做视频录制,却遇到一些意想不到的问题,我在想当年做的时候怎么没遇到。。。

报错:

Error #2044: 未处理的 NetStatusEvent:。 level=error, code=NetStream.Record.NoAcces

问题原因:

查资料发现,居然FMS在默认情况下不允许record文件到服务器,必须要进行设置,在服务器端的应用程序文件夹(默认位置在<FMS_Installation_Dir>/applications/live),在这个文件夹下面有一个main.far,main.far是个压缩文件(可以用winrar解压),解压后里面有两个文件main.asc 和 Application.xml, 打开Application.xml,代码如下:

<Application>

    <SharedObjManager>
            <ClientAccess override="no">false</ClientAccess>
    </SharedObjManager>

    <StreamManager>
            <StreamRecord override="no">false</StreamRecord>
    </StreamManager>

</Application>

 

 默认是SharedObject远程共享对象和StreamRecord录制都不允许。

修改Application.xml如下:

<Application>

    <SharedObjManager>
            <ClientAccess override="yes">true</ClientAccess>
    </SharedObjManager>

    <StreamManager>
            <StreamRecord override="yes">true</StreamRecord>
    </StreamManager>

</Application>

除此修改之外还要修改main.asc

打开main.asc,找到以下函数:

application.onConnect = function( p_client, p_autoSenseBW )
{
    // Check if pageUrl is from a domain we know.    
    // Check pageurl

    // A request from Flash Media Encoder is not checked for authentication
    if( (p_client.agent.indexOf("FME")==-1) && (p_client.agent.indexOf("FMLE")==-1))
    {

        // Authenticating HTML file's domain for the request :
        // Don't call validate() when the request is from localhost 
        // or HTML Domains Authentication is off.
        if ((p_client.ip != "127.0.0.1") && application.HTMLDomainsAuth 
                &&  !this.validate( p_client.pageUrl, this.allowedHTMLDomains ) )
        {
            trace("Authentication failed for pageurl: " + p_client.pageUrl + ", rejecting connection from "+p_client.ip);
            return false;
        }
    
        // Authenticating the SWF file's domain for the request :
        // Don't call validate() when the request is from localhost 
        // or SWF Domains Authentication is off.
        if ((p_client.ip != "127.0.0.1") && application.SWFDomainsAuth 
                &&  !this.validate( p_client.referrer, this.allowedSWFDomains ) )
        {
            trace("Authentication failed for referrer: " + p_client.referrer + ", rejecting connection from "+p_client.ip);
            return false;
        }
            // Logging
        trace("Accepted a connection from IP:"+ p_client.ip 
                        + ", referrer: "+ p_client.referrer
                        + ", pageurl: "+ p_client.pageUrl);

    }else{
        // Logging
        trace("Adobe Flash Media Encoder connected from "+p_client.ip);
    }
    
    // As default, all clients are disabled to access raw audio and video and data bytes in a stream 
    // through the use of BitmapData.draw() and SoundMixer.computeSpectrum()., Please refer
    // Stream Data Access doccumentations to know flash player version requirement to support this restriction
    // Access permissions can be allowed for all by uncommenting the following statements
    
    //p_client.audioSampleAccess = "/";
    //p_client.videoSampleAccess = "/";    

    this.acceptConnection(p_client);
        
    // A connection from Flash 8 & 9 FLV Playback component based client 
    // requires the following code.

    if (p_autoSenseBW)
        p_client.checkBandwidth();
    else
        p_client.call("onBWDone");
        
}

打开以下注释:

    //p_client.audioSampleAccess = "/";
    //p_client.videoSampleAccess = "/";    

如果想允许SharedObject远程共享对象,可以加上以下代码:

p_client.writeAccess = "/";

然后将修改后的文件重新打包mian.far,替换原来的,重启FMS服务器即可。

posted on 2017-01-02 01:49  晏过留痕  阅读(369)  评论(0编辑  收藏  举报