Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 941 Bytes

README.md

File metadata and controls

32 lines (22 loc) · 941 Bytes

YouTube Live

Provides an embed code to show your current YouTube Live broadcast on any other site.

Basically this is a simpler, hosted version of my WordPress plugin.

Setup

  1. Log into https://console.cloud.google.com/
  2. Create a new project
  3. Enable the YouTube Data API product
  4. Create an API key

Usage

Add this markup to your page:

<iframe src="https://youtube-live.andrewrminion.com/live/{channelId}" id="youtube-live"></iframe>

<script>
	let iframe = document.querySelector('#youtube-live');

	window.addEventListener('message', function(e) {
		// message that was passed from iframe page
		let message = e.data;

		iframe.style.height = message.height + 'px';
		iframe.style.width = message.width + 'px';
	} , false);
</script>