Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
93 lines (93 loc) · 2.9 KB
/
Copy pathindex.html
File metadata and controls
93 lines (93 loc) · 2.9 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- <link rel="stylesheet" type="text/css" href="main.css"> -->
<script src="main.js"></script>
<!-- <link rel="icon" href="favicon.ico"> -->
<!-- <title>Your Title</title> -->
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<script>
// Elm app
var app = Elm.Main.init({
node: document.getElementById('root'),
flags: Date.now()
});
// Edit the volume of the music
app.ports.changeVolume.subscribe(
(x) => {
try {
let id = x[0];
let vol = x[1];
// console.log("Change_Volume: ",id, vol);
if (!(vol === null)) {
let ele = document.getElementById(id);
// console.log(ele);
ele.volume = vol;
}
} catch (error) {
}
}
)
//Pause the music
// app.ports.pause.subscribe(
// id => {
// try {
// console.log("Pause: ",id);
// ele=document.getElementById(id);
// ele.pause();
// } catch (error) {
//
// }
// }
// )
//Set the time of the music
// app.ports.settime.subscribe(
// (x)=>{
// try{
// let id=x[0];
// let time=x[1];
// console.log("Set_Play_Time: ",id, time);
// if (!(time === null)) {
// let ele=document.getElementById(id);
// ele.currentTime=time;
// }
// }
// catch (error){
// }
// }
// )
//Start the music
// app.ports.start.subscribe(
// id => {
// try {
// console.log("Start_Music: ",id);
// let ele=document.getElementById(id);
// ele.play();
// }
// catch (error){
// }
// }
// )
//Set the rate of the music
// app.ports.setrate.subscribe(
// (x)=>{
// try{
// let id= x[0];
// let speed=x[1];
// let ele=document.getElementById(id);
// console.log("Set_Music_Rate: ",id, speed);
// ele.defaultPlaybackRate = speed;
// ele.load();
// }catch(error){}
// }
// )
</script>
</body>
</html>