Why only one video shows up in ASP.NET Video panel ?

Posted by user284523 on Stack Overflow See other posts from Stack Overflow or by user284523
Published on 2010-03-20T16:05:37Z Indexed on 2010/03/20 16:11 UTC
Read the original article Hit count: 279

Filed under:

It is possible to have multiple videos with Flowplayer

http://flowplayer.org/demos/installation/multiple-players.html

To do so in ASP.NET DYNAMICALLY, one has to use a Panel (see http://idevwebs.com/Default.aspx?id=25):

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- A minimal Flowplayer setup to get you started -->


    <!-- 
        include flowplayer JavaScript file that does  
        Flash embedding and provides the Flowplayer API.
    -->
    <script type="text/javascript" src="flowplayer-3.1.4.min.js"></script>

    <!-- page title -->
    <title>Minimal Flowplayer setup</title>

</head><body>

    <form id="form1" runat="server">

    <div id="page">

        <h1>Minimal Flowplayer setup</h1>

        <p>View commented source code to get familiar with Flowplayer installation.</p>

        <!-- this A tag is where your Flowplayer will be placed. it can be anywhere -->
<!-- player #1 --> 


        <asp:Panel ID="panelVideo" runat="server">
        </asp:Panel>    
        <!-- this will install flowplayer inside previous A- tag. -->
        <script type="text/javascript">
            flowplayer("player", "flowplayer-3.1.5.swf");
        </script>



        <!-- 
            after this line is purely informational stuff. 
            does not affect on Flowplayer functionality 
        -->

        <p>     
            If you are running these examples <strong>locally</strong> and not on some webserver you must edit your 
            <a href="http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html">
                Flash security settings</a>. 
        </p>

        <p class="less">
            Select "Edit locations" &gt; "Add location" &gt; "Browse for files" and select
            flowplayer-x.x.x.swf you just downloaded.
        </p>


        <h2>Documentation</h2>

        <p>
            <a href="http://flowplayer.org/documentation/installation/index.html">Flowplayer installation</a>
        </p>

        <p>
            <a href="http://flowplayer.org/documentation/configuration/index.html">Flowplayer configuration</a>
        </p>

        <p>
            See this identical page on <a href="http://flowplayer.org/demos/example/index.htm">Flowplayer website</a> 
        </p>

    </div>


    </form>


</body></html>

and then add video anchor dynamically

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        this.panelVideo.Controls.Add(new LiteralControl("<a href=\"" + "http://blip.tv/file/get/" + "KimAronson-TwentySeconds58192" + ".flv\" style=\"display:block;width:388px;height:230px\" id=\"player\"></a>"));
        this.panelVideo.Controls.Add(new LiteralControl("<a href=\"" + "http://blip.tv/file/get/" + "KimAronson-TwentySeconds67463" + ".flv\" style=\"display:block;width:388px;height:230px\" id=\"player\"></a>"));        
    }
}

But it works only partially as the first video shows up not both. And all html below doesn't show up either.

© Stack Overflow or respective owner

Related posts about ASP.NET