Smile

Smile

  • 1.5k
  • 198
  • 36.5k

Video getting paused on timer and update panel on timer tick

Feb 1 2018 3:48 AM
In an asp page i am displaying both image as well as vidoe.For displaying image i am using image asp control for video i have embbed media player.I am displaying images from a local folder in time basis using timer. on timer tick event video is getting paused/halt till the image is getting updated.
 
aspx code
  1. <style type="text/css">  
  2. #form1 {  
  3. .floatleft  
  4. {  
  5. float: left;  
  6. margin: 0 0 10px 10px;  
  7. border: 1px solid #666;  
  8. padding: 2px;  
  9. }  
  10. .floatright  
  11. {  
  12. float: right;  
  13. margin: 0 0 10px 10px;  
  14. border: 1px solid #666;  
  15. padding: 2px;  
  16. }  
  17. </style>  
  18. <form id="form1" runat="server">  
  19. <asp:Button ID="btnCreateXML" runat="server" Text="CreateXMLTwofiles" OnClick="btnCreateXML_Click" />  
  20. <asp:Button ID="btnCreateXMLSingleFile" runat="server" Text="CreateXMLSingleFile" OnClick="btnCreateXMLSingleFile_Click" />  
  21. <asp:ScriptManager ID="ScriptManager1" runat="server">  
  22. </asp:ScriptManager>  
  23. <asp:Button ID="btnDisp" runat="server" Text="Download" OnClick="btnDisp_Click" Visible="false" />  
  24. <asp:Button ID="btnStartDisp" runat="server" Text="Display" OnClick="btnStartDisp_Click" Visible="false"/>  
  25. <asp:Button ID="btnTestXml" runat="server" Text="Display Single File" OnClick="btnTestXml_Click" />  
  26. <asp:UpdatePanel ID="BannerPanel" runat="server" UpdateMode="Always" >  
  27. <ContentTemplate>  
  28. <asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Interval="5000" Enabled="false" >  
  29. </asp:Timer>  
  30. <asp:Button ID="btnReadXml" runat="server" Text="Display from FTP" OnClick="btnReadXml_Click" />  
  31. <asp:Panel ID="Panel1" runat="server" Height="370px" Width="428px" CssClass="floatleft">  
  32. <asp:Image ID="Image1" runat="server" Height="360px" Width="425px" />  
  33. </asp:Panel>  
  34. </ContentTemplate>  
  35. </asp:UpdatePanel>  
  36. <embed id='embed1' runat="server" name='mediaPlayer' type='application/x-mplayer2' pluginspage='http://microsoft.com/windows/mediaplayer/en/download/' displaysize='4' autosize='-1' bgcolor='darkblue' showcontrols='false' showtracker='-1' showdisplay='0' showstatusbar='-1' videoborder3d='-1' width='500' designtimesp='5311' loop='true' style="position:absolute; top: 76px; left: 446px; height: 363px;"/>  
  37. </form>  
code behind
  1. protected void Timer1_Tick(object sender, EventArgs e)  
  2. {  
  3. try  
  4. {  
  5. DispImagesDataset();  
  6. }  
  7. catch (Exception)  
  8. {  
  9. throw;  
  10. }  
  11. }  
  12. private void DispImagesDataset()  
  13. {  
  14. try  
  15. {  
  16. IndexTmr = Convert.ToInt16(Session["tmrindex"]);  
  17. DataSet Ds = Session["ImageDataset"as DataSet;  
  18. if (IndexTmr <= Ds.Tables[0].Rows.Count - 1)  
  19. {  
  20. string Filename = Ds.Tables[0].Rows[IndexTmr]["ImageName"].ToString();  
  21. int seq = Convert.ToInt16(Ds.Tables[0].Rows[IndexTmr]["SeqNo"]);  
  22. int DispTime = Convert.ToInt16(Ds.Tables[0].Rows[IndexTmr]["DisplayTimeout"]);  
  23. string ext = Path.GetExtension(Filename);  
  24. string localstr = Server.MapPath("~//bin//Images//" + Filename);  
  25. Byte[] bytes = File.ReadAllBytes(localstr);  
  26. string base64String = Convert.ToBase64String(bytes, 0, bytes.Length);  
  27. Image1.ImageUrl = "data:image/" + ext + ";base64," + base64String;  
  28. Image1.Visible = true;  
  29. Timer1.Interval = DispTime * 1000;  
  30. IndexTmr = IndexTmr + 1;  
  31. Session["tmrindex"] = IndexTmr;  
  32. }  
  33. else  
  34. {  
  35. IndexTmr = 0;  
  36. Session["tmrindex"] = IndexTmr;  
  37. }  
  38. }  
  39. catch (Exception ex)  
  40. {  
  41. throw;  
  42. }  
  43. }  
for pasiing the playlist to media player
  1. string urlstr = Server.MapPath("~/bin") + "\\Images\\Playlist1.wpl";  
  2. embed1.Attributes.Add("src", urlstr);  
Any suggestion
 
thanxs in advance