I have a music player swf embedded on an html page. Is there any way to have the music continuously play, even when the different html pages are loaded? When a link is clicked, the page is refreshed, also restarting the swf(music).
If the site was AJAX driven, this wouldn't be a problem, but all my pages are static. I suppose I could put the entire body in an iframe, but there has to be a better option. I am certainly open to the idea of using ajax here, but I do not have much ajax experience. Any ideas?
Ajax is really not that hard to learn, use it.
If you reload another page or the same page with a normal link, you will lose your current status in your embedded player. So you either have to use a non-standard link-mechanism, separate your player from the page or save your current status on change of the page. Your options basically are:
Use Ajax and never actually load a new page, but only new content (<- best solution, imho)
Use the standard link mechanism, but do it in an iframe, the player runs in a parent page (I agree with you, that wouldn't be nice)
Load the player in a new Window, put it in the background or something. This might be better than the iframe-solution, but you might get some difficulties with popup-blockers. Remember to close your popup when the user leaves your page.
Save the status of the player in a cookie whenever a link is clicked. On pageload check for the cookie and continue playing at the saved position. This will result in small breaks during playback and you need to be able to interact with the music player.
Related
As we all know that when we minimize the UWP app it goes to suspension. and then again when maximized it is exactly at the same place, for all pages. I want to do the same for specific pages, on my own. meaning that I want to do the same operation for one or more pages, when I switch between pages in my app, without minimizing? when app is minimized, even the videos playing on it pause automatically, and when maximized they play themselves, I want to achieve that functionality when I switch to next page and when I come back to previous page, it should start playing again, like it was suspended. thankyou in advance.
The app I am making plays a video on a url in a webview on a page, I want that when I come back to that page after navigating somewhere else on my app, that webview start playing exactly at the same place. Thats exactly wht happenes when I minimize my app. but i wanna do that without minimizing it.
Also I have tried cahcesize of my frame and set navigationmode of my page to enabled, that just saves the current state, and the media on my page keeps on playing when I navigate to another page, it should pause, but it keeps onplaying
I'm setting up a radio/stream player on a website. The player could be an iframe with/or an object (type="application/x-shockwave-flash") or an <audio> element, inside the document in a sidebar, repeated all along the website. When the stream is playing and you browse thru any link to another site of the website the stream is obviously interrupted because of the loading of the site.
I want the player to keep playing even if I browse to another part of the site thru a link (ex. click on HOME) just like SoundCloud and Hypem do. I know these site are doing it by refreshing the rest of the site with ajax and leaving the player untouched.
My question is, is there another way to make this iframe/object/audio element to keep playing?
Once you have switched to the next page, everything on the original page is destroyed and stops running. There is no direct way around this fact. As you have said, the other sites work by not actually switching pages.
A common way to keep the audio going is to use a popup window for your player. This way, the audio player page is still around. You can even communicate with it from the other pages. (Check out JunoDownload.com for an example.) This is not typically a good method, as many popup blockers simply block all popups. Most popup blockers only block popups initiated outside of a user action though, so if you had a "play" button that launched the popup window, most users would still get it. Another reason this is a bad idea though is because it is a bit of a jarring user experience.
Another way is to simply set your link targets to _blank, opening them in a new tab or window. Just be careful to only do this from links from your player page.
Finally, some sites will continually post playback status to the server. On the next page, if a song was playing on the previous page, a new player will be started at the point in which the last page stopped. This is a bit annoying though, as the music stops for a period of time while that player loads.
I'm working on my website where I have a music player. The annoying part is that when I browse to another page the player stops and starts from begining...
What I want is to have a persistent music player. So how can I make the div that contains the music player to be static when browsing to another page?
The website: demo(dot)zdringhi-art(dot)com
Thanks!
WEB is stateless.
So if you move to another page there is no way for a div to remain the same.
Although what you can do is that... Hmm as follows.
Have a single page and have your div in there.
Then the other part of the page is loaded via ajax.
also when a link is clicked only parts of pages will be loaded.
Seems too much of coding , but is the only feasible option.
For eg take facebook
Gurav shah is correct, the web is stateless so if you are changing pages you only have a few options for this.
Frames, yes before anyone shouts this is what they were designed for. You could have the music player in one HTML frame and the rest of the page in another so when you move around you are only updating the main content frame.
Or do as gurav suggests and make your whole site one page and update the content with Ajax, so the music Div does not change.
Pass the current position of the player to the next page when you click a link.
to another page
Where getseconds() returns the current position of the music player and passes it to the next page then when that page is loaded you read in the variable from the URL and start the player from there.
Using frames is one solution but since you are using JQuery on your site you should check out .load (http://api.jquery.com/load/). It allows you to load the content of another page and put it somewhere in the current page. Something like this:
$(function () {
$("a").click(function (e) {
e.preventDefault(); // don't follow the link
$("#ja-container").load($(this).attr("href") + " #ja-container");
/* Load the new page using ajax request, take the content in #ja-container from that new page and put it in the current page's #ja-container */
});
});
This is not a complete solution: when someone clicks Concerts -> Agenda you should keep Agenda visible.
Personally, instead of forced background music I'd rather like to see a page with Youtube videos of the people playing the music.
Well, yes HTTP is stateless. what you can do is create a cookie, and update it with current location/time value of the player, constantly. This way, when you go to any other page you can read time/location from cookie.
otherwise, in a cookie less approach, sending AJAXed location/time data back-forth server-client will be too much network.
If I was doing this, I would have gone cookie way.
I know this is not a widely favorable feature, but I've had to add a continuous music player to a web project of mine, at a client's insistence. Does anyone have a solution to keep the music playing continuously between pages? The client wants it to auto-play. The solution I have currently uses I-frames, but it's clunky – the pages don't have a unique URL, and the site does not properly come up in thumbnail on social networking sites, because everything is buried in a frame.
So far, I've tried:
A voluntary pop-up window that the user clicks on to start the player. Client did not like this because the music doesn't auto-play. I'm afraid having an automatic pop-up would be hidden by most browsers.
A flash music player that remembers where the user last left off on a song file, and loads from there the next time it is called for – unfortunately there are gaps in the playback (since the player has to be reloaded with every new page,) and the client is not satisfied.
The I-frame solution I have currently.
You could use jquery and ajax to dynamically load in your content ie you have a "container" page which you then use ajax to pull in various content so it looks like you moving to "another" page
I'm hoping that someone may be able to help me out.
My Home page (Home.html) has a link to a mp3player located at (mp3.html)
On the mp3player page there is a link back to Home.html
If the user clicks on the link to the Mp3 player I would like for the music to continue to play even if the link to home.html is pressed.
What I would like to avoid is having multiple tabs from being opened if the user would re-click one of these links.
Also I would like to have the appropriate page to open when it's link is pressed instead of being locked in a tab and not displaying.
The mp3 player isn't affected by being refreshed.
I would prefer not to have different tabs open if at all possible.
This really got me stumped. I've tried different things out only to either be stuck choosing a tab or loosing the music from playing.
Thank you.
You can program your site with AJAX, so index page won't be reloaded but supplemented by content loaded be demand - Google Mail is a good example. Not a task for beginner, though.
You can use HTML frames (see examples) and load index and player at the same time in one tab. Very easy and may fit your needs, but makes your site harder to link to.
I'd go with the AJAX version as well, it's a nicer user experience. If there's a player somewhere in another tab, that's pretty annoying for the user to find if he wants to turn it off or change a track. Check out the Sixtyone and how they're solving the problem.