Gaurav Pal

Gaurav Pal

  • NA
  • 306
  • 68.7k

How do stop a previous audio file when another audio start

Jun 8 2016 4:40 AM
Hi
 
i want to now that, How do i am stop a previous audio file when another audio file starts in datalist. Below is my code for datalist. Here red area shows my audio file binding control.
 
My problem is when i play one audio file and then play next audio file previous file is not stoped. 
 
<asp:DataList ID="dlbrowsevents" OnItemDataBound="dlbrowsevents_ItemDataBound" RepeatColumns="3" runat="server">
<ItemTemplate>
<div class="col-xs-12 col-sm-12 event1">
<asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("Image") %>' class="img-responsive" Width="700px" Height="250px" />
<asp:Panel ID="pnltime" Visible="true" runat="server">
<p>
<asp:Label ID="lblStartDate" runat="server" Text='<%# Eval("StartDate","{0:dd/MM/yyyy}") %>'></asp:Label>
<asp:Label ID="lblStartTime" runat="server" Text='<%# Eval("StartTime") %>'></asp:Label><br />
</p></asp:Panel>
<asp:Panel ID="pnlmusic" Visible="false" runat="server">
<div id="divmusic" runat="server">
<div class="form-group">
<audio controls="controls" loop="loop" style="height:25px; width:100%" >
<source src='<%# Eval("MusicUpload") %>' type="audio/ogg" /> </audio>
</div>
</div>
</asp:Panel>
<h5>
<b>
<asp:Label ID="lblLocation" runat="server" Text='<%# Eval("EventTitle") %>'></asp:Label>
</b>
</h5>
<asp:HiddenField ID="hdfdStatusType" Value='<%# Eval("StatusType") %>' runat="server" />
<hr>
</div>
</div>
</ItemTemplate>
</asp:DataList>