Example #1
0
        /// <summary>
        /// Plays media files.
        /// </summary>
        /// <param name="arguments">The name of a file, start time, duration of playback, reset flag.</param>
        public void Play(params object[] arguments)
        {
            ValidationUtils.ArgumentConditionTrue(arguments != null && arguments.Length > 0, "arguments", "At least the name of a file must be specified");
            ValidationUtils.ArgumentNotNullOrEmptyOrWhitespace(arguments[0] as string, "name");
            _name   = arguments[0] as string;
            _start  = -2;
            _length = -1;
            if (arguments.Length > 1)
            {
                ValidationUtils.ArgumentConditionTrue(arguments[1] is int, "start", "Integer value required for the 'start' parameter");
                _start = (int)arguments[1];
                ValidationUtils.ArgumentConditionTrue(_start > -3, "start", "Allowed values are -2, -1, 0, or a positive number");
            }
            if (arguments.Length > 2)
            {
                ValidationUtils.ArgumentConditionTrue(arguments[2] is int, "len", "Integer value required for the 'len' parameter");
                _length = (int)arguments[2];
                ValidationUtils.ArgumentConditionTrue(_length > -2, "len", "Allowed values are -1, 0, or a positive number");
            }

            INetConnectionClient    client     = _connection.NetConnectionClient;
            RtmpConnection          connection = _connection.NetConnectionClient.Connection as RtmpConnection;
            IPendingServiceCallback callback   = new CreateStreamCallBack(this, connection, this);

            client.Call("createStream", callback);
        }
Example #2
0
        private void Connect()
        {
            if (_uri.Scheme == "http" || _uri.Scheme == "https")
            {
#if !(SILVERLIGHT)
                if (ServicePointManager.ServerCertificateValidationCallback == null)
                {
                    ServicePointManager.ServerCertificateValidationCallback = delegate(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors) { return(true); }
                }
                ;
#endif
                _netConnectionClient = new RemotingClient(this);

                // Forward on any proxy details to the RemotingClient.
                _netConnectionClient.Proxy = _proxy;

                _netConnectionClient.Connect(_uri.ToString(), _arguments);
                return;
            }
            if (_uri.Scheme.StartsWith("rtmp"))
            {
                RtmpClient netConnectionClient = new RtmpClient(this);

                // Set an rtmps URI to secure mode.
                netConnectionClient.Secure = _uri.Scheme == "rtmps" ? true : false;

                // Forward on any proxy details to the RTMPClient.
                netConnectionClient.Proxy = _proxy;

                _netConnectionClient = netConnectionClient;
                _netConnectionClient.Connect(_uri.ToString(), _arguments);
                return;
            }
            throw new UriFormatException();
        }
Example #3
0
 /// <summary>
 /// Closes the connection that was opened with the server and dispatches the netStatus event with a code property of NetConnection.Connect.Close.
 /// </summary>
 public void Close()
 {
     if (_netConnectionClient != null)
     {
         _netConnectionClient.Close();
     }
     _netConnectionClient = null;
 }
Example #4
0
 public void Close()
 {
     if (this._netConnectionClient != null)
     {
         this._netConnectionClient.Close();
     }
     this._netConnectionClient = null;
 }
Example #5
0
 private void Connect()
 {
     if (this._uri.Scheme == "http")
     {
         this._netConnectionClient = new RemotingClient(this);
         this._netConnectionClient.Connect(this._uri.ToString(), this._arguments);
     }
     else
     {
         if (this._uri.Scheme != "rtmp")
         {
             throw new UriFormatException();
         }
         this._netConnectionClient = new RtmpClient(this);
         this._netConnectionClient.Connect(this._uri.ToString(), this._arguments);
     }
 }
Example #6
0
        private void Connect()
        {
            if (_uri.Scheme == "http" || _uri.Scheme == "https")
            {
#if !(SILVERLIGHT)
                if (ServicePointManager.ServerCertificateValidationCallback == null)
                {
                    ServicePointManager.ServerCertificateValidationCallback = delegate(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors) { return(true); }
                }
                ;
#endif
                _netConnectionClient = new RemotingClient(this);
                _netConnectionClient.Connect(_uri.ToString(), _arguments);
                return;
            }
            if (_uri.Scheme == "rtmp")
            {
                _netConnectionClient = new RtmpClient(this);
                _netConnectionClient.Connect(_uri.ToString(), _arguments);
                return;
            }
            throw new UriFormatException();
        }