HTML5视频在特定网站上播放,但不在我的domian中播放 [英] HTML5 video is playing in particular site but not in my domian ie

查看:395
本文介绍了HTML5视频在特定网站上播放,但不在我的domian中播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个mp4视频,可从某些外部网站下载。视频在该教程网站中播放得很好。但不是在我的网站上。此问题仅在ie9浏览器中。

I have a mp4 video which is downloaded from some external site. The video is playing well in that tutorial site. But not in my site. This issue is only in ie9 browser.

来源

<!DOCTYPE html>
<html>
<body>

<video width="320" height="240" controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>

</body>
</html>

我已经下载了 mp4 文件 ogg 对ie9不重要的文件。在以下链接中,视频工作正常。

I have downloaded the mp4 file and also ogg file which is not important for the ie9. In the following link the video is working fine.

http:// www.w3schools.com/html/tryit.asp?filename=tryhtml5_video_all

我只使用相同的来源和视频,但视频未播放我也检查了权限。请帮我解决这个问题

The same source and videos only i'm using but the video is not playing.I have checked the permissions also. Please help me to resolve this problem

推荐答案

首先加载页面然后按F12打开开发人员工具,然后弹出在控制台的控制台选项卡中,使用下面的脚本获取对视频对象的引用(如果视频元素不是第一个视频元素,则需要调整数组值)。

First load up the page and press F12 to bring up the developer tools , then pop over to the console tab in the console , get reference to the video object using the script below (If the video element is not the first video element then you will need to adjust the array value ).

document.getElementsByTagName(video)[0] .error.code
返回的代码让你知道出了什么问题,

document.getElementsByTagName("video")[0].error.code The code that is returned let you know what’s gone wrong,

MEDIA_ERR_ABORTED:1
用户中止了媒体资源的提取过程。
MEDIA_ERR_DECODE:3
在资源建立可用之后,媒体资源的解码出错。
MEDIA_ERR_NETWORK:2
在资源建立可用后,网络错误导致用户代理停止获取媒体资源
MEDIA_ERR_SRC_NOT_SUPPORTED:4
指定的媒体资源src无法使用。
在IE9中,如果您收到错误代码4,则有两个常见问题:

MEDIA_ERR_ABORTED : 1 The fetching process for the media resource was aborted by the user. MEDIA_ERR_DECODE : 3 An error has occurred in the decoding of the media resource, after the resource was established to be usable. MEDIA_ERR_NETWORK : 2 A network error has caused the user agent to stop fetching the media resource, after the resource was established to be usable MEDIA_ERR_SRC_NOT_SUPPORTED : 4 The media resource specified by src was not usable. In IE9 if you get error code 4 then there are two common issues:

错误编码

如果用户在其计算机上安装了编解码器,则IE9在MP4容器和WebM中支持H.264。要支持IE9,您需要确保已正确编码视频。对于H.264视频,我使用Miro(包装FFMPEG的Windows上的.net应用程序)或者如果我想要特定的基线或设置,我使用Expression Encoder。

IE9 supports H.264 in an MP4 container and WebM if the user has the codec installed on their machine. To support IE9 you will need to ensure that you have correctly encoded your video. For H.264 video I use Miro (a .net application on windows that wraps up FFMPEG) or if I want a specific baseline or setting I use Expression Encoder.

DIRECTORY

您是否将媒体文件放在包含此html的同一目录中?
如果没有,请设置文件的正确路径。

Are you placing the media files in the same directory holding this html? If not, set right path to files.

MIME类型

您需要确保服务器在返回文件时返回正确的MIME类型。如果文件是MP4,则文件MIME类型应为video / mp4。如果要检查MIME类型,请使用F12开发人员工具(在IE9中按F12键),然后导航到网络选项卡。按开始捕获并刷新网站。

You need to make sure your sever returns the correct MIME type when it returns a file. If the file is MP4 then the files MIME type should be video/mp4. If you want to check the MIME type then use the F12 developer tools (press F12 in IE9) and then navigate to the Network Tab. Press Start Capturing and refresh the web site.

好运

这篇关于HTML5视频在特定网站上播放,但不在我的domian中播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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