Split any YouTube song into stems
TypeScript
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<div id="v" style="width: 640px; height: 360px;"></div>
<script>
const params = new URLSearchParams(location.search)
const useOrigin = params.get('variant') === '1'
window.log = (m) => console.log(m)
log('page-origin=' + location.origin)
window.onYouTubeIframeAPIReady = () => {
log('api-ready')
new window.YT.Player('v', {
videoId: 'dQw4w9WgXcQ',
width: '640',
height: '360',
playerVars: {
controls: 0,
disablekb: 1,
rel: 0,
playsinline: 1,
...(useOrigin ? { origin: location.origin } : {})
},
events: {
onReady: () => log('ONREADY'),
onError: (e) => log('ONERROR code=' + e.data),
onStateChange: (e) => log('STATE=' + e.data)
}
})
}
const s = document.createElement('script')
s.src = 'https://www.youtube.com/iframe_api'
document.head.appendChild(s)
</script>
</body>
</html>