IFrame Player APIの方(script.jsの方)では、function onPlayerReady2にもevent.target.mute();を書いてください。
これでは、onPlayerReadyを呼び出しているplayerDはミュートになりますが、onPlayerReady2を呼び出しているplayersの4つはミュートになりません。
1<!DOCTYPE html>
2<html>
3 <head>
4 <meta charset="utf-8"/>
5 </head>
6 <body>
7 <!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
8 <div id="player"></div>
910 <script>
11 // 2. This code loads the IFrame Player API code asynchronously.
12 var tag = document.createElement('script');
1314 tag.src = "https://www.youtube.com/iframe_api";
15 var firstScriptTag = document.getElementsByTagName('script')[0];
16 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
1718 // 3. This function creates an <iframe> (and YouTube player)
19 // after the API code downloads.
20 var player;
2122 // 動画のID
23 const videoId = 'M7lc1UVf-VE';
2425 function onYouTubeIframeAPIReady() {
26 player = new YT.Player('player', {
27 height: '360',
28 width: '640',
29 playerVars: {
30 playlist: videoId,
31 // 以下のオプションはChrome・Firefox・Operaでは使えないが、なぜかEdgeでは使える
32 autoplay: 1,
33 mute: 1,
34 loop: 1
35 },
36 videoId: videoId,
37 // イベントがEdgeで発火しない・・・?
38 events: {
39 'onReady': onPlayerReady,
40 'onStateChange': onPlayerStateChange
41 }
42 });
43 }
4445 // 4. The API will call this function when the video player is ready.
46 // ↑ 実際はプレイリストを読み込む場合は準備できていない。少し待たないといけない。
47 function onPlayerReady(event) {
48 event.target.mute(); // ミュート
49 event.target.setLoop(true); // ループ
50 event.target.playVideo(); // 動画の開始
51 }
5253 // 5. The API calls this function when the player's state changes.
54 // The function indicates that when playing a video (state=1),
55 // the player should play for six seconds and then stop.
56 function onPlayerStateChange(event) {
57 }
58 </script>
59 </body>
60</html>