【问题标题】:Is it possible to use YouTube video with HTML video tag?是否可以使用带有 HTML 视频标签的 YouTube 视频?
【发布时间】:2014-01-17 16:29:12
【问题描述】:

我正在制作网站,我需要添加视频,但不使用iframe。我猜视频标签没有这种能力,也许有一些简单的替代方案?

【问题讨论】:

标签: html video youtube


【解决方案1】:

你试过这个代码吗?

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
    <title>HTML5 MediaElement - YouTube</title> 

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>  
    <script src="http://mediaelementjs.com/js/mejs-2.13.1/mediaelement-and-player.min.js"></script>
    <link rel="stylesheet" href="http://mediaelementjs.com/js/mejs-2.13.1/mediaelementplayer.min.css" />
</head>
<body>

<h1>MediaElementPlayer.js</h1>

<h2>YouTube Wrapper</h2>

<video width="640" height="360" id="player1">

    <!-- Pseudo HTML5 -->
    <source type="video/youtube" src="http://www.youtube.com/watch?v=nOEw9iiopwI" />

</video>

<span id="player1-mode"></span>

<script>

$('video').mediaelementplayer({
    success: function(media, node, player) {
        $('#' + node.id + '-mode').html('mode: ' + media.pluginType);
    }
});

</script>

</body>
</html>

更多信息http://mediaelementjs.com

【讨论】:

  • 音量管理和全屏等某些功能无法正常工作。我知道为什么:)
猜你喜欢
  • 2015-10-01
  • 1970-01-01
  • 2012-06-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-09
  • 1970-01-01
相关资源
最近更新 更多