<!-- POLYMER -->
<link rel="import" href="../../lib/polymer/polymer.html">
<polymer-element name="fb-video" attributes="src">
	<template>
		<!-- MARKUP -->
		<!-- Only load the video after the JavaScript logic has been executed. -->
		<template if="{{youtube}}">
			<iframe id="smFbVideo" class="youtubeVideo" src="{{src}}"></iframe>
		</template>
		<template if="{{!youtube}}">
			<video id="smFbVideo" controls src="{{src}}"></video>
		</template>
	</template>
	<!-- SCRIPTS -->
	<script type="text/javascript">
		Polymer('fb-video', {
			ready: function() {
				// If the source video is a YouTube video...
				// Example URL: http://www.youtube.com/v/5aCrJVmali0?autohide=1&version=3&autoplay=1
				if (this.src.indexOf('youtube.com') > -1) {
					// Get the embed-able URL.
					// Replace the '/v' portion with '/embed'.
					this.src = this.src.replace(/.com\/v/gim, '.com/embed');
					// Then, get rid of all the unnecessary URL variables ('?' to the end).
					this.src = this.src.replace(/\?.+/gim, '');  
					this.youtube = true;
				} else {
					this.youtube = false;
				}
			}
		});
	</script>
</polymer-element>
<!-- POLYMER -->
<link rel="import" href="../../lib/polymer/polymer.html">
<polymer-element name="fb-video" attributes="src">
	<template>
		<!-- MARKUP -->
		<!-- Only load the video after the JavaScript logic has been executed. -->
		<template if="{{youtube}}">
			<iframe id="smFbVideo" class="youtubeVideo" src="{{src}}" allowfullscreen></iframe>
		</template>
		<template if="{{!youtube}}">
			<video id="smFbVideo" controls src="{{src}}"></video>
		</template>
	</template>
	<!-- SCRIPTS -->
	<script type="text/javascript">
		Polymer('fb-video', {
			ready: function() {
				// If the source video is a YouTube video...
				// Example URL: http://www.youtube.com/v/5aCrJVmali0?autohide=1&version=3&autoplay=1
				if (this.src.indexOf('youtube.com') > -1) {
					// Get the embed-able URL.
					// Replace the '/v' portion with '/embed'.
					this.src = this.src.replace(/.com\/v/gim, '.com/embed');
					// Then, get rid of all the unnecessary URL variables ('?' to the end).
					this.src = this.src.replace(/\?.+/gim, '');  
					this.youtube = true;
				} else {
					this.youtube = false;
				}
			}
		});
	</script>
</polymer-element>
Allow fullscreen for Facebook YouTube videos
Allow fullscreen for Facebook YouTube videos
