Ejemplo n.º 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);
        }