Jump to content

remove download link from audio


gsc1ugs

Recommended Posts

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

<html>
<head>
</head>
<body>

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

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


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

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

function playSegment(startTime, endTime){
    segmentEnd = endTime;
    audio.currentTime = startTime;
    audio.play();
}
</script>
</body>
</html>
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:

 

<?php

$filename = '/path/to/audio.mp3';
if(is_file($filename))
{
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");
readfile($filename);
}

?>

 

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...