2017-04-07 4 views
0

私はこのライブラリhereを使用していますが、このプラグインを使用してhere動画を再生しています。ASP.NETで範囲リクエストMVC - GoogleブラウザとOperaで再生できません

コード従ってください:時間を変更します。私はビデオの時間(例を変更する場合:問題

<video id="my-video" class="video-js" controls preload="auto" width="640" height="264" poster="MY_VIDEO_POSTER.jpg" data-setup="{}"> 
    <source src="@Url.Action("StreamUploadedVideo","Controller")" type='video/mp4'> 
    <p class="vjs-no-js"> 
     To view this video please enable JavaScript, and consider upgrading to a web browser that 
     <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a> 
    </p> 
</video> 

コントローラー:

[HttpGet] 
public ActionResult StreamUploadedVideo() 
{    
    byte[] test = null; 

    using (var ctx = new Entities()) 
    { 
     var result = ctx.Table.Where(x => x.Field == 4).FirstOrDefault(); 

     test = result.Movie; 

     return new RangeFileContentResult(test, "video/mp4", "Name.mp4", DateTime.Now); 
    } 
} 

ビュー1:00から10:00分)、私はこの問題に直面する以下:

Google Chromeの:A network error caused the media download to fail part-way.

オペラ:The media playback was aborted due to corruption problem or because the used features your browser did not support.

画像:ブラウザの

inserir a descrição da imagem aqui

残りは大丈夫です。 [OK]を

  • - [OK]を

  • のInternet Explorer - [OK]を

  • のFirefox - 2017年7月4日

    • Micrososftエッジ:GoogleとOperaは今日の日付のアップデートされた最新バージョンであります

      オペラ - エラー

    • Google - エラー

  • 答えて

    1

    DateTime.NowmodificationDateに使用していて、ETagLast-Modifiedのヘッダーを生成するために使用されているように、コードに問題があります。クロム(Chromeとオペラの背後のエンジン)のリクエストは条件付き(つまり、If-Match/If-None-Match/If-Modified-Since/If-Unmodified-Since)ことがあり、200 OKまたは206 Partial Contentの代わりに412 Precondition Failedとなります。基本となるコンテンツが変更されない場合は、同じ日付を使用する必要があります。

    [HttpGet] 
    public ActionResult StreamUploadedVideo() 
    { 
        byte[] test = null; 
        DateTime lastModificationDate = DateTime.MinValue; 
    
        using (var ctx = new Entities()) 
        { 
         var result = ctx.Table.Where(x => x.Field == 4).FirstOrDefault(); 
    
         test = result.Movie; 
         lastModificationDate = result.LastModificationDate; 
        } 
    
        return new RangeFileContentResult(test, "video/mp4", "Name.mp4", lastModificationDate); 
    } 
    
    +0

    タンクテック –