Ejemplo n.º 1
0
        public override bool SignalInputData(int recAmount)
        {
            var reader    = new StreamReader(InputBuffer);
            var firstLine = reader.ReadLine();
            var ss        = firstLine.Split(' ')[1].Split('/');

            ClientApplicationManager.SwitchRoom(this, ss[1] + (ss.Length == 4?"/" + ss[2]:""), Application.Configuration);
            var name = ss.Last().Split('.')[0];
            var pss  = ss.Last().Split('?');

            if (pss.Length == 2)
            {
                var ps = pss[1].GetURLParam();
            }
            var writer = new StreamWriter(OutputBuffer);

            writer.WriteLine("HTTP/1.1 200 OK");
            writer.WriteLine("Content-Type: video/mp4");
            writer.WriteLine("Connection = Keep-Alive");
            writer.WriteLine("Transfer-Encoding = chunked");
            writer.WriteLine("");
            var stream = new OutNetMP4RTMPStream(this, Application.StreamsManager, name)
            {
                Writer = writer
            };

            InputBuffer.IgnoreAll();
            return(true);
        }
Ejemplo n.º 2
0
        public override bool OnConnection(Session session, Variant parameters, AMFObjectWriter response)
        {
            string appName = parameters[0][Defines.RM_INVOKE_PARAMS_CONNECT_APP];
            //var parameters = pFrom.CustomParameters;
            //var instanceName = index == -1?"_default_": appName.Substring(index + 1);
            var oldApplication = Application;
            var newApp         = ClientApplicationManager.SwitchRoom(this, appName, Application.Configuration);

            if (newApp != null && newApp != oldApplication)
            {
                var handler = newApp.GetProtocolHandler <BaseRtmfpAppProtocolHandler>(this);
                return(handler.CurrentProtocol.OnConnection(session, parameters, response));
            }

            if (newApp == null || (newApp == oldApplication && !Application.OnConnect(session, parameters)))
            {
                return(false);
            }

            return(true);
        }