サービスから提供された映画を再生するスクリプトがあります。
<div id="player1">Loading the player ...</div>
<script type="text/javascript">
jwplayer('player1').setup({
file: "downloadvideo.aspx",
width: "296",
height: "240",
type: "mp4",
});
</script>
ムービー ファイルを提供するフォーム ロード イベントは次のとおりです。
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim filePath As String = "C:\websites\Website2\wdo.mp4"
Dim Buffer As Byte() = File.ReadAllBytes(filePath)
Context.Response.Clear()
Context.Response.Cache.SetCacheability(HttpCacheability.Public)
Context.Response.Cache.SetLastModified(DateTime.Now)
Context.Response.AppendHeader("Content-Type", "video/mp4")
Context.Response.AddHeader("Content-Disposition", "attachment;filename=wdo.mp4")
Context.Response.AppendHeader("Content-Length", Buffer.Length.ToString())
Context.Response.BinaryWrite(Buffer)
End Sub
これは、Internet Explorer、Google Chrome、Firefox で機能します。しかし、サファリではありません。
Safari では、永久に回転するプログレス サークルがあります。
スクリプトにムービー ファイルを直接指定すると、Safari で正常に再生されますが、この方法でスクリプトにムービーを指定する必要があります。これは、私のムービーがデータベースに保存されるためです。