简体   繁体   English

得到“没有支持格式的视频和mime类型找到”在PHP但没有在HTML中

[英]getting “no video with supported format and mime type found” in php but no in html

I used video tag in an HTML file and it works fine. 我在HTML文件中使用了视频标签,它运行正常。

          <div class="modal-body">
            <video id="cartoonVideo" width="560" height="315"   frameborder="0" allowfullscreen controls>
            <source src="<?baseUrl() ?>/videos/video.mp4" type="video/mp4">

        </video>

when changing the format of the file to PHP on wamp server I get this error. 当在wamp服务器上将文件格式更改为PHP时,我收到此错误。

no video with supported format and mime type found

in the PHP file, I get the path from $ _SERVER with baseUrl() method, checked it and it's valid. 在PHP文件中,我使用baseUrl()方法从$ _SERVER获取路径,检查它并且它是有效的。 I'm using apache and enabled mp4 mime type by adding this line to mime.types file 我正在使用apache并通过将此行添加到mime.types文件来启用mp4 mime类型

video/mp4                   mp4 mp4v mpg4

in the console, I saw this warning: 在控制台中,我看到了这个警告:

HTTP “Content-Type” of “text/html” is not supported. 不支持“text / html”的HTTP“Content-Type”。 Load of media resource "video url" 加载媒体资源“视频网址”

It looks like you're missing the opening PHP tag, plus you have an extra quote. 看起来你错过了开放的PHP标签,而且还有额外的报价。 Try changing this: 尝试改变这个:

<source src="baseUrl() ?>/videos/video.mp4"" type="video/mp4">

To this: 对此:

<source src="<?php baseUrl(); ?>/videos/video.mp4" type="video/mp4">

Then save the file with a .php extension. 然后使用.php扩展名保存文件。

I'm surprised that this is working when the file is saved with an .html extension, because baseUrl() ?>/videos/video.mp4" is not a valid file path. 当文件以.html扩展名保存时,我感到很惊讶,因为baseUrl() ?>/videos/video.mp4"不是有效的文件路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM