Hello All,

I'm having a bit of trouble finding something that I thought wouldn't be too bad of a script or standard flash script out there.

Here's what I want. Click a button for song, opens up pop up window (flash or javascript, anything really), and plays the selected song in a small player.

Seems this would be pretty easy, but I'm not finding much information on it. It is not too many songs, so I don't mind putting the extra work into scripting to make it much nicer and easier to use.

I just don't like the embed idea and hate that it opens in default player. Would like to keep control over the overall site more.

I'll try to find an example, but I have yet to see one, so i posted here.

Johnny

Sorry this is such a late reply.

Could you create a javascript pop up window then just put a player such as this in it?

Although you do need to be careful when using pop out windows because most popular browsers now tend to be pretty good at blocking them.

Hope that helps.

I actually found a pretty good script. For all of you that might want to look for this it's here "Build a better web audio player"

Also to see how customizable this is, check on my site. Really impressive. Johnny and the Producers

Thank you for the reply, hopefully this post will help someone else because I always search here first :0)

Isn't this just Quicktime in a pop up window? Not everyone will have quicktime so it may be better to use a flash based one.

Isn't this just Quicktime in a pop up window? Not everyone will have quicktime so it may be better to use a flash based one.

It's actually whatever your default player is. So if Windows Media player is your default, this works also. You might be right though, Flash would definitely be a better way to go. My issue is finding the right flash player to get the job done.

Try the one I posted about.

I like the idea of it being the users default. Clever.

Remember that all of these are dependent on what the user has installed on his computer. You can't force the user to download a player he doesn't want.

I will not let QuickTime on my computer, because it is greedy. Whenever it upgrades, it steals all of the default player settings and redirects them to QuickTime.

Midimagic: This uses the default play on the computer, that is the point!

Not to mention i am a great believer in using quicktime rather than windows anyway. Oh wait, I'm a mac user.

Also, when you update quicktime, does it not ask you what mime types to associate?

Also, when you update quicktime, does it not ask you what mime types to associate?

That's what i thought.

Not to mention i am a great believer in using quicktime rather than windows anyway. Oh wait, I'm a mac user.

Also, when you update quicktime, does it not ask you what mime types to associate?

No, it does not. Like a bull in a china shop, it does what it wants.

You can set it to not do this. But when it automatically updates the nest time, it turns off that setting. If you don't notice that the setting was turned off, the following time it updates, it grabs all of the file defaults in Windows Explorer. I have even seen it grab file types it can't play.

It also installs itself in such a way that it can't be uninstalled without reinstalling Windows.

Midimagic: This uses the default play on the computer, that is the point!

What if you don't have a player installed that plays that kind of file?

I have to have three different audio players just to play the files I do have, and there are other file types I can't play, because I have problems with the way the players for those files affect computers.

Well I don't use realplayer at all because of the reason... it is really dodgy.

Itunes and VLC seem to do the job for me though.

Good point though, if you don't have quicktime or windows media player for WMV and MOV files, what does it do!?

As you can see in the below code, this is not the "be all end all" answer for all of us out there. In the code it looks like it only deals with variables for two different mime types and let's your computer decide how to handle, but I have not experiemented on a machine without windows media or quicktime, so I'm not 100% sure.

I'm still on the search because I honestly think .flv would be a better answer for what I was looking for, i am just not savvy enough to write my own scrip on this or have found anything that is easily customizable to fit my site. I'm glad for all the feedback though. Maybe we'll actually find a good solution for all.

// Pop-Up Embedder Script by David Battino, www.batmosphere.com
// Version 2006-05-31 
// OK to use if this notice is included
   
function BatmoAudioPop(filedesc,filepath,WindowNumber) {
   // Get Operating System 
   var isWin = navigator.userAgent.toLowerCase().indexOf("windows") !=-1
   if (isWin) { // Use MIME type = "application/x-mplayer2"
      visitorOS="Windows";
   } 
   else { // Use MIME type = "audio/mpeg"; // or audio/x-wav or audio/x-ms-wma, etc.
      visitorOS="Other";
   }

   // Get the MIME type of the audio file from its extension (for non-Windows browsers)
   var mimeType = "audio/mpeg"; // assume MP3/M3U
   var objTypeTag = "application/x-mplayer2"; // The Windows MIME type to load the WMP plug-in in Firefox, etc.
   var theExtension = filepath.substr(filepath.lastIndexOf('.')+1, 3); // truncates .aiff to aif
   if (theExtension.toLowerCase() == "wav") { mimeType = "audio/x-wav"};
   if (theExtension.toLowerCase() == "aif") { mimeType = "audio/x-aiff"};    
   if (theExtension.toLowerCase() == "wma") { mimeType = "audio/x-ms-wma"};
   if (theExtension.toLowerCase() == "mid") { mimeType = "audio/mid"};
   // Add additional MIME types as desired
   
   if (visitorOS != "Windows") { objTypeTag = mimeType; // audio/mpeg, audio/x-wav, audio/x-ms-wma, etc.};
      PlayerWin = window.open('',WindowNumber,'width=320,height=217,top=0,left=0,screenX=0,screenY=0,resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0');
      PlayerWin.focus();
      PlayerWin.document.writeln("<html><head><title>" + filedesc + "</title></head>");
      PlayerWin.document.writeln("<body bgcolor='#9999ff'>"); // specify background img if desired
      PlayerWin.document.writeln("<div align='center'>");
      PlayerWin.document.writeln("<b style ='font-size:18px;font-family:Lucida,sans-serif;line-height:1.6'>" + filedesc + "</b><br />");
      PlayerWin.document.writeln("<object width='280' height='69'>");
      PlayerWin.document.writeln("<param name='src' value='" + filepath + "'>");
      PlayerWin.document.writeln("<param name='type' value='" + objTypeTag + "'>");
      PlayerWin.document.writeln("<param name='autostart' value='1'>");
      PlayerWin.document.writeln("<param name='showcontrols' value='1'>");    
      PlayerWin.document.writeln("<param name='showstatusbar' value='1'>");
      PlayerWin.document.writeln("<embed src ='" + filepath + "' type='" + objTypeTag + "' autoplay='true' width='280' height='69' controller='1' showstatusbar='1' bgcolor='#9999ff' kioskmode='true'>");
      PlayerWin.document.writeln("</embed></object></div>");
      PlayerWin.document.writeln("<p style='font-size:12px;font-family:Lucida,sans-serif;text-align:center'><a href='" + filepath +"'>Download this file</a> <span style='font-size:10px'>(right-click    or Control-click)</span></p>");
      PlayerWin.document.writeln("<form><div align='center'><input type='button' value='Close this window' onclick='javascript:window.close();'></div></form>");
      PlayerWin.document.writeln("</body></html>");
      PlayerWin.document.close(); // "Finalizes" new window
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.