asp.net - Programmically set JWPlayer to play file from database -
i have querystring on page load use filename , thumbnail image jwplayer. not getting filename or thumbname, however. there must reasson why can't on aspx page, vb code behind.see code:
code behind (vb): protected sub page_load(sender object, e system.eventargs) handles me.load dim videoname string = request.querystring("filename") dim thumb string = request.querystring("thumb") end sub
and need these string variables .aspx page jwplayer script, not
.aspx: <div id='container'></div> <script type="text/javascript" src="~/player/jwplayer.js</script> <script type="text/javascript"> jwplayer("container").setup({ file: videoname, flashplayer: '~/player/player.swf', volume: 35, width: 480, height: 270, skin: '~/player/skins/skin.zip', image: thumb, }) </script>
this ho solved it
code behind (vb): protected sub page_load(sender object, e system.eventargs) handles me.load dim videoname string = request.querystring("filename") dim thumb string = request.querystring("thumb") dim dur string = request.querystring("duration").tostring() txt1.text = "~contents/published/" & videoname.tostring() txt2.text = "~/contents/thumbs/" & thumb.tostring() txt3.text = dur.tostring() end sub
now value of query string jwplayer javascript, had add javascript function inside jw script , called codeaddress(). kind of documentation not found on longtail website or tutorials or anywhere else on internet have found.
.aspx: <script type="text/javascript"> function codeaddress() { var dootoo = document.getelementbyid('<%=txt1.clientid%>').value; var doothree = document.getelementbyid('<%=txt2.clientid%>').value; var doofour = document.getelementbyid('<%=txt3.clientid%>').value; jwplayer("container").setup({ duration: doofour, file: dootoo, flashplayer: '~/player/player.swf', skin: "~/player/skins/newtubedark.zip", volume: 35, width: 685, height: 385, image: doothree, }) } window.onload = codeaddress; </script> <asp:textbox id="txt1" runat="server" style="display:none;"></asp:textbox> <asp:textbox id="txt2" runat="server" style="display:none;"></asp:textbox> <asp:textbox id="txt3" runat="server" style="display:none;"></asp:textbox>
Comments
Post a Comment