/    Sign up×
Community /Pin to ProfileBookmark

How to pass new audio file to already embedded MP3 player?

I’m working on a project to make an electronic phrasebook. It is my goal to have a basic html based solution, in which there are tables containing the following information:

Columns:
1.) [English Phrase]
2.) [Spanish Phrase]
3.) [Other Language Spelling]
4.) [Other Language Phonetic spelling]
5.) [Native Pronunciation Sound Clip – Slow]
6.) [Native Pronunciation Sound Clip – Normal]

Rows:
~200 some medical terms

My initial solution for embedding audio files went like this this:

[CODE]<embed src=”../sound/es0001n.mp3″ width=”30″ height=”17″ autostart=”false” loop=”false” type=”audio/mpeg” controller=”true”>[/CODE]

However, the page was slow to load and the embedded controller was cumbersome and unsightly. I want to instead embed one player at the bottom of the page, and upon clicking on a link in the sound clip columns, send the relevant audio file to the player. In order to do this I first tried using the standalone word press player, found here: [url]http://www.macloo.com/examples/audio_player/[/url]

Using this code:

[CODE]<script language=”JavaScript” src=”../sound/playerfiles/audioplayer/audio-player.js”></script>
<object type=”application/x-shockwave-flash” data=”../sound/playerfiles/player.swf” id=”audioplayer1″ height=”24″ width=”290″>
<param name=”movie” value=”../sound/playerfiles/audioplayer/player.swf”>
<param name=”FlashVars” value=”playerID=1&amp;soundFile=../sound/test1.mp3″>
<param name=”quality” value=”high”>
<param name=”menu” value=”false”>
<param name=”wmode” value=”transparent”>
</object>[/CODE]

I was able to successfully embed the player and play the specified audio file. However, I cannot figure out how to switch the audio file upon clicking a link/image in the sound clip cell of the table I described above, and as I said I don’t want to embed more than one audio player.

Can anyone think of a way to do this? I wonder about including a mutator function that I could call to change the value of the src, but honestly that is way over my head for this language. I don’t know how to use a variable or how to overwrite a new value. I only have some experience with html, and a very small amount with C++.

In summary: I need a way to, upon clicking a link, send an audio file to an already embedded player, and with the same click, also initiate playback of the audio file just sent to the audio player.

Also, this project that I’m doing needs to be portable. I want to both post it online, and zip the main directory together to be downloaded by users to use on their hard drive. This is a small problem, as when the files are on the hard drive it comes up with a warning saying: Adobe has stopped an unsafe action, _______ location is trying to access the internet-enabled __________ location (even though all the files involved are on my hard drive).

If that were not an issue I could just use this player: [url]http://www.varal.org/media/niftyplayer/[/url] , which has a load and play function for a new audio source. However, when used on a hard drive the function is not functional, based on the above warning about accessing an internet-enabled location.

Thanks for the help, if I left out an important information please let me know.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @GringoChapin spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...