···
79
79
</div>
80
80
);
81
81
}
82
82
+
83
83
+
84
84
+
/*
85
85
+
let ytplayer;
86
86
+
let spotplayer;
87
87
+
const script = document.createElement("script");
88
88
+
script.src = "https://sdk.scdn.co/spotify-player.js";
89
89
+
script.async = true;
90
90
+
document.body.appendChild(script);
91
91
+
function play2(id: string, type: string) {
92
92
+
if (type === "youtube") {
93
93
+
if (ytplayer) {
94
94
+
player.loadVideoById(id);
95
95
+
} else {
96
96
+
player = new window.YT.Player("ytplayer", {
97
97
+
height: "315",
98
98
+
width: "560",
99
99
+
videoId: id,
100
100
+
events: {
101
101
+
onStateChange: onStateChange,
102
102
+
},
103
103
+
playerVars: {
104
104
+
autoplay: 1,
105
105
+
color: "white",
106
106
+
controls: 0,
107
107
+
disablekb: 1,
108
108
+
iv_load_policy: 3,
109
109
+
modestbranding: 1,
110
110
+
rel: 0,
111
111
+
showinfo: 0,
112
112
+
},
113
113
+
});
114
114
+
}
115
115
+
} else if (type === "spotify") {
116
116
+
if (spotplayer) {
117
117
+
fetch(`https://api.spotify.com/v1/me/player/play`, {
118
118
+
method: "PUT",
119
119
+
body: JSON.stringify({ uris: [`spotify:track:${id}`] }),
120
120
+
headers: {
121
121
+
"Content-Type": "application/json",
122
122
+
Authorization: `Bearer ${accessToken}`,
123
123
+
},
124
124
+
}) else {
125
125
+
player = new Spotify.Player({
126
126
+
name: 'Web Playback SDK',
127
127
+
getOAuthToken: cb => { cb(accessToken); },
128
128
+
volume: 0.5
129
129
+
})
130
130
+
}};
131
131
+
}
132
132
+
}
133
133
+
*/