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
|
define.class("$server/composition",function(require, $ui$, screen, label, button, view, bargraphic, $widgets$, audioplayer) {
this.render = function() {
return [
screen(
view({flex: 1, flexdirection: 'column', justifycontents:'space-around'},
audioplayer({name: 'player', autoplay: false,
width: 600, height: 200,
bgcolor: vec4('gray'), fgcolor: vec4('yellow'),
url: './assets/YACHT_-_09_-_Im_In_Love_With_A_Ripper_Party_Mix_Instrumental.mp3',
update: function() {
this.screen.find('time').text = 'time: ' + this.currenttime.toFixed(2)
}
}),
view({width: 600, height: 50, flexdirection: 'row'},
button({text: 'Start/Stop', width: 100, height: 30, flex:0,
click: function() {
var player = this.screen.find('player')
if (player.playing)
player.stop();
else
player.play();
}
}),
button({text: 'Pause', width: 100, height: 30, flex:0,
click: function() {
var player = this.screen.find('player')
player.pause();
}
}),
label({name: 'time', text: '', marginleft:10, width: 200})
)
)
)
]
}
}
)
|