WordPress.org

Forums

mb.miniAudioPlayer - an HTML5 audio player for your mp3 files
[resolved] Download Button Not Downloading Full File (3 posts)

  1. twodaftyanks
    Member
    Posted 1 year ago #

    Hi-

    The download button was originally not working because my host was blocking the download. They fixed my permissions to download the file but the download is now only 7 bytes. The MP3's I am wanting to download are are in the 50-70 MB range. Any idea what could be causing this?

    Here is an example post: http://twodaftyanks.com/2014/02/episode-36-man-roo/

    https://wordpress.org/plugins/wp-miniaudioplayer/

  2. twodaftyanks
    Member
    Posted 1 year ago #

    OK I think I found the main problem.

    The link to the MP3 file is: https://archive.org/download/TwoDaftYanksEpisode35/TDY_EP35.mp3

    But when the file plays this is the actual address: https://ia700602.us.archive.org/7/items/TwoDaftYanksEpisode35/TDY_EP35.mp3

    The original link triggers a download that all other services can activate but for some reason the button can't. The easy fix is just to go back and link to the actual URL that plays the file as I have for episodes 36 and 35 on my site. This allows the button to work correctly.

    Is there anything that can be "easily" changed in a short amount of time in the code that would not require me to replace every episode that has been produced?

    My guess is probably not and that is fine. Please advise.

    Many Thanks!

  3. pupunzi
    Member
    Plugin Author

    Posted 1 year ago #

    As I understand you can't download the audio file from your WordPress repo but you can from the external link.

    The difference between the two is that in the case of same domain (your WP repo) the download page get the file navigating the file system (c://...) while from the external domain it get the file via HTTP.

    To check if that is the problem you can comment in the map_download.php file from line 13 to line 31:

    if($pos){
    
        if (isset($_SERVER['HTTPS']) &&
            ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) ||
            isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
            $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
            $protocol = 'https://';
        }
        else {
            $protocol = 'http://';
        }
    
        $file_url = str_replace ($protocol. $web_address .'/', '', $file_url);
        $file_url = $web_root ."/". $file_url;
        $file_url = str_replace('//', '/', $file_url);
    
        //die($protocol . " --- " .$web_root . " --- " .$web_address . " --- " . $file_url );
    
    }

    forcing the download to always use the HTTP protocol.

    Bye,
    Matteo

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.