diff --git a/_server/editor_ui.js b/_server/editor_ui.js
index 4965f1ea..cc9588ed 100644
--- a/_server/editor_ui.js
+++ b/_server/editor_ui.js
@@ -792,8 +792,10 @@ editor_ui_wrapper = function (editor) {
}
// 试听音频
if (one.endsWith('.mp3') || one.endsWith('.wmv') || one.endsWith('.ogg') || one.endsWith('.wav')) {
- html += "";
- html += '
';
+ html += "";
+ html += `0:00 / 0:00
+
+ `;
}
html += '
';
});
@@ -824,19 +826,41 @@ editor_ui_wrapper = function (editor) {
}
uievent._previewMaterialAudio = function (button) {
- var br = button.nextElementSibling;
+ var span = button.nextElementSibling;
+ var br = span.nextElementSibling;
var audio = br.nextElementSibling;
+ var progress = audio.nextElementSibling;
if (br.style.display == 'none') {
- button.innerText = '折叠';
+ button.innerText = '暂停';
br.style.display = 'block';
- audio.style.display = 'block';
+ progress.style.display = 'block';
+ span.style.display = 'inline';
+ audio.play();
} else {
- button.innerText = '试听';
+ button.innerText = '播放';
br.style.display = 'none';
- audio.style.display = 'none';
+ progress.style.display='none';
+ span.style.display = 'none';
+ audio.pause();
}
}
+ uievent._previewMaterialAudio_onTimeUpdate = function (audio) {
+ var _format = function (time) { return parseInt(time/60) + ":" + core.setTwoDigits(parseInt(time) % 60); }
+ if (audio.duration > 0) {
+ audio.previousElementSibling.previousElementSibling.innerText = _format(audio.currentTime) + " / " + _format(audio.duration);
+ audio.nextElementSibling.setAttribute('value', audio.currentTime / audio.duration);
+ }
+ }
+
+ uievent._previewMaterialAudio_seek = function (element, event) {
+ var audio = element.previousElementSibling;
+ var value = event.offsetX * element.max / element.offsetWidth;
+ element.setAttribute("value", value);
+ audio.currentTime = audio.duration * value;
+ if (audio.paused) audio.play();
+ }
+
editor.constructor.prototype.uievent=uievent;
}
\ No newline at end of file
diff --git a/project/data.js b/project/data.js
index 396be475..4f33fa23 100644
--- a/project/data.js
+++ b/project/data.js
@@ -36,9 +36,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"bomb.mp3",
"centerFly.mp3"
],
- "fonts": [
- "number"
- ],
+ "fonts": [],
"nameMap": {
"背景图.jpg": "bg.jpg",
"背景音乐.mp3": "bgm.mp3"
diff --git a/project/fonts/number.ttf b/project/fonts/number.ttf
deleted file mode 100644
index bcf90fae..00000000
Binary files a/project/fonts/number.ttf and /dev/null differ
diff --git a/server.py b/server.py
index c6d279ff..6aaea881 100644
--- a/server.py
+++ b/server.py
@@ -67,7 +67,10 @@ def static_file(path):
if not os.path.isfile(path):
abort(404)
return None
- return Response(get_file(path), mimetype = get_mimetype(path))
+ mimetype = get_mimetype(path)
+ response = Response(get_file(path), mimetype = mimetype)
+ if mimetype.startswith('audio/'): response.headers["Accept-Ranges"] = "bytes"
+ return response
def process_request():
data = request.get_data() # str in py2 and bytes in py3
diff --git a/styles.css b/styles.css
index a188118e..d981dfdf 100644
--- a/styles.css
+++ b/styles.css
@@ -218,7 +218,7 @@
max-height: 1.6em;
}
#statusBar span{
- font: bold italic 1.1em number, Verdana;
+ font: bold italic 1.1em Verdana;
display: inline;
}
#statusBar p {