Dynamic Javascript

rcombs4

Well-known member
Joined
Aug 6, 2008
Messages
189
Programming Experience
3-5
Hey guys, I'm building a Usercontrol that will accept a parameter and show the appropriate video. The Video is shown using OSPlayer, which is a free .FLV player. The video gets embed into the page by placing a line of JavaScript where the video is to be shown.

My Usercontrol basically takes a Literal control and sets the text of the literal control to be the JavaScript line to show the video. I've found that in Chrome this works great but in IE and Firefox the video does not get shown. I'm assuming this is because some sort of execution order issue. I'm thinking the dynamic JavaScript i insert into the page gets parsed before a line where I include the needed .js file.



Here is my User Control
VB.NET:
 Public Sub LoadVideo(ByVal strUserID As String)
        If strUserID = "" Then
            Exit Sub
        End If

        'Get VideoID
       ...
        
        Dim videoGUID As String = <DB CALL>

        If videoGUID = "" Then
            Exit Sub
        End If

        Dim dal As New MyDAL

        Dim vidPath As String = dal.GetSiteVar("siteurl") & "UserPictures/"

        If IO.File.Exists(Server.MapPath("~/UserPictures/" & videoGUID & ".flv")) Then
            litVid.Text = strVideoEmbed.Replace(":VIDEO:", vidPath & videoGUID & ".flv").Replace(":THUMB:", vidPath & videoGUID & ".flv_thumb.jpg")            
        Else
            lblVideo.Text = ""
        End If
    End Sub


The result is the following
VB.NET:
<script language='javascript'>AC_FL_RunContent('codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0', 'width', '360', 'height', '250', 'src', ((!DetectFlashVer(9, 0, 0) && DetectFlashVer(8, 0, 0)) ? 'OSplayer' : 'OSplayer'), 'pluginspage', 'http://www.macromedia.com/go/getflashplayer', 'id', 'flvPlayer', 	'allowFullScreen', 'true', 'allowScriptAccess', 'always', 'movie', ((!DetectFlashVer(9, 0, 0) && DetectFlashVer(8, 0, 0)) ? 'OSplayer' : 'OSplayer'), 'FlashVars', 	'movie=http://www.<MYSITE>.com/UserPictures/9cc4f779-4bd1-409f-89da-6bc3387bd652.flv&btncolor=0x333333&accentcolor=0x31b8e9&txtcolor=0xdddddd&volume=30&autoload=on&autoplay=off');</script>


As I said before, In chrome my video is shown. In IE and Firefox nothing gets shown. Also in IE and Firefox all my css is ignored. I've copied the html code that is generated and placed it in an HTML file and i can see the video in all browsers. That is what leads me to believe that it has to be some sort of execution order issue. I've placed the call to LoadVideo in the page load and page init and the results were the same.

Any thoughts would be greatly appreciated.
 
Back
Top