admin管理员组文章数量:1420606
I want to add this video on my website. I added this code but it’s not working. Please help me.
<div id="container">
<iframe id="vid" width="560" height="315" src=";noredirect=1" frameborder="0" allowfullscreen></iframe>
</div>
<style>
#container {
border: 1px solid red;
width: 560px;
text-align: center;
}
#vid {
margin-bottom: 25px;
}
</style>
I want to add this video on my website. I added this code but it’s not working. Please help me.
<div id="container">
<iframe id="vid" width="560" height="315" src="https://www.youtube./watch?v=NhxVR2Szu3k&noredirect=1" frameborder="0" allowfullscreen></iframe>
</div>
<style>
#container {
border: 1px solid red;
width: 560px;
text-align: center;
}
#vid {
margin-bottom: 25px;
}
</style>
Share
Improve this question
edited Aug 14, 2015 at 6:23
Sebastian Simon
19.6k8 gold badges61 silver badges84 bronze badges
asked Aug 14, 2015 at 6:17
user6930268user6930268
3
- video not displaying – user6930268 Commented Aug 14, 2015 at 6:19
- please check the code – user6930268 Commented Aug 14, 2015 at 6:21
-
it's worth mentioning that
frameborder
is a deprecated attribute check it here. You can useborder: none
instead – Jood80 Commented Jan 17, 2023 at 12:20
2 Answers
Reset to default 4UPDATED Please replace this with your code
<div id="container">
<iframe width="560" height="315" src="https://www.youtube./embed/NhxVR2Szu3k" frameborder="0" allowfullscreen></iframe>
</div>
and css
#container {
border: 1px solid red;
text-align:center;
width: 80%;
margin-left:auto;
margin-right:auto;
}
as you are not using correct code for video..go in video link..then share and then embed code and take that code and it will work..hope this help.
Updated : now your video is responsive..change width according to your need.
I didn't clearly understand what you're trying to achieve but try this example:
<html>
<head> </head>
<body>
<div style="text-align:center">
<button onclick="playPause()">Play/Pause </button>
<br>
<video id="video" width="420">
<source src="video.mp4" type="video/mp4">
Your browser does not support HTML5 video.
</video>
</div>
<script>
var myVideo = document.getElementById("video ");
function playPause() {
if (myVideo.paused)
myVideo.play();
else
myVideo.pause();
}
</script>
</body>
</html>
本文标签: javascriptWhy is this embedded iframe video not playingStack Overflow
版权声明:本文标题:javascript - Why is this embedded iframe video not playing? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745327895a2653677.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论