Esempio n. 1
0
        internal virtual GetMediaResponse GetMedia(GetMediaRequest request)
        {
            var marshaller   = GetMediaRequestMarshaller.Instance;
            var unmarshaller = GetMediaResponseUnmarshaller.Instance;

            return(Invoke <GetMediaRequest, GetMediaResponse>(request, marshaller, unmarshaller));
        }
Esempio n. 2
0
        public GetMediaResponse GetMediaStream(GetMediaRequest request)
        {
            var resp = new GetMediaResponse();

            var session = FindSession(request.SessionId);

            if (session != null)
            {
                Stream stream = null;
                if (request.MediaId.HasValue)
                {
                    stream = _cache.GetMediaDataStream(request.MediaId.Value);
                }
                else
                {
                    stream = _cache.GetMediaDataStream(request.OldMediaId.Value);
                }

                return(new GetMediaResponse()
                {
                    RequestId = request.RequestId,
                    SessionId = request.SessionId,
                    MediaId = request.MediaId,
                    OldMediaId = request.OldMediaId,
                    Stream = stream,
                    StatusDescription = string.Empty,
                    Status = (int)HttpStatusCode.OK
                });
            }
            else
            {
                return(Fail <GetMediaResponse>(request, HttpStatusCode.Forbidden, "Must login first."));
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetMedia operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetMedia operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/kinesis-video-media-2017-09-30/GetMedia">REST API Reference for GetMedia Operation</seealso>
        public virtual Task <GetMediaResponse> GetMediaAsync(GetMediaRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = GetMediaRequestMarshaller.Instance;
            var unmarshaller = GetMediaResponseUnmarshaller.Instance;

            return(InvokeAsync <GetMediaRequest, GetMediaResponse>(request, marshaller,
                                                                   unmarshaller, cancellationToken));
        }
Esempio n. 4
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetMedia operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetMedia operation on AmazonKinesisVideoMediaClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        ///
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetMedia
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/kinesis-video-media-2017-09-30/GetMedia">REST API Reference for GetMedia Operation</seealso>
        public virtual IAsyncResult BeginGetMedia(GetMediaRequest request, AsyncCallback callback, object state)
        {
            var marshaller   = new GetMediaRequestMarshaller();
            var unmarshaller = GetMediaResponseUnmarshaller.Instance;

            return(BeginInvoke <GetMediaRequest>(request, marshaller, unmarshaller,
                                                 callback, state));
        }
        /// <summary>
        /// Initiates the asynchronous execution of the GetMedia operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetMedia operation on AmazonKinesisVideoMediaClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        ///
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetMedia
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/kinesis-video-media-2017-09-30/GetMedia">REST API Reference for GetMedia Operation</seealso>
        public virtual IAsyncResult BeginGetMedia(GetMediaRequest request, AsyncCallback callback, object state)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = GetMediaRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetMediaResponseUnmarshaller.Instance;

            return(BeginInvoke(request, options, callback, state));
        }
        /// <summary>
        /// Use this API to retrieve media content from a Kinesis video stream. In the request,
        /// you identify stream name or stream Amazon Resource Name (ARN), and the starting chunk.
        /// Kinesis Video Streams then returns a stream of chunks in order by fragment number.
        ///
        ///  <note>
        /// <para>
        ///  You must first call the <code>GetDataEndpoint</code> API to get an endpoint to which
        /// you can then send the <code>GetMedia</code> requests.
        /// </para>
        ///  </note>
        /// <para>
        /// When you put media data (fragments) on a stream, Kinesis Video Streams stores each
        /// incoming fragment and related metadata in what is called a "chunk." For more information,
        /// see . The <code>GetMedia</code> API returns a stream of these chunks starting from
        /// the chunk that you specify in the request.
        /// </para>
        ///
        /// <para>
        /// The following limits apply when using the <code>GetMedia</code> API:
        /// </para>
        ///  <ul> <li>
        /// <para>
        /// A client can call <code>GetMedia</code> up to five times per second per stream.
        /// </para>
        ///  </li> <li>
        /// <para>
        /// Kinesis Video Streams sends media data at a rate of up to 25 megabytes per second
        /// (or 200 megabits per second) during a <code>GetMedia</code> session.
        /// </para>
        ///  </li> </ul>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the GetMedia service method.</param>
        ///
        /// <returns>The response from the GetMedia service method, as returned by KinesisVideoMedia.</returns>
        /// <exception cref="Amazon.KinesisVideoMedia.Model.ClientLimitExceededException">
        /// Kinesis Video Streams has throttled the request because you have exceeded the limit
        /// of allowed client calls. Try making the call later.
        /// </exception>
        /// <exception cref="Amazon.KinesisVideoMedia.Model.ConnectionLimitExceededException">
        /// Kinesis Video Streams has throttled the request because you have exceeded the limit
        /// of allowed client connections.
        /// </exception>
        /// <exception cref="Amazon.KinesisVideoMedia.Model.InvalidArgumentException">
        /// The value for this input parameter is invalid.
        /// </exception>
        /// <exception cref="Amazon.KinesisVideoMedia.Model.InvalidEndpointException">
        /// Status Code: 400, Caller used wrong endpoint to write data to a stream. On receiving
        /// such an exception, the user must call <code>GetDataEndpoint</code> with <code>AccessMode</code>
        /// set to "READ" and use the endpoint Kinesis Video returns in the next <code>GetMedia</code>
        /// call.
        /// </exception>
        /// <exception cref="Amazon.KinesisVideoMedia.Model.NotAuthorizedException">
        /// Status Code: 403, The caller is not authorized to perform an operation on the given
        /// stream, or the token has expired.
        /// </exception>
        /// <exception cref="Amazon.KinesisVideoMedia.Model.ResourceNotFoundException">
        /// Status Code: 404, The stream with the given name does not exist.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/kinesis-video-media-2017-09-30/GetMedia">REST API Reference for GetMedia Operation</seealso>
        public virtual GetMediaResponse GetMedia(GetMediaRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = GetMediaRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetMediaResponseUnmarshaller.Instance;

            return(Invoke <GetMediaResponse>(request, options));
        }
Esempio n. 7
0
        /// <summary>
        /// Use this API to retrieve media content from a Kinesis video stream. In the request,
        /// you identify the stream name or stream Amazon Resource Name (ARN), and the starting
        /// chunk. Kinesis Video Streams then returns a stream of chunks in order by fragment
        /// number.
        ///
        ///  <note>
        /// <para>
        /// You must first call the <code>GetDataEndpoint</code> API to get an endpoint. Then
        /// send the <code>GetMedia</code> requests to this endpoint using the <a href="https://docs.aws.amazon.com/cli/latest/reference/">--endpoint-url
        /// parameter</a>.
        /// </para>
        ///  </note>
        /// <para>
        /// When you put media data (fragments) on a stream, Kinesis Video Streams stores each
        /// incoming fragment and related metadata in what is called a "chunk." For more information,
        /// see <a href="https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/API_dataplane_PutMedia.html">PutMedia</a>.
        /// The <code>GetMedia</code> API returns a stream of these chunks starting from the chunk
        /// that you specify in the request.
        /// </para>
        ///
        /// <para>
        /// The following limits apply when using the <code>GetMedia</code> API:
        /// </para>
        ///  <ul> <li>
        /// <para>
        /// A client can call <code>GetMedia</code> up to five times per second per stream.
        /// </para>
        ///  </li> <li>
        /// <para>
        /// Kinesis Video Streams sends media data at a rate of up to 25 megabytes per second
        /// (or 200 megabits per second) during a <code>GetMedia</code> session.
        /// </para>
        ///  </li> </ul> <note>
        /// <para>
        /// If an error is thrown after invoking a Kinesis Video Streams media API, in addition
        /// to the HTTP status code and the response body, it includes the following pieces of
        /// information:
        /// </para>
        ///  <ul> <li>
        /// <para>
        ///  <code>x-amz-ErrorType</code> HTTP header – contains a more specific error type in
        /// addition to what the HTTP status code provides.
        /// </para>
        ///  </li> <li>
        /// <para>
        ///  <code>x-amz-RequestId</code> HTTP header – if you want to report an issue to AWS,
        /// the support team can better diagnose the problem if given the Request Id.
        /// </para>
        ///  </li> </ul>
        /// <para>
        /// Both the HTTP status code and the ErrorType header can be utilized to make programmatic
        /// decisions about whether errors are retry-able and under what conditions, as well as
        /// provide information on what actions the client programmer might need to take in order
        /// to successfully try again.
        /// </para>
        ///
        /// <para>
        /// For more information, see the <b>Errors</b> section at the bottom of this topic, as
        /// well as <a href="https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/CommonErrors.html">Common
        /// Errors</a>.
        /// </para>
        ///  </note>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the GetMedia service method.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        ///
        /// <returns>The response from the GetMedia service method, as returned by KinesisVideoMedia.</returns>
        /// <exception cref="Amazon.KinesisVideoMedia.Model.ClientLimitExceededException">
        /// Kinesis Video Streams has throttled the request because you have exceeded the limit
        /// of allowed client calls. Try making the call later.
        /// </exception>
        /// <exception cref="Amazon.KinesisVideoMedia.Model.ConnectionLimitExceededException">
        /// Kinesis Video Streams has throttled the request because you have exceeded the limit
        /// of allowed client connections.
        /// </exception>
        /// <exception cref="Amazon.KinesisVideoMedia.Model.InvalidArgumentException">
        /// The value for this input parameter is invalid.
        /// </exception>
        /// <exception cref="Amazon.KinesisVideoMedia.Model.InvalidEndpointException">
        /// Status Code: 400, Caller used wrong endpoint to write data to a stream. On receiving
        /// such an exception, the user must call <code>GetDataEndpoint</code> with <code>AccessMode</code>
        /// set to "READ" and use the endpoint Kinesis Video returns in the next <code>GetMedia</code>
        /// call.
        /// </exception>
        /// <exception cref="Amazon.KinesisVideoMedia.Model.NotAuthorizedException">
        /// Status Code: 403, The caller is not authorized to perform an operation on the given
        /// stream, or the token has expired.
        /// </exception>
        /// <exception cref="Amazon.KinesisVideoMedia.Model.ResourceNotFoundException">
        /// Status Code: 404, The stream with the given name does not exist.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/kinesis-video-media-2017-09-30/GetMedia">REST API Reference for GetMedia Operation</seealso>
        public virtual Task <GetMediaResponse> GetMediaAsync(GetMediaRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = GetMediaRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetMediaResponseUnmarshaller.Instance;

            return(InvokeAsync <GetMediaResponse>(request, options, cancellationToken));
        }
Esempio n. 8
0
        public async Task <IActionResult> GetMedia([FromQuery] GetMediaRequest request)
        {
            var media = await _mediaService.GetMedia(request);

            if (media == null)
            {
                return(NotFound());
            }

            return(new FileStreamResult(media.Stream, media.Item.ContentType));
        }
Esempio n. 9
0
 public Task <DelMediaResponse> DelMediaAsync(GetMediaRequest request)
 {
     return(WeChatOfficialApiRequester.RequestAsync <DelMediaResponse>(DelMaterialUrl,
                                                                       HttpMethod.Post,
                                                                       request));
 }