1

サービスから提供された映画を再生するスクリプトがあります。

<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 で正常に再生されますが、この方法でスクリプトにムービーを指定する必要があります。これは、私のムービーがデータベースに保存されるためです。

4

1 に答える 1

0

これを試してください

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) は Me.Load を処理します

Dim filePath As String = "C:\websites\Website2\wdo.mp4"
Dim Buffer As Byte() = File.ReadAllBytes(filePath)

Context.Response.Clear()
Context.Response.AddHeader("Content-Disposition", "attachment;filename=wdo.mp4")
Response.ContentType = "video/mp4"
Context.Response.BinaryWrite(Buffer)

サブ終了

于 2012-11-20T09:16:18.010 に答える