मैं वीडियो चलाने के लिए वीडियो टैग का उपयोग कर रहा हूं।एमपी 4 - एचटीएमएल 5 वीडियो टैग में नहीं खेल रहा है
मैं इस तरह प्लेबैक के लिए php फ़ाइलों का उपयोग कर:
<video id="playvideo" preload="auto" width="845" height="395"
poster="http://video-js.zencoder.com/oceans-clip.png">
<source src="../getvideo_webm.php" type='video/webm' />
<source src="../getvideo_mp4.php" type='video/mp4'/>
<source src="../getvideo_ogv.php" type='video/ogg' />
</video>
सभी .php फ़ाइलों ठीक खेल रहे हैं जब मैं उन्हें सीधे ब्राउज़र से चेक इन करें। लेकिन स्रोत फ़ाइलों के रूप में सभी .php के साथ उपरोक्त सेटअप नहीं खेलेंगे। अगर मैं सीधे .mp4 स्रोत देता हूं तो यह ठीक खेलेंगे।
getvideo_mp4.php इस तरह दिखता है:
$path = 'oceans-clip.mp4';
if (file_exists($path))
{
$size=filesize($path);
[email protected]($path,'rb');
if(!$fm) {
// You can also redirect here
header ("HTTP/1.0 404 Not Found");
die();
}
$begin=0;
$end=$size;
if(isset($_SERVER['HTTP_RANGE'])) {
if(preg_match('/bytes=\h*(\d+)-(\d*)[\D.*]?/i',
$_SERVER['HTTP_RANGE'],$matches)){
$begin=intval($matches[0]);
if(!empty($matches[1])) {
$end=intval($matches[1]);
}
}
}
if($begin>0||$end<$size)
header('HTTP/1.0 206 Partial Content');
else
header('HTTP/1.0 200 OK');
header("Content-Type: video/mp4");
header('Accept-Ranges: bytes');
header('Content-Length:'.($end-$begin));
header("Content-Disposition: inline;");
header("Content-Range: bytes $begin-$end/$size");
header("Content-Transfer-Encoding: binary\n");
header('Connection: close');
$cur=$begin;
fseek($fm,$begin,0);
while(!feof($fm)&&$cur<$end&&(connection_status()==0))
{ print fread($fm,min(1024*16,$end-$cur));
$cur+=1024*16;
usleep(1000);
}
die();
}
तो क्या मैं गलत कर रहा हूँ?
अब ... ऐसा लगता है कि यह उपरोक्त कोड के साथ काम कर रहा है ..: -/ – Niels
अच्छी नौकरी नील्स ... –