我正在尝试为嵌入了swf对象的Flow Player flv播放器执行ASP.net自定义控件。使用Steve Orr Controls我了解到您可以嵌入javascript文件并注册它们,这样您就不必总是手动添加javascript文件。我想知道这是否适用于SWF文件。
我一直在网上阅读,我想弄清楚我是否疯狂寻找无法完成的事情?或者也许我假设我可以使这个XXYYWW122313 URL有用吗?
我正在获取网址,但是当我尝试在渲染时显示视频< A>根据flowman网站的说明标记。此外,我一直在研究其他可用的flv播放器,仍然存在如何嵌入swf flash视频播放器和使用webresource网址的问题。
简而言之,我正在做的是:
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
答案 0 :(得分:1)
您是否确定已将嵌入资源标记为解决方案的“嵌入式资源”,以便将其与已编译的代码捆绑在一起?
此外,切换到WebResource而不是ScriptResource。
谷歌搜索也有很多教程。试试Understanding ScriptResource and WebResource in ASP.NET
答案 1 :(得分:0)
我发现,自从http://www.aspnetflash.com/的人员拖放到网站区域后,它就不会添加单独的swf文件。我决定使用他们的工具。我尝试过JW Player和FlowPlayer,还有另一个SWF支架。当我在ASP网页中使用它时,它总是空白,每个路径都设置正确。我还将mime类型添加到IIS服务器和默认网站。我尝试了一些网站上提到的HTTP处理程序FlashSomething,但没有运气。