Exemplo n.º 1
0
        public RtmpClient(Uri uri, SerializationContext context)
        {
            if (uri == null)
            {
                throw new ArgumentNullException("uri");
            }
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            var scheme = uri.Scheme.ToLowerInvariant();

            if (scheme != "rtmp" && scheme != "rtmps")
            {
                throw new ArgumentException("only rtmp:// and rtmps:// schemes are supported");
            }

            if (uri.Port == -1)
            {
                uri = new Uri(uri.Scheme + "://" + uri.Host + ":1935" + uri.PathAndQuery);
            }

            this.uri        = uri;
            this.context    = context;
            this.appName    = uri.AbsolutePath.Split('/').Skip(1).Reverse().Skip(1).Reverse().JoinStrings("/");
            this.streamName = uri.PathAndQuery.Split('/').Last();

            this.callbackManager = new TaskCallbackManager <int, object>();
        }
        public RtmpProxySource(SerializationContext serializationContext)
        {
            if (serializationContext == null) throw new ArgumentNullException("serializationContext");

            this.serializationContext = serializationContext;
            callbackManager = new TaskCallbackManager<int, object>();
        }
Exemplo n.º 3
0
 public RtmpProxySource(SerializationContext serializationContext)
 {
     if (serializationContext == null)
     {
         throw new ArgumentNullException("serializationContext");
     }
     this._serializationContext = serializationContext;
     this._callbackManager      = new TaskCallbackManager <int, object>();
 }
Exemplo n.º 4
0
 public RtmpConnect(Socket client_socket, Stream stream, RtmpServer server, ushort client_id, SerializationContext context, ObjectEncoding objectEncoding = ObjectEncoding.Amf0, bool asyncMode = false)
 {
     ClientId            = client_id;
     clientSocket        = client_socket;
     this.server         = server;
     this.objectEncoding = objectEncoding;
     writer = new RtmpPacketWriter(new AmfWriter(stream, context, ObjectEncoding.Amf0, asyncMode), ObjectEncoding.Amf0);
     reader = new RtmpPacketReader(new AmfReader(stream, context, asyncMode));
     reader.EventReceived += EventReceivedCallback;
     reader.Disconnected  += OnPacketProcessorDisconnected;
     writer.Disconnected  += OnPacketProcessorDisconnected;
     callbackManager       = new TaskCallbackManager <int, object>();
 }
Exemplo n.º 5
0
        public RtmpClient(Uri uri, SerializationContext serializationContext)
        {
            if (uri == (Uri)null)
            {
                throw new ArgumentNullException("uri");
            }
            if (serializationContext == null)
            {
                throw new ArgumentNullException("serializationContext");
            }
            string lowerInvariant = uri.Scheme.ToLowerInvariant();

            if (lowerInvariant != "rtmp" && lowerInvariant != "rtmps")
            {
                throw new ArgumentException("Only rtmp:// and rtmps:// connections are supported.");
            }
            this._uri = uri;
            this._serializationContext = serializationContext;
            this._callbackManager      = new TaskCallbackManager <int, AcknowledgeMessageExt>();
        }
Exemplo n.º 6
0
        public RtmpClient(Uri uri, SerializationContext serializationContext)
        {
            if (uri == null)
            {
                throw new ArgumentNullException("uri");
            }
            if (serializationContext == null)
            {
                throw new ArgumentNullException("serializationContext");
            }

            var scheme = uri.Scheme.ToLowerInvariant();

            if (scheme != "rtmp" && scheme != "rtmps")
            {
                throw new ArgumentException("Only rtmp:// and rtmps:// connections are supported.");
            }

            this.uri = uri;
            this.serializationContext = serializationContext;
            callbackManager           = new TaskCallbackManager <int, object>();
        }
Exemplo n.º 7
0
        public RtmpClient(Uri uri, SerializationContext context)
        {
            if (uri == null)
            {
                throw new ArgumentNullException(nameof(uri));
            }
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var scheme = uri.Scheme.ToLowerInvariant();

            if (scheme != "rtmp" && scheme != "rtmps")
            {
                throw new ArgumentException($"the scheme {scheme} is not supported. only rtmp:// and rtmps:// schemes are supported");
            }

            this.uri             = uri;
            this.context         = context;
            this.callbackManager = new TaskCallbackManager <int, object>();
        }