How to play different mp3 files by passing a URL parameter

If your web server supports a server-side script, for example PHP, you can pass a URL parameter to the player webpage, then play different mp3 files according to the URL parameter.

This is useful when you use iframe to add players to a webpage and you want to use the same player to play different mp3 files.
Continue reading

Play/pause audio player inside an iframe

Question:

Your text link in the post Play/pause Audio Player with API worked great with full list of songs on the page. However, when we tried it with the iframe on the page, it did not start the player. Any idea how to make the text link work with the iframe? The iframe approach is a much simpler structure for us.

Answer:

When adding the iframe, assign an id for it, for example:

<iframe src=”audioplayer.html” id=”amazing” width=”274″ height=”52″ border=”0″ scrolling=”no” frameBorder=”0″></iframe>

Then you can use the following text link:

<a href=”javascript:if (window.frames[‘amazing’].contentWindow) window.frames[‘amazing’].contentWindow.amazingAudioPlayerObjects.objects[0].playAudio(); else window.frames[‘amazing’].window.amazingAudioPlayerObjects.objects[0].playAudio();”>Click to Play</a>
<a href=”javascript:if (window.frames[‘amazing’].contentWindow) window.frames[‘amazing’].contentWindow.amazingAudioPlayerObjects.objects[0].pauseAudio(); else window.frames[‘amazing’].window.amazingAudioPlayerObjects.objects[0].pauseAudio();”>Click to Pause</a>

Play and Pause Audio Player with API

Question:

Hi Support:

I have purchased your Amazing Audio Player commercial version.

Is it possible to create a text link on a given page that will effect a play/pause action in the Amazing Audio Player on that page?

Thank you for any information you can provide on this matter.

Answer:

You can call the following JavaScript function to play/pause the player:

amazingAudioPlayerObjects.objects[0].playAudio();
amazingAudioPlayerObjects.objects[0].pauseAudio();

You can call the following JavaScript function to goto the second and fifth song and play:

amazingAudioPlayerObjects.objects[0].audioRun(1, true);
amazingAudioPlayerObjects.objects[0].audioRun(4, true);

The amazingAudioPlayerObjects is a global object created by the player.

For example, the following two text links will play/pause the audio player:

<a href=”javascript:amazingAudioPlayerObjects.objects[0].playAudio();”>Click to Play</a>
<a href=”javascript:amazingAudioPlayerObjects.objects[0].pauseAudio();”>Click to Pause</a>

The following two text links will play the second and fifth song:

<a href=”javascript:amazingAudioPlayerObjects.objects[0].audioRun(1, true);”>Click to Play</a>
<a href=”javascript:amazingAudioPlayerObjects.objects[0].audioRun(4, true);”>Click to Pause</a>

A demo is as following:

Click to Play

Click to Pause

Play the second song

Play the fifth song

Amazing Audio Player Events

Question:

I purchased a license  of your Amazing Audio Player and am wondering if i can fire off an ajax call at the end of the mp3 or on a timer during playing of the track.

Answer:

You can use the following code snippet to bind the event when an audio track ends, then in the function, you can fire off your ajax call.

<script type="text/javascript" language="JavaScript">
$(document).ready(function(){
   $("#amazingaudioplayer-1").bind("amazingaudioplayer.ended", function(event, index){ 
     console.log(index);
   });
});
</script>

The amazingaudioplayer-1 in the code is the id of the player div. If you have selected a different ID in the publish dialog, you need to change the number accordingly.