要在网页上通过单击按钮从Google Drive播放嵌入的iframe,你需要执行以下步骤:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Play Video from Google Drive</title>
<style>
#videoContainer {
display: none;
}
</style>
<script>
function toggleVideo() {
var container = document.getElementById('videoContainer');
if (container.style.display === 'none') {
container.style.display = 'block';
} else {
container.style.display = 'none';
}
}
</script>
</head>
<body>
<button onclick="toggleVideo()">Play Video</button>
<div id="videoContainer">
<!-- 替换下面的src属性为你自己的Google Drive嵌入链接 -->
<iframe src="https://drive.google.com/file/d/你的文件ID/preview" width="640" height="480" allowfullscreen="true"></iframe>
</div>
</body>
</html>
通过以上步骤,你应该能够在网页上通过单击按钮来播放存储在Google Drive的视频。
领取专属 10元无门槛券
手把手带您无忧上云