Reputation: 65
How do i make an mp3 file play continuously on all pages? im using webform asp.net. how can i fix the problem?
jQuery('#main .jp-jplayer').each(function(index) {
var i = index+1;
var element = jQuery(this);
var song = "/Admin/uploads/mp3/" + element.find('.path').text();
element.jPlayer({
ready: function () {
jQuery(this).jPlayer("setMedia", {
mp3: song
});
},
preload: "auto",
play: function() { // To avoid both jPlayers playing together.
jQuery(this).jPlayer("pauseOthers");
var index = jQuery(this).attr("id");
index = index.split("_");
index = index[index.length-1];
var el = jQuery("#jp_container_"+index);
el.find('.jp-progress,.jp-time-holder')
.slideToggle();
},
swfPath: "mp3js",
supplied: "m4a, mp3",
cssSelectorAncestor:"#jp_container_"+i
});
});
Upvotes: 1
Views: 295
Reputation: 7049
Technically, you will have to do a single page application, although it doesn't have to look like one.
A good example is soundcloud: If you observe traffic in fiddler, you will notice that only the first access shows up under the domain soundcloud.com
, even though that's the only domain you'll ever see in the location bar.
Technically, you don't actually ever leave the first page you visited, which is why soundcloud can keep playing on navigation.
All other pages are requested from api.soundcloud.com and api-v2.soundcloud.com via asynchronous web requests from the first page that updates the content of the site. The location is then updated while suppressing the actual request.
Soundcloud looks like a normal website, but it's actually a SPA - all so they can keep playing while navigating.
Upvotes: 1