Click here to Skip to main content
15,888,590 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi, I have an application where sound needs to be play as application start, I have used audio tag inside the body of master page but as we navigate to another page songs start from beginning, I know its because the master page is getting called everytime. Is there any way to play sound in whole application, without restarting the song even after navigating to other page. and how to stop and restart that song and setting volume of same for master page

THANKS
Posted
Updated 5-Oct-13 20:18pm
v2
Comments
Joezer BH 6-Oct-13 2:38am    
Not sure it's possible ...
each page is a different load, start fresh, but you can consider staying on the same page and changing the content, in frames, or HTML elements, and then of course you have full control on the sound element as well.

1 solution

You'll have to use the 'obsolete' frameset tags (to me they're the best), put your songfile in those unchanging pages and you should have no problem. A webpage doesn't need to be visible, it may just contain your song file.

A Frameset divides the page into panels, each panel populated by a webpage. When a link is clicked in a panel, it only changes the panel you are clicking on (it is possible to alter that behavior).

Therefore you should have two panels ("frames"): one for your songfile, another one for you asp.net development.

Create a new html file and use the following code (name it index.html or something):
XML
<html>
<head>
<title>This is the actual title people will see</title>
</head>
<frameset rows="0,*"><!-- with 0, the top page won't be visible -->
   <frame src="song_page.html"><!-- you'll need yet another html file for the song -->
   <frame src="My_ASP_Start_Page.aspx"> <!-- your asp.net start page -->
</frameset>
</html>


This page must become your start page in the project. Notice there is no body tag.
The song_page.html should contain your song.

The upper panel populated by song_page.html will not change when users interact with the site, because your site is in the lower panel. Hence, the song file should never interrupt cause it is not in the same frame.
 
Share this answer
 
v3
Comments
[no name] 6-Oct-13 2:55am    
Sorry but I am not getting how it will resolve this problem
Homero Rivera 6-Oct-13 3:00am    
Let me just ask; are you familiar with frameset tags?
[no name] 6-Oct-13 3:05am    
:( no
Homero Rivera 6-Oct-13 3:29am    
Please try it, I don't think I'm missing anything, but its been years since I last did this. It won't be till tomorrow when I check back how you did. The solution given above was edited to try to help you better with more details.

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