html5视频没有播放mp4错误“无效来源”? [英] html5 video is not playing mp4 error "Invalid Source"?

查看:1159
本文介绍了html5视频没有播放mp4错误“无效来源”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用HTML5视频标签,我已经下载了一个微软样本并尝试运行它,但是发生了一件奇怪的事情,它是播放来自URL(评论标签)的视频,但对于本地mp4文件它是不显示错误并显示消息无效来源



这是我的代码,请指导我应该做些什么才能使其正确运行本地文件?



谢谢

 <!DOCTYPE html> 
< html>
< head>
< / head>
< body>
<! - < video src =http://www.bing.com/az/hprichv/?p=Butterfly_Clipcanvas_223479_EN-US.mp4
自动播放循环>
< / video> - >
< video controls src =hprichv.mp4width =300height =200autoplay loop>
< / video>
< / body>
< / html>

编辑



网页和视频文件都位于同一个文件夹中。

解决方案

我在本地开发,然后主机/远程服务。尝试在本地开发时加载本地mp4文件即可遇到相同的情况。在文件的同一目录中使用localhost / myvideo.mp4或127.0.0.1/myvideo.mp4或/aaa/myvideo.mp4或myvideo.mp4没有任何组合可以工作......但引用完整的URL,如 http://www.mywebsite.com/myvideo.mp4 确实如上。



在本地计算机上,Chrome浏览器显示无误消息...只显示带有控件的黑匣子。没有线索至于什么。切换到IE,它显示黑匣子和控件和错误消息。 '来源无效'



我专注于@steveax问题和Mime类型。



在此版本中关闭IIS Windows / IIS没有.mp4的MIME类型设置。不知道为什么不......但不是。



要添加MP4 MIME类型,请打开 Internet信息服务(IIS)管理器,然后执行以下步骤:


  • 在左侧面板上突出显示默认网站;
  • 双击 MIME Types 在右侧面板上;

  • 向下滚动列表,注意没有 .mp4 ;

  • 再次在右侧面板上,点击第一个字段中的添加:写入 .mp4 ,并在下面的字段中写入视频/ mp4

  • 点击确定即可完成。



重新启动IIS!


I am trying HTML5 video tag and I have downloaded a Microsoft sample and trying to run it but a strange thing is happening, and it is that it plays video coming from a URL (commented tag) but for local mp4 file it do not shows error and shows message "Invalid Source"

Here is my code please guide me what I should do to make it run local file correctly ?

Thanks

    <!DOCTYPE html>
<html>
<head>
</head>
<body>
    <!--<video src="http://www.bing.com/az/hprichv/?p=Butterfly_Clipcanvas_223479_EN-US.mp4"
        autoplay loop>
    </video>-->
    <video controls src="hprichv.mp4" width="300" height="200" autoplay loop>
    </video>
</body>
</html>

EDIT

Web page and video files both reside in the same folder.

解决方案

Im on Windows 7 Pro. I develop locally and then host/serve remotely. Trying to load a local mp4 file while developing locally ran into this identical situation. No combination of using localhost/myvideo.mp4 or 127.0.0.1/myvideo.mp4 or /aaa/myvideo.mp4 or myvideo.mp4 in same directory as file got things to work...but referencing a full URL like http://www.mywebsite.com/myvideo.mp4 did, as above.

On local machine, Chrome shows no error messages...just shows black box with controls. No clues as to whats up. Switched to IE and it showed the black box and controls and the error message. 'Invalid source'

I focused on @steveax question and Mime types.

Turns out IIS in this version of windows/IIS does not have a MIME type setup for .mp4. No clue why not...but not.

To add the MP4 MIME type, open Internet Information Services (IIS) Manager and follow these steps:

  • Highlight Default Web Site on the left panel;
  • Double-click MIME Types on the right panel;
  • Scroll down the list and notice that there is no .mp4;
  • On the right panel again, click Add: at the first field, write .mp4 and on the field below write video/mp4
  • Click OK and you are done.

Restart IIS!

这篇关于html5视频没有播放mp4错误“无效来源”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆