views:

1144

answers:

2

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
A: 

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.

ThorDivDev
+1  A: 

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

Mufasa
Ok, I will try this and tell you the results. Thanks for your help.
ThorDivDev
Yes I did, I added it to the Assembly and am trying to use it but it seems it needs a recognizable file name. Web ######### doesn't cut it.
ThorDivDev