You must Sign In to post a response.
  • Category: ASP.NET

    Update panel and timer pausing video in WMP

    I in a web form i need to display images as well as videos.For displaying images i have used a asp image control and using ajax update panel and timer i will be showing list of images
    on regular interval of time.for displaying videos i am using object type windows media player and assigning a playlist to it.My problem is when image is being updated i.e timer tick event ,video is getting paused and resuming .

    aspx code:

    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="BannerPanel" runat="server" UpdateMode="Conditional">


    <ContentTemplate>

    <asp:Image ID="Image1" runat="server" Height="360px" Width="425px" Visible="true" />

    <asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Interval="5000" >

    </asp:Timer>

    </ContentTemplate>
    <Triggers>
    <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
    </Triggers>


    </asp:UpdatePanel>

    <asp:Panel ID="Panel2" runat="server" Height="370px" Width="428px" CssClass="floatright">
    <object id="VIDEO" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"

    style="position:absolute; top: 76px; left: 446px; height: 374px; width: 474px;" >
    <param name="url" value="<%=mySrc %>" />
    <param name="src" value="<%=mySrc %>" />
    <param name="SendPlayStateChangeEvents" value="True" />
    <param name="animationatstart" value="true" />
    <param name="autostart" value="true" />
    <%--<param name="autostart" value="true" />--%>
    <param name="showcontrols" value="true" />
    <param name="ShowStatusBar" value="true" />
    <param name ="playCount" value="999999999" />
    </object>
    </asp:Panel>


    code behind code:
    protected void Timer1_Tick(object sender, EventArgs e)
    {
    NameValueCollection list = Session["ImagesLIst"] as NameValueCollection;
    if(list != null)
    {

    IndexTmr= Convert.ToInt16(Session["tmrindex"]);


    if (IndexTmr <= list.Count )
    {



    string ext = ".bmp";

    string localstr = list[IndexTmr];
    Byte[] bytes = File.ReadAllBytes(localstr);
    string base64String = Convert.ToBase64String(bytes, 0, bytes.Length);

    Image1.ImageUrl = "data:image/" + ext + ";base64," + base64String;

    IndexTmr = Convert.ToInt16(Session["tmrindex"]);

    IndexTmr = IndexTmr + 1;
    Session["tmrindex"] = IndexTmr;
    }

    else
    {
    IndexTmr = 1;
    Session["tmrindex"] = IndexTmr;
    }

    }

    }

    protected void btnPlay_Click(object sender, EventArgs e)
    {
    mySrc=@"E:\AspEx\bin\Images\Playlist1.wpl";


    }
  • #769540
    Yes. If a postback event is called even if it triggers the video object control will be the freeze. It's better, you can use a webservice. By using setInterval jQuery function you can call an ajax webservice and do the code what you have implemented. So, the page will not be the post and the video also will be getting played continuously.
    Regards,
    V.M. Damodharan
    "Your talent will be worthless, when you have fear and tension."


  • Sign In to post your comments