使用ASP.NET WebAPI流式传输视频 - 视频搜索问题

时间:2016-06-02 02:42:17

标签: asp.net-mvc asp.net-web-api video-streaming html5-video pushstreamcontent

我正在使用PushStreamContent异步流式传输作为BLOB托管的视频。这是我到目前为止所做的事情

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" 
       xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" 
       xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <t:RequestServerVersion Version="Exchange2013_SP1" />
  </soap:Header>
  <soap:Body>
    <m:FindItem Traversal="Shallow">
      <m:ItemShape>
        <t:BaseShape>IdOnly</t:BaseShape>
        <t:AdditionalProperties>
          <t:FieldURI FieldURI="item:Subject" />
          <t:FieldURI FieldURI="calendar:Start" />
          <t:FieldURI FieldURI="calendar:End" />
        </t:AdditionalProperties>
      </m:ItemShape>
      <m:CalendarView MaxEntriesReturned="5" StartDate="2013-08-21T17:30:24.127Z" EndDate="2013-09-20T17:30:24.127Z" />
      <m:ParentFolderIds>
        <t:FolderId Id="AAMk" ChangeKey="AgAA" />
      </m:ParentFolderIds>
    </m:FindItem>
  </soap:Body>
</soap:Envelope>

video.WriteToStream只读取文件并写入输出流。当我遵循这篇文章here时,一切都很有效。

这就是我使用video.js来传输视频的方式

    public HttpResponseMessage Get(string filename, string extension)
    {
        var video = new VideoStream(filename, extension);
        var response = Request.CreateResponse();
        response.Content =
            new PushStreamContent(
                (Action<Stream, HttpContent, TransportContext>) video.WriteToStream,
                new MediaTypeHeaderValue("video/" + extension));
        return response;
    }

当我尝试向前拖动视频时,我遇到了问题,它会重新启动视频。之前我遇到过类似的问题,原因是我错过了在上传时设置块blob的内容类型。我又错过了什么吗?

0 个答案:

没有答案