Persistent sound from page to page
Is there any way to have music continue playing without interruption from page to page? Aside from loading all of page contents via ajax...
Maybe load the SoundManager2.swf in a hidden popup window.
Any thoughts or solutions?
Thanks.
Maybe load the SoundManager2.swf in a hidden popup window.
Any thoughts or solutions?
Thanks.
1
person has this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
The company marked this question as answered.
The best answer from the company
-
The best short answer to this may be to quote Walter Sobchak from the movie "The Big Lebowski", and say, "You'll be entering a world of pain". ;)
That said, it is possible; you could try to keep the user on the same page and use XHR to bring in dynamic content etc., but this quickly becomes very dangerous and error-prone as you'll be then forced to stop the browser from unloading the page to follow links, the back button and so on, when unloading/loading new URLs is what it's designed to do. You will also have the challenge of keeping track of a lot of "state" in JS over time.
I don't recommend the "single page" approach for common site designs as it quickly gets very ugly, but a music player app may be somewhat appropriate for a single-page experience.
Framesets are another possibility, though they are very old-skool and have their own problems.
http://lala.com looks to do a pretty good job of the single page experience with music, where you can browse and content is loaded via JS vs. a new page, but it is not a trivial task.
I’m confident
The company says
this answers the question
Create a customer community for your own organization
Plans starting at $19/month
-
Inappropriate?I solved this kind of case simply by building a player interface inside a position:absolute div (which can additionally be minimized/maximized to hide or show the play queue) and then placing a width:100%; height:100% iframe to cover the rest of the browser view. With a setup like that I can browse my music server and enqueue tracks with surprisingly simple code.
See the attached screenshot. Sorry about the crude looks; It's still very much in alpha state.
-
Inappropriate?The best short answer to this may be to quote Walter Sobchak from the movie "The Big Lebowski", and say, "You'll be entering a world of pain". ;)
That said, it is possible; you could try to keep the user on the same page and use XHR to bring in dynamic content etc., but this quickly becomes very dangerous and error-prone as you'll be then forced to stop the browser from unloading the page to follow links, the back button and so on, when unloading/loading new URLs is what it's designed to do. You will also have the challenge of keeping track of a lot of "state" in JS over time.
I don't recommend the "single page" approach for common site designs as it quickly gets very ugly, but a music player app may be somewhat appropriate for a single-page experience.
Framesets are another possibility, though they are very old-skool and have their own problems.
http://lala.com looks to do a pretty good job of the single page experience with music, where you can browse and content is loaded via JS vs. a new page, but it is not a trivial task.
I’m confident
The company says
this answers the question
-
Inappropriate?Thanks for the answers.
I've been using the xhr/ajax approach and to further complicate things, the site is built on Wordpress.
I've written a less-than-bulletproof plugin to handle this but I was crossing my fingers for some magical solution that I had overlooked.
Cheers.
I’m thankful
-
Inappropriate?I solved this problem by storing current position in a cookie when unloading the page:
$(window).bind("unload", function(){
document.cookie = "music_position=" + BgSound.position + "; expires=cookie_date.getTime + 3600; path=/";
});
This works good for me, but i have problems with looping the sound. When the position is close to end this code make sound repeat from remembered position to end again and again:
var musicPosition = getCookie('music_position');
BgSound = soundManager.createSound({
id: 'bgsound',
url: '../../../audio/track1.mp3',
volume: 50,
onfinish: function() {
BgSound.play();
},
onload: function() {
BgSound.setPosition(musicPosition);
}
Can you help me with this code?
I’m confused
-
Inappropriate?Interesting. Try explicitly specifying position:0 in your onfinish handler, which will override any previous position: arguments.
eg.
onfinish: function() {
BgSound.play({position:0});
}
I’m happy
-
Thanks! It worked great. If you are interested: http://www.moveup.asia
Loading Profile...





EMPLOYEE