Mark West Posted December 7, 2020 Share Posted December 7, 2020 I am in the process of trying to create a routine that will play the first 30 seconds of a 3 minute audio file at normal volume, and then do a 3 second fadeout. this is the example of what I have so far: <body> <audio id="audio2" preload="auto" src="cranbery.mp3#t=00,30" oncanplaythrough="this.play();"> </audio> </body> which tends to abruptly end the playback. How do I get it to "gracefully" end the playback? I am hoping to include such a routine as part a website that I am working on where I will sell music tracks, and people would be able to click on a track and hear a sample of what's on said track (a sort of "try before you buy" principal). Any assistance will be greatly appreciated. Thanks in advance. Link to comment Share on other sites More sharing options...
Ingolme Posted December 9, 2020 Share Posted December 9, 2020 Javascript should have control over the volume, it would take a bit of time to write the code to do that. Even then, that's not going to stop people from downloading the whole track for free. If you want to show just a sample, use an audio editor (a free one is Audacity) to make a short track with just the part of the song that you want users to hear and add the fadeout in the edited file. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now