J
J
Justique2015-11-05 16:14:34
PHP
Justique, 2015-11-05 16:14:34

How to give wav correctly?

Good day.
Today the task has become to give wav files from under ssh connection.
It seems that everything is in order, the record is played, but rewind and playback progress do not work.

function openFile($remote_dir, $remote_file) {
              $sftp = $this->sftp;
            $dir = "ssh2.sftp://$sftp$remote_dir$remote_file";
             $stream = readfile("$dir", 'r');
        header('Content-Type: audio/x-wav');			
        header("Accept-Ranges: bytes");
        header("Connection: close");
        header("Content-type: application/octet-stream");
        header("Content-Length: ".filesize($dir));
        header("Content-Range:bytes 0-".filesize($dir)."/".filesize($dir));
        
        
        
          die();
        }

I accept the file with the usual audio tag.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
shagguboy, 2015-11-05
@shagguboy

php.net/manual/en/function.http-send-file.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question