-
-
Save Pseric/efd39ffc41603b700f0ce4fbf7a33dbf to your computer and use it in GitHub Desktop.
如何嵌入 YouTube 影片設定自動重播、隱藏 Logo 或靜音播放?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="muteYouTubeVideoPlayer"></div> | |
<script async src="https://www.youtube.com/iframe_api"></script> | |
<script> | |
function onYouTubeIframeAPIReady() { | |
var player; | |
player = new YT.Player('muteYouTubeVideoPlayer', { | |
videoId: 'YOUR_VIDEO_ID', // YouTube 影片ID | |
width: 560, // 播放器寬度 (px) | |
height: 316, // 播放器高度 (px) | |
playerVars: { | |
autoplay: 1, // 在讀取時自動播放影片 | |
controls: 1, // 在播放器顯示暫停/播放按鈕 | |
showinfo: 0, // 隱藏影片標題 | |
modestbranding: 1, // 隱藏YouTube Logo | |
loop: 1, // 讓影片循環播放 | |
fs: 0, // 隱藏全螢幕按鈕 | |
cc_load_policty: 0, // 隱藏字幕 | |
iv_load_policy: 3, // 隱藏影片註解 | |
autohide: 0 // 當播放影片時隱藏影片控制列 | |
}, | |
events: { | |
onReady: function(e) { | |
e.target.mute(); | |
} | |
} | |
}); | |
} | |
// Written by @labnol | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment