Programmically set JWPlayer to playa file from database

I have jwplayer and I need to to play a video file selected from database. I can only find where you put the file in manually to play such as file: "/output/video.mp4"

I need it to be as follows: and this does not work for some reason:

Dim strAuthor, strTitle, strWidth, strHeight, strDuration, strOriginalFile, strFLVFile, strImageFile, strUploadTime, strViews, strVideoType, strTags As String
    Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim strConn As String = "Data Source=MyDataSource"
        Dim MySQL As String = "Select * From Videos Where ID = 56"
        Dim Conn As New SqlConnection(strConn)
        Dim objDR As SqlDataReader
        Dim Cmd As New SqlCommand(MySQL, Conn)
        Conn.Open()
        objDR = Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
        While objDR.Read()
            strAuthor = objDR("Author").ToString()
            strTitle = objDR("Title").ToString()
            strWidth = objDR("Width").ToString()
            strHeight = objDR("Height").ToString()
            strDuration = objDR("Duration").ToString()
            strOriginalFile = objDR("OriginalFile").ToString()
            strFLVFile = objDR("FLVFile").ToString()
            strImageFile = objDR("ImageFile").ToString()
            strUploadTime = objDR("UploadTime").ToString()
            strViews = objDR("Views").ToString()
            strVideoType = objDR("VideoType").ToString()
            strTags = objDR("Tags").ToString()
        End While
        Conn.Close()
       
        msgs.Text = "Output/" & strFLVFile.ToString()
        
    End Sub

HTML...

<div id="container">Loading the player ...</div>    
        <script type="text/javascript">
        jwplayer("container").setup({
            flashplayer: "JWPlayer/player.swf",
            height: 350,
            width: 640,
            autostart: true,
            file: filename    <====== need this from sql data reader above "strFLVFileName"
            image: "JWPlayer/preview.jpg"
         
        });    
     </script>

Open in new window

LVL 1
mlg101Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Meir RivkinFull stack Software EngineerCommented:
use a placeholder to inject the player into your aspx page (scroll down to the solution provided):
http://forums.asp.net/t/1736036.aspx/1
mlg101Author Commented:
That is fine but I can't see where to put that in the context of what I have: an aspx page with code behind and html
Meir RivkinFull stack Software EngineerCommented:
to get the filename from datareader to your aspx page u can set a global variable using the following code:

msgs.Text = "Output/" & strFLVFile.ToString()
Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "strFLVFileName", msgs.Text);

Open in new window


this line will render the page with a global variable called strFLVFileName with the requested filename value.
then in your aspx page simply assign this variable to the jwplayer:

jwplayer("container").setup({
            flashplayer: "JWPlayer/player.swf",
            height: 350,
            width: 640,
            autostart: true,
            file: strFLVFileName,
            image: "JWPlayer/preview.jpg"

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Meir RivkinFull stack Software EngineerCommented:
to verify that the variable was indeed exists and was set to the filename from the datareader u can view the source of the page once it was loaded and look for a variable called strFLVFileName and check its value.
Amandeep Singh BhullarCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.