Html 如何显示带有对象和嵌入标签的本地视频文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10217250/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I show a local video file with object and embed tags?
提问by dotnetN00b
So my video file is in C:\inetpub\wwwroot\Videos\Test\intro.wmv. I just want to run the video locally on my web page.
所以我的视频文件在 C:\inetpub\wwwroot\Videos\Test\intro.wmv 中。我只想在我的网页上本地运行视频。
It has to run on IE8/WinXP. So no HTML5.
它必须在 IE8/WinXP 上运行。所以没有HTML5。
This is what I have so far:
这是我到目前为止:
<object width="100%" height="100%"
type="video/x-ms-asf" url="http://localhost/Videos/Test/intro.wmv" data="intro.wmv"
classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
<param name="url" value="http://localhost/Videos/Test/intro.wmv">
<param name="filename" value="intro.wmv">
<param name="autostart" value="1">
<param name="uiMode" value="full" />
<param name="autosize" value="1">
<param name="playcount" value="1">
<embed type="application/x-mplayer2" src="http://localhost/Videos/Test/intro.wmv" width="100%" height="100%" autostart="true" showcontrols="true" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"></embed>
</object>
回答by Day
Try something more simple to begin like :
尝试一些更简单的开始,例如:
<object data="./Videos/Test/intro.wmv" type="video/x-ms-wmv" width="100%" height="100%">
<param name="src" value="./Videos/Test/intro.wmv">
<param name="autoStart" value="1">
alt : <a href="./Videos/Test/intro.wmv">My video name</a>
</object>
OR HTML5
或 HTML5
<video width="320" height="240" controls="controls">?
<source src="./Videos/Test/intro.wmv" type="video//x-ms-wmv" />?
<!-- <track src="subtitles_en.vtt" kind="subtitles" srclang="en" label="English">?-->
Nav doesn't support html5 video
</video>
回答by Infinity
<video width="320" height="240" controls="controls">
<source src="movie.mp4" type="video/mp4" />
<source src="movie.ogg" type="video/ogg" />
<source src="movie.webm" type="video/webm" />
<object data="movie.mp4" width="320" height="240">
<embed src="movie.swf" width="320" height="240" />
</object>
</video>
Save this as html file in the same folder, where the video is, this is in html 5, its always good to give relative path then the absolute path.
将其另存为 html 文件在视频所在的同一文件夹中,这是在 html 5 中,提供相对路径和绝对路径总是好的。
回答by dotnetN00b
This works at least.
这至少有效。
<object width="100%" height="100%"
type="video/x-ms-asf" url="/wiki/Videos/Test/intro.wmv" data="/wiki/Videos/Test/intro.wmv"
classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
<param name="url" value="/wiki/Videos/Test/intro.wmv">
<param name="filename" value="/wiki/Videos/Test/intro.wmv">
<param name="autostart" value="1">
<param name="uiMode" value="full" />
<param name="autosize" value="1">
<param name="playcount" value="1">
<embed type="application/x-mplayer2" src="/wiki/Videos/Test/intro.wmv" width="100%" height="100%" autostart="true" showcontrols="true" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"></embed>
</object>