播放网页中的视频
我正在使用以下代码在我的网页内播放视频。播放器显示我设置的图像,但视频无法播放。请有人帮助我:-
<video width="420"
height="340" poster="church.jpg" controls="controls" preload="none">
<!-- MP4 for Safari, IE9, iPhone, iPad, Android, and Windows Phone 7 -->
<source type="video/mp4"
src="http://www.youtube.com/watch?v=9wBvrp55KYM&feature=fvsr" />
<!-- WebM/VP8 for Firefox4, Opera, and Chrome -->
<source type="video/webm" src="myvideo.webm" />
<!-- Ogg/Vorbis for older Firefox and Opera versions -->
<source type="video/ogg" src="myvideo.ogv" />
<!-- Optional: Add subtitles for each language -->
<track kind="subtitles" src="subtitles.srt" srclang="en" />
<!-- Optional: Add chapters -->
<track kind="chapters" src="chapters.srt" srclang="en" />
<!-- Flash fallback for non-HTML5 browsers without JavaScript -->
<object width="320" height="240"
type="application/x-shockwave-flash" data="flashmediaelement.swf">
<param name="movie" value="flashmediaelement.swf" />
<param name="flashvars" value="
controls=true&file=http://www.youtube.com/watch?v=9wBvrp55KYM&feature=fvsr" />
<!-- Image as a last resort -->
<img src="church.jpg" width="320" height="240"
title="No video playback capabilities" />
</object></video>
I am using the following code to play a video inside my webpage. The player is shown with the image i have set,But the video doesnot play. Please anybody helps me:-
<video width="420"
height="340" poster="church.jpg" controls="controls" preload="none">
<!-- MP4 for Safari, IE9, iPhone, iPad, Android, and Windows Phone 7 -->
<source type="video/mp4"
src="http://www.youtube.com/watch?v=9wBvrp55KYM&feature=fvsr" />
<!-- WebM/VP8 for Firefox4, Opera, and Chrome -->
<source type="video/webm" src="myvideo.webm" />
<!-- Ogg/Vorbis for older Firefox and Opera versions -->
<source type="video/ogg" src="myvideo.ogv" />
<!-- Optional: Add subtitles for each language -->
<track kind="subtitles" src="subtitles.srt" srclang="en" />
<!-- Optional: Add chapters -->
<track kind="chapters" src="chapters.srt" srclang="en" />
<!-- Flash fallback for non-HTML5 browsers without JavaScript -->
<object width="320" height="240"
type="application/x-shockwave-flash" data="flashmediaelement.swf">
<param name="movie" value="flashmediaelement.swf" />
<param name="flashvars" value="
controls=true&file=http://www.youtube.com/watch?v=9wBvrp55KYM&feature=fvsr" />
<!-- Image as a last resort -->
<img src="church.jpg" width="320" height="240"
title="No video playback capabilities" />
</object></video>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
YouTube 链接是一个 HTML 网站,而不是实际的 MP4 视频本身。因此,由于这个原因,它不会播放。您必须链接实际文件。另外,您不包含 webm 或 ogg,这使得它在某些浏览器中也无法使用。
The youtube link is a HTML site, NOT the actual MP4 video itself. So, due to this, it won't play. You'll have to link the ACTUAL FILE. Also, you do NOT include webm or ogg which makes this unusable in some browsers as well.
如果您想在网站中播放 YouTube 视频,他们会提供嵌入代码。
请阅读
If you want to play youtube video in your site, they provide embed code.
Read