我正在尝试为嵌入了 swf 对象的Flow Player flv 播放器做一个 ASP.net 自定义控件。通过Steve Orr Controls,我了解到您可以嵌入 javascript 文件并注册它们,因此您不必总是手动添加 javascript 文件。我想知道这是否适用于 SWF 文件。
我一直在网上阅读,我想弄清楚我是否疯狂地寻找无法完成的事情?或者我假设我可以使这个 XXYYWW122313 URL 有用?
我正在获取 url,但是当我尝试按照 flowman 站点的说明在渲染的 < A > 标签中显示视频时。此外,我一直在研究其他可用的 flv 播放器,但问题仍然在于如何嵌入 swf flash 视频播放器和使用 webresource url。
简而言之,我正在做的是以下内容:
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.ComponentModel
<DefaultProperty("FlowPlayer"), ToolboxData("<{0}:FlowManHlp runat=server></{0}:FlowManHlp>")> _
Public Class FlowManHlp
Inherits Control
Private flowPlayerPath As String
Private flowPlayerJSPath As String
Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs)
MyBase.OnPreRender(e)
If Me.DesignMode Then Exit Sub
Dim rstype As Type = Me.GetType
Dim rsname As String = "FlowMan_Helper.Resources.flowplayer-3.0.5.min.js"
' Register the client resource with the page.
Dim cs As ClientScriptManager = Page.ClientScript
cs.RegisterClientScriptResource(rstype, rsname)
'cs.RegisterClientScriptResource(rstype, "FlowMan_Helper.Resources.flowplayer-3.0.5.swf")
End Sub
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
Dim htmlwrite As New System.Text.StringBuilder()
htmlwrite.Append("<a href=""http://blip.tv/file/get/KimAronson-TwentySeconds73213.flv""")
htmlwrite.Append(" Style = ""display:block;width:400px;height:300px""")
htmlwrite.Append(" id=""player""></a>")
htmlwrite.Append(vbCrLf & "<script>")
htmlwrite.Append(vbCrLf & "flowplayer(""player"", """ & flowPlayerPath & """ );")
htmlwrite.Append(vbCrLf & "</script>")
htmlwrite.Append(vbCrLf & "<script>")
htmlwrite.Append(vbCrLf & "HelloWorld();")
htmlwrite.Append(vbCrLf & "</script>")
' <script>
' flowplayer("player", "../flowplayer-3.0.5.swf");
'</script>
writer.Write(htmlwrite.ToString())
End Sub
Private Sub FlowManHlp_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
flowPlayerPath = Page.ClientScript.GetWebResourceUrl(Me.GetType(), "FlowMan_Helper.Resources.flowplayer-3.0.5.swf")
flowPlayerJSPath = Page.ClientScript.GetWebResourceUrl(Me.GetType(), "FlowMan_Helper.Resources.flowplayer-3.0.5.min.js")
flowPlayerPath = ResolveClientUrl(flowPlayerPath)
End Sub