Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/222.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android上的PHP媒体流_Php_Android_Html_Stream - Fatal编程技术网

Android上的PHP媒体流

Android上的PHP媒体流,php,android,html,stream,Php,Android,Html,Stream,其想法是通过PHP流式传输视频 我创建了一个PHP脚本并将其上传到我的免费网站。然后,我将视频与源路径一起嵌入,并在其中传递值 当我在电脑的浏览器上试用时,效果很好。但当我在Android上的网络视图上尝试时,它甚至不会出现 有什么帮助吗 streamer.php <?php $file = './' . $_GET["file"]; $pos = (isset($_GET["pos"])) ? intval($_GET["pos"]): 0; header("Content-Type

其想法是通过PHP流式传输视频

我创建了一个PHP脚本并将其上传到我的免费网站。然后,我将视频与源路径一起嵌入,并在其中传递值

当我在电脑的浏览器上试用时,效果很好。但当我在Android上的网络视图上尝试时,它甚至不会出现

有什么帮助吗

streamer.php

<?php
$file = './' . $_GET["file"];

$pos = (isset($_GET["pos"])) ? intval($_GET["pos"]): 0;

header("Content-Type: video/x-flv"); 
header('Content-Length: ' . filesize($file));

if($pos > 0) {
    print("FLV"); 
    print(pack('C',1));
    print(pack('C',1));
    print(pack('N',9));
    print(pack('N',9));
}

$fh = fopen($file,"rb");
fseek($fh, $pos);
fpassthru($fh);
fclose($fh);

?>

嵌入代码

<embed src="http://mywebsite.com/streamer.php?file=video.flv" />

还尝试了HTML5和其他视频格式

<video id="vid">
   <source src="http://chris-mmt.site40.net/streamer.php?file=video.mp4" type="video/mp4">
</video>

我通过使用
HTML5
方法解决了我的问题,多亏了这个答案,我使它工作得很好:)