PHP headers to stream a wmv video file

When I point directly to the file it plays in the browser, but if I try to play it through PHP it does not work. My code is:

<?php $file = 'videos/video.wmv'; $file_name = 'video.wmv'; $file_type = 'video/x-ms-wmv'; header('Content-Description: File Transfer'); header('Content-Disposition: filename="'.$file_name.'"'); header('Content-Type: '.$file_type); header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . filesize($file)); header('Cache-Control: post-check=0, pre-check=0'); header('Pragma: public'); header("Accept-Ranges: bytes"); header('Expires: 0'); readfile($file); ?>

It works fine with PDF, rar and zip files, but not on streaming video. The WMP window appears but the video dont plays.

Thanks for any help.

Sponsor our Newsletter | Privacy Policy | Terms of Service