remove download link from audio

2 posts in this topic

I'm trying to remove the download link to the control, could anyone help with this please?


<audio id="sample" src="unforgettable fire.mp3" controls preload></audio>

<a href="javascript:playSegment(10, 15);">Play1</a>

var audio = document.getElementById('sample');
var segmentEnd;

audio.addEventListener('timeupdate', function ()
    if (segmentEnd && audio.currentTime >= segmentEnd) 
}, false);

function playSegment(startTime, endTime){
    segmentEnd = endTime;
    audio.currentTime = startTime;;

Share this post

Link to post
Share on other sites

I think Javascript or PHP is required to do the trick.

I found the following solution on the internet:



Not tried, but this might work:



$filename = '/path/to/audio.mp3';
header('Content-Type: audio/mpeg');
header('Content-Disposition: inline;filename="'.basename($filename).'"');
header('Content-length: '.filesize($filename));
header('Cache-Control: no-cache');
header("Content-Transfer-Encoding: chunked");



Basically we are outputting the raw audio stream in the location where mp3.php is called. This is also how we do it when we say <img src='img.php'>






This is PHP code. So your page should be page.php




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