Example #1
0
        public static AmfMessage GetPong()
        {
            var        ts = (uint)(DateTime.Now.MilliSecondsFrom1970());
            AmfMessage result;

            result.Header =
                GenericMessageFactory.VH(HeaderType.HT_FULL, 2, 0, 0, Defines.RM_HEADER_MESSAGETYPE_USRCTRL, 0, true);
            result.Body = Variant.GetMap(new VariantMapHelper {
                { Defines.RM_USRCTRL, Variant.GetMap(new VariantMapHelper {
                        { Defines.RM_USRCTRL_TYPE, (ushort)Defines.RM_USRCTRL_TYPE_PING_RESPONSE },
                        { Defines.RM_USRCTRL_TYPE_STRING, RTMPProtocolSerializer.GetUserCtrlTypeString(Defines.RM_USRCTRL_TYPE_PING_RESPONSE) },
                        { Defines.RM_USRCTRL_PONG, ts }
                    }) }
            });
            return(result);
        }
        public static AmfMessage GetUserControlStream(ushort operation, uint streamId)
        {
            AmfMessage result;

            result.Header = GenericMessageFactory.VH(HeaderType.HT_FULL, 2, 0, 0, Defines.RM_HEADER_MESSAGETYPE_USRCTRL,
                                                     0, true);
            result.Body = Variant.GetMap(new VariantMapHelper
            {
                {
                    Defines.RM_USRCTRL, Variant.GetMap(new VariantMapHelper
                    {
                        { Defines.RM_USRCTRL_TYPE, operation },
                        { Defines.RM_USRCTRL_TYPE_STRING, RTMPProtocolSerializer.GetUserCtrlTypeString(operation) },
                        { Defines.RM_USRCTRL_STREAMID, streamId }
                    })
                }
            });
            return(result);
        }