Beispiel #1
0
        private bool ParseMessage( MessageID id, byte[] payload )
        {
            switch (id)
            {
                //Parse control messages 1-7
                case MessageID.SetChunkSize:
                    options.ChunkSize = ArrayUtil.BigIndianInt(payload, 0, 4);
                    break;
                case MessageID.WindowAcknowledge:
                    options.WindowSize = ArrayUtil.BigIndianInt(payload, 0, 4);
                    break;

                // Parse commands like connect
                case MessageID.CommandAMF0:
                    var command = ArrayUtil.AMF0String(payload, 0);
                    switch (command.ToLower())
                    {
                        case "connect":
                            var cmdConnect = new CmdConnect( payload );
                            if (OnConnect != null)
                                OnConnect(this, new ConnectData(cmdConnect));
                            break;
                        case "releasestream":
                            if (OnReleaseStream != null)
                                OnReleaseStream(this, new AMFCallData(payload) );
                            break;
                        case "fcpublish":
                            if (OnFCPublish != null)
                                OnFCPublish(this, new AMFCallData(payload) );
                            break;
                        case "createstream":
                            if (OnCreateStream != null)
                                OnCreateStream(this, new AMFCallData(payload));
                            break;
                        case "publish":
                            if (OnPublish != null)
                                OnPublish(this, new AMFCallData(payload));
                            break;
                        default:
                            return false;
                    }
                    break;
                default:
                    return false;
            }
            return true;
        }
Beispiel #2
0
 public ConnectData(CmdConnect obj)
 {
     ConnectObject = obj;
 }