This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// initializeVideoStream() - Callback function when getUserMedia() returns successfully with a mediaStream object | |
// 1. Set the mediaStream on the video tag | |
// 2. Use 'srcObject' attribute to determine whether to use the standard-based API or the legacy version | |
var initializeVideoStream = function(stream) { | |
mediaStream = stream; | |
var video = document.getElementById('videoTag'); | |
if (typeof (video.srcObject) !== 'undefined') { | |
video.srcObject = mediaStream; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// initializeVideoStream() - Callback function when getUserMedia() returns successfully with a mediaStream object | |
// 1. Set the mediaStream on the video tag | |
// 2. Use 'srcObject' attribute to determine whether to use the standard-based API or the legacy version | |
var initializeVideoStream = function(stream) { | |
mediaStream = stream; | |
var video = document.getElementById('videoTag'); | |
if (typeof (video.srcObject) !== 'undefined') { | |
video.srcObject = mediaStream; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// savePhoto() - Function invoked when user clicks on the canvas element | |
// 1. If msSaveBlob is supported, get the photo blob from the canvas and save the image file | |
// 2. Otherwise, set up the download attribute of the anchor element and download the image file | |
var savePhoto = function() { | |
if (photoReady) { | |
var canvas = document.getElementById('canvasTag'); | |
if (navigator.msSaveBlob) { | |
var imgData = canvas.msToBlob('image/jpeg'); | |
navigator.msSaveBlob(imgData, 'myPhoto.jpg'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*x-radial-buttons.html*/ | |
var currentAccent = 'en-US'; | |
var accentArr = ['en-US', 'en-GB', 'es-ES']; | |
getCurrentAccent: function () { | |
return currentAccent; | |
}, | |
/* Main.js*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
form.addEventListener('submit', function (e) { window.pokemonApp.sayTheName(e) }); | |
// Say the text when button is pressed | |
pokemonApp.sayTheName = function (e) { | |
e.preventDefault(); | |
playerElement.speak(); | |
console.log(radialButtons.intValue); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input.addEventListener('input', function (e) { | |
playerElement.setAttribute('text', input.value); | |
xPokemon.name = input.value; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Container for Web Components content --> | |
<aside> | |
<h3>Enter the name of a Pokemon!</h3> | |
<form id="player-form" class="pure-form"> | |
<input id="player-input" type="text" value="pikachu"> | |
<button id="player-submit" class="pure-button pure-button-primary">Speak!</button> | |
<button id="btn-change-accent" class="pure-button pure-button-primary">Change Accent</button> | |
<!-- Text-to-speech --> | |
<voice-player id="player-element" accent="es-ES" text=""></voice-player> | |
</form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<article> | |
<header> | |
<h1>Gotta say 'em all! </h1> | |
<p>This web app takes advantage of Web Components and Polymer to enable new HTML features in the browser.</p> | |
<p> | |
In this particular case, we are using <a href="https://github.com/passy/x-pokemon" target="_blank"> | |
the x-pokemon web component </a> to pull the images from a database, as well as the | |
<a href="http://zenorocha.github.io/voice-elements/" target="_blank">voice-elements web component</a> to speak the name of the pokemon we entered. | |
</p> | |
<p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="import" href="bower_components/polymer/polymer.html" > | |
<link rel="import" href="../paper-radio-group/paper-radio-group.html" > | |
<link rel="import" href="../paper-radio-button/paper-radio-button.html"> | |
<polymer-element name="x-radial-buttons"> | |
<!-- Shadow DOM --> | |
<template> | |
<style> | |
#paper_radio_group { | |
position: relative; |