如何在聚合物中播放youtube视频
我想在聚合物网页中播放YouTube视频。但它只播放音频无法看到视频或任何其他控制器来停止视频。即使我指向另一页,视频也会在后台播放。我想显示视频并在指向另一个链接页面时停止视频。
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/paper-button/paper-button.html">
<link rel="import" href="../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../bower_components/paper-dialog/paper-dialog.html">
<link rel="import" href="../bower_components/google-youtube/google-youtube.html">
<link rel="import" href="shared-styles.html">
<dom-module id="my-video">
<template>
<style include="shared-styles">
:host {
display: block;
padding: 10px;
}
</style>
<paper-dialog class="video-dialog fit">
<div class="layout horizontal">
<paper-button dialog-dismiss>
<paper-icon-button icon="arrow-back"></paper-icon-button>
</paper-button>
</div>
<div style="height: 100%; width: 100%">
<google-youtube style="height: 100%;"
video-id="YMWd7QnXY8E"
rel="1"
start="5"
playsinline="0"
controls="2"
showinfo="0"
width="100%"
height="100%"
autoplay="1">
</google-youtube></div>
</paper-dialog>
</template>
<script>
Polymer({
is: 'my-video',
properties: {
},
});
</script>
</dom-module>