Ejemplo n.º 1
0
 //
 // GET: /Video/
 public HttpResponseMessage Get(string id)
 {
     var driver = new Driver();
     var videoStream = new VideoStream(driver.DownloadStream(id));
     var response = Request.CreateResponse();
     response.Content = new PushStreamContent(videoStream.WriteToStream, new MediaTypeHeaderValue("video/mp4"));
     return response;
 }
Ejemplo n.º 2
0
        public HttpResponseMessage GetImage(string id)
        {
            var response = Request.CreateResponse();
            try
            {
                var driver = new Driver();
                var videoStream = new VideoStream(driver.DownloadThumbnail(id));

                response.Content = new PushStreamContent(videoStream.WriteToStream, new MediaTypeHeaderValue("image/jpeg"));
                return response;
            }
            catch(Exception e)
            {
                response.StatusCode = HttpStatusCode.NotFound;
                response.ReasonPhrase = e.Message;
                return response;
            }
        }