在 ASP 中嵌入资源 SWF Flash 视频播放器?
我正在尝试为嵌入了 swf 对象的 Flow Player flv 播放器执行 ASP.net 自定义控件。 通过 Steve Orr Controls,我了解到您可以嵌入 javascript 文件并注册它们,这样您就不必总是添加手动创建 javascript 文件。 我想知道这是否也适用于 SWF 文件。
我一直在网上阅读,我想弄清楚我是否疯狂地寻找一些无法完成的事情? 或者也许我假设我可以使这个 XXYYWW122313 URL 有用?
我正在获取网址,但是当我尝试在渲染的 << 中显示视频时 A> 按照 Flowman 站点的说明进行标记。 另外,我一直在研究其他可用的 flv 播放器,但问题仍然是如何嵌入 swf flash 视频播放器和使用网络资源 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
I am trying to do an ASP.net custom control for the Flow Player flv player that has the swf object embedded. With Steve Orr Controls I learned that you can embed javascript files and register them so you don't have to always add the javascript files manually. I am wondering if this holds true to SWF files.
I have been reading all over the net and I am trying to figure out if I am crazy looking for something that cant be done? Or maybe I am assuming that I can make this XXYYWW122313 URL can be useful?
I am getting the urls but when I try to show the video in the rendered < A > tags as per instructions by the flowman site. Also I have been researching the other flv players available, still the question remains on how to embed the swf flash video player and using the webresource url.
In short what I am doing is the following:
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否确保将嵌入式资源标记为解决方案的“嵌入式资源”,以便将其与编译的代码捆绑在一起?
另外,切换到 WebResource 而不是 ScriptResource。
谷歌搜索也有很多教程。 尝试了解 ScriptResource 和ASP.NET 中的 WebResource
Did you make sure you marked the embedded resource as an "Embedded Resource" for the solution, so that it bundled it in with the compiled code?
Also, switch to WebResource instead of ScriptResource.
Google searches have a lot of tutorials too. Try Understanding ScriptResource and WebResource in ASP.NET
我发现这是可以做到的,因为 http://www.aspnetflash.com/ 的人们当您拖放到网站区域时,它不会添加单独的 swf 文件。 我决定改用他们的工具。 我尝试了 JW Player 和 FlowPlayer,还有另一个独立的 SWF。 当我在 ASP 网页中使用它们时,它总是显示为空白,每个路径都设置正确。 我还将 MIME 类型添加到 IIS 服务器和默认网站。 我尝试了一些网站上提到的 HTTP 处理程序 FlashSomething,但没有成功。
What I discovered is that it can be done since the people at http://www.aspnetflash.com/ when you drag and drop to the website area it doesn't add a separate swf file. I decided to use their tool instead. I tried JW Player and FlowPlayer and there was another SWF stand alone. When I used them in an ASP webpage it always came out blank, every path set up correctly. I also added the mime types to the IIS Server and Default Website. I tried the HTTP handler FlashSomething that is mentioned on some sites but no luck.