Jump to content

remove download link from audio


Recommended Posts

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;
Link to comment
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



Source: http://stackoverflow.com/questions/33581188/hide-audio-url-in-php

Link to comment
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

  • Create New...