播放网页中的视频

发布于 2025-01-06 19:40:12 字数 1399 浏览 0 评论 0原文

我正在使用以下代码在我的网页内播放视频。播放器显示我设置的图像,但视频无法播放。请有人帮助我:-

 <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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

巨坚强 2025-01-13 19:40:12

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.

慵挽 2025-01-13 19:40:12

如果您想在网站中播放 YouTube 视频,他们会提供嵌入代码。

请阅读

  1. 如何嵌入 YouTube 视频
  2. 嵌入 YouTube 视频的新方法

If you want to play youtube video in your site, they provide embed code.

Read

  1. How to embed a YouTube video,
  2. A New Way To Embed YouTube Videos
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文