Jump to content

Play an embeded video from a script...


kathas

Recommended Posts

hey to all,

 

Here is the case ...

 

I want to make a script that will be used to embed videos on a website while the actual video name/directory will stay hidden...

i have reached that far...

in the html page instead of the src="video_name" i put php_filename. The php file sends headers that it is a video and then gets the content of the video file...

<?php

$filename = "video.wmv";
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public", false);
header("Content-Description: Video player");
header("Content-Type: video/x-ms-wmv");
header("Content-Length: " . filesize($file_real));
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
echo $contents;
fclose($handle);
?> 

and the html page

<p align="center">
<object
width="320"
height="260"
classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
hspace="0"
border="1">
<param
name="Filename" value="play.php" />
<param
name="AutoStart"
value="True" />
<param
name="ShowControls"
value="False" />
<param
name="ShowStatusBar"
value="True" />
<param
name="ShowDiplay"
value="False" />
<param
name="AutoRewind"
value="True" />
<embed
width="320"
height="260"
hspace="320"
filename=
"play.php"
autostart="True"
showcontrols="True"
showstatusbar="True"
showdiplay="True"
autorewind="True"
border="1"
src=
"play.php"></embed></object> 
</p>

I searched everything possible and did not come up with anything that solved my problem...

By the way if i put the filename to src attribute it works fine...

 

Thanx in advance for all the help,

Kathas

Link to comment
https://forums.phpfreaks.com/topic/47474-play-an-embeded-video-from-a-script/
Share on other sites

Change to:

<?php
$filename = "video.wmv";
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public", false);
header("Content-Description: Video player");
header("Content-Type: video/x-ms-wmv");
header("Content-Length: " . filesize($filename));
readfile($filename);
?>

 

By the way, your code will not be as function as you expect it to be.  Because PHP is directly outputting the contents of the .wmv file, someone can just go to your play.php script, go to File > Save As > video.wmv, and they have your video copied.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.