Jump to content
Kurre

Javasript to control MP3 player

Recommended Posts

I use osCommerce 2.3.4.1 CE BS version

I embedded HTML5 player code for demo music in the products description, in productlistning the player shows as it should. But when I cklick a demo music player it plays, and when I cklick another demo music to listen the first one don't stop but plays along with the second one and the third one and so on if you dont't click stop on the first song.

Is there a javascrip I can use to stop the first song from playing if I click another song ?

The embeded code I use is

<AUDIO controls><SOURCE type="audio/mpeg" src="https://www.somesite.se/songs/demo.mp3"></AUDIO>

 

Share this post


Link to post
Share on other sites
1 minute ago, ArtcoInc said:

@burt

Didn't you have a MP3 module in one of your 28 day bundles?

It does ring a bell... boom/tish.

It was in the very first 28d from 2015.  So long ago, well remembered @ArtcoInc


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites

I need to use embed code in product description to every song, the shop has 5 000 songs to sell so it's not possible to use one mp3 player with a playlist.

Share this post


Link to post
Share on other sites

It sounds like you need something to send a signal to any playing content to STOP, when you START a new one. I would imagine that the interface to do such a thing exists (if nothing else, to STOP the player when you click on STOP button). You might have to keep track of what's playing in your Javascript, and then hopefully it's no more than adding a STOP command whenever a START is clicked. Don't forget to also handle any PAUSE in a similar manner, to prevent two or more songs from playing together.

Share this post


Link to post
Share on other sites
6 minutes ago, JcMagpie said:

Here is a sample html page with 2 players play one , then play the second and first is paused as second plays. It's basic but gives you the idea of how it can be done.

2 Players-test.html

Yes! That was just what I needed, many thanks to you for your help JcMagpie !

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×