Great, thanks!
Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/581bb79d-2c92-441e-9fab-50143f670ab4%40googlegroups.com.
<link rel="import" href="../bower_components/google-youtube/google-youtube.html">
<link rel="import" href="../bower_components/paper-dialog/paper-dialog.html">
<link rel="import" href="../bower_components/paper-dialog-behavior/paper-dialog-behavior.html">
<link rel="import" href="../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../bower_components/iron-icons/iron-icons.html">
<link rel="import" href="../bower_components/neon-animation/animations/fade-out-animation.html">
<link rel="import" href="../bower_components/neon-animation/animations/scale-up-animation.html">
<link rel="import" type="css" href="../bower_components/paper-dialog-behavior/paper-dialog-common.css">
<link rel="import" href="../bower_components/paper-styles/paper-styles.html">
<dom-module id="video-player">
<style>
:host {
@apply(--layout-fit);
}
</style>
<template>
<template is="dom-if" if="{{show.video}}">
<div class="layout vertical fit">
<google-youtube style="height: 100%"
video-id="YMWd7QnXY8E"
rel="1"
start="1"
playsinline="0"
controls="2"
showinfo="0"
width="100%"
height="100%"
autoplay="1">
</google-youtube>
</div>
<template is="dom-if" if="{{show.backButton}}">
<paper-button dialog-dismiss style="color: white; margin-top: 0px">
<paper-icon-button icon="arrow-back"></paper-icon-button>
</paper-button>
</template>
</template>
</template>
<script>
Polymer({
is: "video-player",
behaviors: [
Polymer.PaperDialogBehavior,
Polymer.NeonAnimationRunnerBehavior
],
properties: {
foo: { Object,
notify: true
},
entryAnimation: {
value: 'scale-up-animation'
},
exitAnimation: {
value: 'fade-out-animation'
}
},
listeners: { 'iron-overlay-opened': 'enableElement',
'iron-overlay-closed': 'stopPlayer'
},
timeWait: 300,
startPlayer: function() {
this.playAnimation('entry');
this.show = { backButton: true};
youtubePlayer = this.$$('google-youtube');
if (youtubePlayer.playbackstarted) {
youtubePlayer.play();
}
},
enableElement: function(e) {
this.show = { video: true};
setTimeout(this.startPlayer.bind(this), this.timeWait);
},
stopPlayer: function(e) {
this.timeWait = 0;
this.playAnimation('exit');
youtubePlayer = this.$$('google-youtube');
youtubePlayer.pause();
youtubePlayer.seekTo(1);
this.show = { video: false,
backButton: false }
},
ready: function() {
console.log("sssssssssssssssssSS");
}
});
</script>
</dom-module>