-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpodcast-player.html
108 lines (107 loc) · 2.29 KB
/
podcast-player.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<link rel="import" href="../polymer/polymer.html" />
<link rel="import" href = "../neon-animation/neon-animated-pages.html" / >
<link rel="import" href="song-file-display.html">
<link rel="import" href="song-file-player.html" />
<dom-module id="podcast-player">
<style>
:host {
width: 100%;
height: 150px;
background-color: var(--dark-primary-color);
position: absolute;
font-family: 'Roboto', sans-serif;
}
neon-animated-pages {
height: 150px;
}
song-file-player {
overflow: hidden;
}
</style>
<template>
<neon-animated-pages id="pages" selected="0">
<song-file-display
on-play-click="goToPlayer"
name="{{name}}"
episode="{{episode}}"
coverart="{{coverart}}"></song-file-display>
<song-file-player
on-pause-click="goToDisplay"
on-error="handlePlayerError"
src="{{src}}"
wavecolor="{{wavecolor}}"
progresscolor="{{progresscolor}}"
datapoints="{{datapoints}}"></song-file-player>
</neon-animated-pages>
<script id="wavesurferscript" type="text/javascript" src="wavesurfer.min.js" ></script>
</template>
</dom-module>
<script>
( function () {
Polymer({
is: 'podcast-player',
properties: {
src: {
type: String,
value: '',
notify: true
},
name: {
type: String,
value: '',
notify: true
},
wavesurfer: {
type: Object
},
wavecolor: {
type: String,
value: '#ffffff',
notify: true
},
progresscolor: {
type: String,
value: '#CFD8DC',
notify: true
},
coverart: {
type: String,
value: '',
notify: true
},
episode: {
type: String,
value: '',
notify: true
},
selectedPage :{
type: Number,
value: 0
},
datapoints: {
type: Array,
value: []
},
initPlayer: false
},
listeners: {
'wavesurferscript.load': 'updatewavesurfer'
},
goToPlayer : function(event) {
this.$.pages.selected = 1;
Polymer.dom(this.root)
.querySelector("song-file-player").play();
},
goToDisplay : function(event) {
this.$.pages.selected = 0;
},
updatewavesurfer: function(e) {
Polymer.dom(this.root)
.querySelector("song-file-player").updateWavesurfer();
},
handlePlayerError: function(e) {
this.initPlayer = false;
}
});
})();
</script>