Don't leave me this way! March 20, 2009 11:05 AM   Subscribe

Music pony! Can we get a warning when we're about to navigate away from a page where a MeFi Music track is playing?

More than once I've closed a tab while in the middle of a song. Over at 8tracks, if you click on a link that would take you away from a page where a song is playing, it gives you a warning:
Playback will be interrupted. Proceed?

Continue anyway » Open link in a new window »

[ ] Always take this action
(You can change this in your account settings at any time.)
Ideally, this warning would show up not only when you click on a link, but also if you try to close the tab, or if you type in a new url (this may be less possible than the other two instances; I'm not sure).

Is this possible? Is it too intensive a process for our dear, beloved server? Could it be done for the podcast, too?
posted by ocherdraco to Feature Requests at 11:05 AM (45 comments total) 1 user marked this as a favorite

Is this possible?

I'm pretty sure this would be wrapped up in some sort of javascript API to the flash player. We're using a pretty general free mp3 flash player and I'm not sure it has that kind of functionality.

It happens to me all the time as well, not just on MeFi Music, but youtube, vimeo, and countless blogs with audio and video players and sometimes I wish I could be warned before losing my spot in their player.
posted by mathowie (staff) at 11:09 AM on March 20, 2009


I just did a quick search of the MP3 player's support forums and I didn't see anything related. I worked with the player API quite a bit to try to keep playcounts going when we upgraded to a newer version of the player, and it was very, very flaky. I couldn't reliably detect via JavaScript when and where something was playing.

I'm not a Flash developer though, and I'm sure it's possible to build a player that could do this. But I'm not sure how to accomplish it with the player we're using.
posted by pb (staff) at 11:13 AM on March 20, 2009


Cool. If, at some time in the future, we switch players, it would be cool if the new player could do this. For now, I will just try to be vigilant about my clicking.
posted by ocherdraco at 11:18 AM on March 20, 2009


I think this would be a good idea site-wide:


Metafilter will be interrupted. Proceed?
[No] [Cancel] [Flameout]
[ ] Always take this action
(You can change this in your account settings at any time.)

posted by blue_beetle at 11:34 AM on March 20, 2009 [5 favorites]


Every single time I listen to a podcast I accidentally navigate away at least once when I click a link to a thread being discussed. I'm usually pretty good at opening the links in new tabs, or loading the mp3 in a new window, but I've done this kinda thing a lot.
posted by Science! at 11:57 AM on March 20, 2009


I also accidentally close music tabs pretty often, so I approve of this pony. Hopefully it can be implemented some time in the future.
posted by empyrean at 12:11 PM on March 20, 2009


I've never closed a music-playing tab. And I'm beautiful and smell like lavender. Therefore, I don't need this pony.
posted by You Should See the Other Guy at 12:19 PM on March 20, 2009


Here's another who curses like jessamyn whenever I accidentally navigate away from a podcast page.
posted by carsonb at 12:28 PM on March 20, 2009


I don't get to the music page much as I'd like, but even in the few times I've been there I've managed to do this.

Primarily, though, I request that this pony be a Sausage Pony.
posted by cimbrog at 12:45 PM on March 20, 2009


It looks like the current player's API should support this. Something along the lines of:
    window.onbeforeunload = function() {
        player = document.getElementById(...);
        if (player.getConfig().state == "PLAYING") {
            msg = "Music is playing. Are you sure?";
            if (window.event)
                window.event.returnValue = msg; // IE
            else
                return msg; // Firefox
        }
    }
posted by teraflop at 12:53 PM on March 20, 2009 [1 favorite]


Thanks for the pointer teraflop. The problem I ran into was that the "state" value was never accurate for me. But I'll play around with it a bit again and see what I can come up with.
posted by pb (staff) at 1:15 PM on March 20, 2009


Oh, duh. I somehow missed your comment up there. That would tend to present a problem.
posted by teraflop at 1:33 PM on March 20, 2009


I take it back, your code works beautifully. I don't see any problems with it in my limited testing.
posted by pb (staff) at 1:37 PM on March 20, 2009


Does this mean I might get my pony, pb?
posted by ocherdraco at 2:04 PM on March 20, 2009


To saddle & tack this pony, would it be possible for this behaviour to be opt-outable? I generally wouldn't like this feature, and also I have a hunch that it might cause my browser to interrupt shutdowns which would be annoying.

If it's not possible, go ahead with the change, though. I'm almost certainly in the minority here.
posted by Lemurrhea at 2:16 PM on March 20, 2009


I take it back, your code works beautifully. I don't see any problems with it in my limited testing.

Spiffy. Nice job, folks (teraflop+pb)!
posted by empyrean at 2:28 PM on March 20, 2009


Oh it works! We should change the warning to "If you leave, you may never hear music ever again."
posted by pwally at 2:38 PM on March 20, 2009


yeah, the warning is in place for any page that has a single player. Let's see how this goes for a while, Lemurrhea, and if it's terribly annoying we can add a preference for it.

Thanks for doing the heavy lifting, teraflop.

It's not working yet in Safari or Opera. I'm looking into that.
posted by pb (staff) at 2:52 PM on March 20, 2009


I got my pony! I got my pony!

You know, I really love the whole feature request=pony thing. It makes it much easier to be excited about them.
posted by ocherdraco at 2:52 PM on March 20, 2009


pb: While we are on this, could you recompile the flash music players with the "omit trace actions" checkbox checked in the publish settings?

Me and everyone else who does flash development in the office get our logs spammed by all the traces from the player. Since we always keep a tail on the logs, we can either work or listen to mefi music, but not both at the same time.

Thanks.
posted by dirty lies at 2:55 PM on March 20, 2009


Yeah no worries, pb. Nice work on getting it going so quickly. Are there plans to implement this on the main music page, or leave it as just for single-songs?
posted by Lemurrhea at 3:06 PM on March 20, 2009


No plans for adding it to the front page right now. We're going to see how it goes on single-player pages for a few weeks and go from there.
posted by pb (staff) at 3:08 PM on March 20, 2009


Wasn't there a "pop up in new window" option? Maybe I'm thinking of somewhere else.
posted by Pronoiac at 3:10 PM on March 20, 2009


dirty lies, I recompiled without the trace actions. You might have to force a refresh—I didn't change the player name so it might be cached.
posted by pb (staff) at 3:13 PM on March 20, 2009


Seems there are several ponies running around here - who's going to clean up after them?
posted by rtha at 3:22 PM on March 20, 2009


NOT IT
posted by cortex (staff) at 3:51 PM on March 20, 2009


This is good. I've done the *navigate away, hey where'd the song go?* thing a few times.

Call me crazy though, but I listen to the podcast on... wait for it... my iPod. Am I doing it wrong?
posted by Devils Rancher at 4:15 PM on March 20, 2009


ok, a few tweaks later and it's working in Safari, but Opera users will have to live without it. Opera doesn't support onbeforeunload.
posted by pb (staff) at 4:38 PM on March 20, 2009


I got my pony! I got my pony!

For christ sake don't tell everyone!
posted by jessamyn (staff) at 5:05 PM on March 20, 2009 [2 favorites]


I want a pony.
posted by Brandon Blatcher at 5:19 PM on March 20, 2009




Thanks pb.
posted by dirty lies at 6:08 PM on March 20, 2009


cimbrog: "I don't get to the music page much as I'd like, but even in the few times I've been there I've managed to do this.

Primarily, though, I request that this pony be a Sausage Pony.
"

I say we henceforth refer to all pony requests fulfilled within say a 4 hour time span as "Sausage Ponies".
posted by Science! at 7:34 PM on March 20, 2009


There's a fairly simple-to-implement js method called "onNavigateAway" I believe. It goes on the html page, so you don't have to dig into the Flash.

I'm not sure about the "save preferences" and all though, as far as I know it's not very customizable- you just put in a text message and then it makes "yes / no" buttons for you.
posted by drjimmy11 at 8:38 PM on March 20, 2009


oh pb already did it.

carry on.
posted by drjimmy11 at 8:39 PM on March 20, 2009


I believe that one of two things are possible here:

Metafilter does not have a physical computer "box", but is served directly from pb's brain.

-OR-

Metafilter is a computer that has become sentient and chooses to style itself as a "guy" named "Paul" somewhere in "Oregon".

Either way, you rawk, pb!!
posted by double block and bleed at 10:45 PM on March 20, 2009 [1 favorite]


You act like either one of those would be a bad thing.
posted by dg at 3:58 AM on March 21, 2009


Great addition, indeed. But now I can't favorite stuff. I'm using Firefox 2.0.0.17 on a PC, with NoScript and I suppose it has something to do with my refusal to allow googleapis.com. Is there a way around it so that I can continue to favorite stuff without having to allow googleapis?
posted by micayetoca at 6:58 AM on March 21, 2009


Sorry micayetoca, you have to allow googleapis.com if you want to use the favorites feature.
posted by pb (staff) at 7:12 AM on March 21, 2009


(And it's been that way for quite awhile, it's not due to this pony.)
posted by inigo2 at 7:18 AM on March 21, 2009


true, but I found an extra reference to a local copy of prototype on music thread pages while I was adding this feature yesterday and removed it. So there was a change in that one spot yesterday, but it wasn't supposed to be there.
posted by pb (staff) at 7:22 AM on March 21, 2009


(Oh. Well crap. Everyone go back to ignoring me please.)
posted by inigo2 at 8:44 AM on March 21, 2009


You act like either one of those would be a bad thing.

How so? I think either one of those would be awesome!
posted by double block and bleed at 9:22 AM on March 21, 2009


Just listened to a song and noticed the new pony was up and frolicking in the pen, so, after acknowledging that I'm clicking away I swung over here to say thanks.

Now, if only the rest of the internet had child safety locks. "You've clicked on something dumb. Are you sure you want to waste your time with it? (Note: if you say yes you are a moron.)"
posted by roombythelake at 5:01 AM on March 22, 2009


Fuck the Internet, i wasnt one of those for life.
"You are about to make a colossal mistake. Are you sure"?
| YES | CANCEL | PROVIDE HELP ON THIS ERROR |
posted by dg at 4:52 PM on March 22, 2009


« Older Chicago April MeetUp   |   You can't fire me, I quit! Newer »

You are not logged in, either login or create an account to post comments