Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,

I am designing a web page that will play list of videos in a loop.The video path list is comming from an xml file.I am assigning the video path from the code behind cs class of the asp.net page.
HTML CODE :
ASP.NET
<div>
             <video id="videotag" loop width="1000px" height="700px" autoplay  runat="server">
              
             </video>
           </div>



CODE BEHIND :
C#
XmlDataDocument xmldoc = new XmlDataDocument();
        XmlNodeList xmlnode;        
        FileStream fs = new FileStream(Server.MapPath("VideoData.xml"), FileMode.Open, FileAccess.Read);
        xmldoc.Load(fs);
        xmlnode = xmldoc.GetElementsByTagName("FILE");
        HtmlGenericControl control = new HtmlGenericControl("source");
        for (int i = 0; i <= xmlnode.Count - 1; i++)
        {
            
            control.Attributes.Add("src", "videos\\" + xmlnode[i].ChildNodes.Item(0).InnerText.ToString());
            control.Attributes.Add("type","video/mp4");
            videotag.Controls.Add(control);            
            
        } 


Currently I have having 4 videos in the list ,but its only replaying the first video of the list.Please help me if iam doing any mistake assigning the video path.

Thanks in advance.
Posted
Comments
Arasappan 27-Aug-15 2:10am    
y is auto play .. video tag
pranav8265 27-Aug-15 2:45am    
autoplay in video tag automatically starts playing video on page load
Arasappan 27-Aug-15 2:46am    
are u need that it works are not.. there is no need to put autoplay="true"
pranav8265 27-Aug-15 2:51am    
if i dont put autoplay then the video dont play at all

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900