Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: polymer_1.0.4/bower_components/google-youtube/demo/demo.elements.html

Issue 1205703007: Add polymer 1.0 to npm_modules (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Renamed folder to 1.0.4 Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <link rel="import" href="../../polymer/polymer.html">
2 <link rel="import" href="../google-youtube.html">
3
4
5 <dom-module id="demo-element">
6 <template id="page-template">
7 <style>
8 div {
9 margin-bottom: 1em;
10 }
11 </style>
12 <h1><code>&lt;google-youtube&gt;</code> Demo</h1>
13 <h3>Full API Demo</h3>
14 <google-youtube id="googleYouTube"
15 playsupported="{{playSupported}}"
16 video-id="mN7IAaRdi_k"
17 state="{{state}}"
18 currenttime="{{currentTime}}"
19 currenttimeformatted="{{currentTimeFormatted}}"
20 duration="{{duration}}"
21 durationformatted="{{durationFormatted}}"
22 fractionloaded="{{fractionLoaded}}"
23 on-google-youtube-state-change="handleStateChange"
24 on-google-youtube-error="handleYouTubeError">
25 </google-youtube>
26
27 <div>
28 <p>Playback Progress: <span>{{currentTimeFormatted}}</span> / <span>{{dura tionFormatted}}</span> <progress max="1" value="{{computeProgress(currentTime, d uration)}}"></progress></p>
29 </div>
30
31 <div>
32 <button id="play-video"
33 disabled="{{computePlayDisabled(state, playSupported)}}"
34 on-click="handlePlayVideo"
35 >Play</button>
36 <button id="pause-video"
37 disabled="{{computePauseDisabled(state)}}"
38 on-click="handlePauseVideo"
39 >Pause</button>
40 </div>
41
42 <div>
43 <label for="videoId">Video ID:</label>
44 <input id="videoId" value="M7lc1UVf-VE">
45 <button id="cue-video" on-click="handleCueVideo">Cue</button>
46 </div>
47
48 <div>
49 <p>Player Events:</p>
50 <ol>
51 <template is="dom-repeat" items="{{events}}">
52 <li>State change: <span>{{item.data}}</span></li>
53 </template>
54 </ol>
55 </div>
56
57 <h3>Custom Thumbnail Demo</h3>
58 <google-youtube video-id="yRbOSdAe_JU"
59 width="853px"
60 height="480px"
61 thumbnail="//www.polymer-project.org/images/logos/p-logo.svg ">
62 </google-youtube>
63 </template>
64 </dom-module>
65 <script>
66 Polymer({
67 is: 'demo-element',
68 properties: {
69 playSupported: String,
70 state: String,
71 currentTime: Number,
72 currentTimeFormatted: String,
73 duration: Number,
74 durationFormatted: String,
75 fractionLoaded: Number,
76 events: {
77 type: Array,
78 value: []
79 }
80 },
81 computeProgress: function(currentTime, duration) {
82 return currentTime / duration;
83 },
84 computePlayDisabled: function(state, playSupported) {
85 return state == 1 || state == 3 || !playSupported;
86 },
87 computePauseDisabled: function(state) {
88 return state != 1 && state != 3;
89 },
90 handleStateChange: function(ev) {
91 this.events.push({data: ev.detail.data});
92 },
93 handleYouTubeError: function(ev) {
94 console.error('YouTube playback error', ev.detail);
95 },
96 handlePlayVideo: function(ev) {
97 this.$.googleYouTube.play();
98 },
99 handlePauseVideo: function(ev) {
100 this.$.googleYouTube.pause();
101 },
102 handleCueVideo: function(ev) {
103 this.$.googleYouTube.videoid = this.$.videoId.value;
104 }
105 });
106
107 </script>
108
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698