-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathchapters_editor.html
185 lines (159 loc) · 5.57 KB
/
chapters_editor.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CPU-Audio application : Chapters editor</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="./chapters_editor.js"></script>
<script src="../build/cpu-audio.js" async></script>
<style>
#configure label {
display: flex;
}
#configure label span {
flex : 0 0 150px;
}
#configure label input {
flex : 1 1 auto;
}
button, summary {
font-family: sans-serif;
color : black;
padding : 6px;
border-radius: 4px;
border: 2px outset gray;
background: #AAA;
display: inline-block;
}
button.validate {
color : white;
background : #070;
}
button#remove {
color : white;
background : #F00;
float : right;
}
#steps {
display : none;
}
.loaded #steps {
display: flex;
width: 100%;
}
#steps a {
padding : 4px;
border : 1px #ccc solid;
}
fieldset {
border :1px solid #ccc
}
input {
border: 2px solid gray;
box-sizing: border-box;
margin: 2px;
padding: 2px;
font-size: 15px;
color: black;
background: #ddd;
caret-color: black;
}
#text_input {
width : 100%;
}
</style>
</head>
<body>
<p><a href="../examples.html">← back to examples list</a></p>
<h1>CPU-Audio chapters editor</h1>
<details id="at_start" open>
<p>
This is a primitive live chapters editor for CPU-Audio, helping you to build link in page for your website, blog, CMS, etc.
</p>
<summary>Configure editor</summary>
<form id="configure"><!-- action="#edit_chapters" method="post"> -->
<fieldset>
<label for="source_audio">
<span>URL source audio</span>
<input id="source_audio" name="source_audio" type="file" accept="audio/*,video/*" />
</label>
</fieldset>
<fieldset>
<label for="source_webvtt">
<span>(optional) : URL WebVTT track to re-edit</span>
<input id="source_webvtt" name="source_webvtt" type="file" />
</label>
</fieldset>
<fieldset class="actions">
<button type="submit" class="validate">Go to editor</button>
</fieldset>
<p>Think my editor is ugly ? You're right ! <a href="https://github.com/dascritch/cpu-audio/blob/master/CONTRIBUTING.md">Just help us !</a></p>
</form>
</details>
<details id="chapters">
<summary>Chapters editor</summary>
<form id="edit_chapters" action="#generated_html" method="post">
<fieldset class="actions">
<p>
<button type="button" class="validate" id="add"><strong>+</strong> Add a new chapter</button>
</p>
<p class="line editing">
<input id="timecode_input" inputmode="numeric" pattern="^([0-5]?[0-9]:){0,2}[0-5]?[0-9]$" placeholder="00:00:00" valu="0:00" size="8" />
<br />
<input id="text_input" type="text" placeholder="Chapter name" />
<br />
<button type="button" id="set">Set position to now</button>
<button type="button" id="test">Test time position</button>
<button type="button" id="remove">× Remove this chapter</button>
</p>
</fieldset>
</form>
<cpu-audio
title="First, Choose an URL for source"
hide="poster actions">
<audio controls id="sound">
<source src="./tests-assets/blank.mp3" type="audio/mpeg" />
<track kind="metadata" src="" default />
</audio>
<!-- fallback messages for browsers without webcomponents -->
<div class="cpu-audio-without-webcomponents too-old">
<h2>Player didn't start (yet ?)</h2>
<p>
Your browser is loading very slowly, or doesn't support WebComponent fairly enough. This application cannot run without it.
</p>
</div>
</cpu-audio>
<!-- -->
<fieldset>
<legend>Generated HTML</legend>
<div id="html_out">
</div>
<p>Copy and paste this HTML code :</p>
<pre id="html_source"></pre>
</fieldset>
<fieldset>
<legend>Generated MarkDown</legend>
<p>Copy and paste this MarkDown code :</p>
<pre id="md_source"></pre>
</fieldset>
<fieldset>
<legend>Generated DokuWiki</legend>
<p>Copy and paste this Wiki code :</p>
<pre id="wiki_source"></pre>
</fieldset>
<fieldset>
<legend>Generated WebVTT</legend>
<p><a id="vtt_source_download" download="chapter.vtt">Save this in a .vtt file</a> :</p>
<pre id="vtt_source"></pre>
<p>Then insert a <code><track kind="chapters" default src="…"></code> tag reffering it into your <code><audio control></code> tag</p>
</fieldset>
<fieldset>
<legend>Generated points JSON</legend>
<p><a id="json_source_download" download="points.json">Save this in a .json file</a> :</p>
<pre id="json_source"></pre>
<p>In your javascript, you can use <code>Element.CPU.bulkPoints(planeName, {<em>your generated json</em>});
</code> in your code</p>
</fieldset>
</details>
</body>
</html>