Email mp3 file after playing

P

petebud

I have a list of mp3 files (1 minute long) for web page vistors to
choose to listen to.

I would like for them to click on the link, have a popup window open
playing the mp3 file and in the same popup window, also have an email
form for them to send either the link or the mp3 file to a friend.


How can this be accomplished?


I host my own mp3 files, i have php, and MySQL on the webserver.


Thanks
Pete
 
M

mouseit

I have a list of mp3 files (1 minute long) for web page vistors to
choose to listen to.

I would like for them to click on the link, have a popup window open
playing the mp3 file and in the same popup window, also have an email
form for them to send either the link or the mp3 file to a friend.

How can this be accomplished?

I host my own mp3 files, i have php, and MySQL on the webserver.

Thanks
Pete

Well, this is vague but the question was very general- so some ideas:
The links on the files can be wired up to open a window - set the href
to "javascript:window.open('your popup url here')"
Once they have the popup window, the audio could be played through
Javascript (which I would not suggest) or Flash (friendlier). It would
be easiest, I think, to determine the audio file to play through a GET
request (on the end of a URL).
To send to a friend you'd need a backend script for emailing, try
reading up on the PHP mail() function. I'm not sure how you would
attach a file to an email through that, but the link would just refer
to the window that sent it.
-Mouseit
 
R

Randy Webb

mouseit said the following on 6/15/2007 12:45 AM:
Well, this is vague but the question was very general- so some ideas:
The links on the files can be wired up to open a window - set the href
to "javascript:window.open('your popup url here')"

No, you don't "set the href" to "javascript:" anything. You use the href
attribute to direct them to a sensible alternative to non-script
support. And then you use the onclick to try to force a new window on
the user.
 
P

Peter Michaux

Hi Pete,

I have a list of mp3 files (1 minute long) for web page vistors to
choose to listen to.

I would like for them to click on the link, have a popup window open
playing the mp3 file and in the same popup window, also have an email
form for them to send either the link or the mp3 file to a friend.

Why open in a new window? Some people really don't like popups and
don't see the "a popup has been blocked" and think the page is broken.
Since a player and email form are so small you could perhaps just have
them both with the list of mp3s in the main window.
How can this be accomplished?

I host my own mp3 files, i have php, and MySQL on the webserver.

As long as your server can send emails then it sounds like you have
all the technical stuff you need.

I think mouseit's suggestion of using flash to play the audio file is
probably a good one. You can control a Flash music player from
JavaScript if you want to <URL: http://www.schillmania.com/projects/soundmanager/>
or use a full Flash solution.

You can use a normal html form for the email form. You could even use
an HttpXMLRequest (Ajax) in the JavaScript to submit the form.

If you don't already know how to do all these things then this is
probably a great learning project since it is a few small
pieces...even if they don't seem small yet:)

<URL: http://jibbering.com/faq/#FAQ3_1>

Peter
 
M

mouseit

mouseit said the following on 6/15/2007 12:45 AM:





No, you don't "set the href" to "javascript:" anything. You use the href
attribute to direct them to a sensible alternative to non-script
support. And then you use the onclick to try to force a new window on
the user.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/

Indeed - a much better idea.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top