block placeholder audio with a short audio clip
This commit is contained in:
parent
7398e74d71
commit
701c91ea66
@ -170,12 +170,27 @@ class Frame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const key in this.audioCache) {
|
for (const key in this.audioCache) {
|
||||||
this.audioCache[key].pause();
|
const audio = this.audioCache[key];
|
||||||
|
if (audio !== null) {
|
||||||
|
audio.pause();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const audio = this.audioCache[url] || new Audio(url);
|
let audio = this.audioCache[url];
|
||||||
|
if (audio) {
|
||||||
audio.currentTime = 0;
|
audio.currentTime = 0;
|
||||||
audio.play();
|
audio.play();
|
||||||
|
} else {
|
||||||
|
audio = new Audio(url);
|
||||||
|
audio.onloadeddata = () => {
|
||||||
|
if (audio.duration === 5.694694) {
|
||||||
|
audio = new Audio('mp3/button.mp3');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.audioCache[url] = audio;
|
||||||
|
audio.play();
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleError(error) {
|
handleError(error) {
|
||||||
|
BIN
ext/fg/mp3/button.mp3
Normal file
BIN
ext/fg/mp3/button.mp3
Normal file
Binary file not shown.
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "Yomichan",
|
"name": "Yomichan",
|
||||||
"version": "1.0.12",
|
"version": "1.0.13",
|
||||||
|
|
||||||
"description": "Japanese dictionary with Anki integration",
|
"description": "Japanese dictionary with Anki integration",
|
||||||
"icons": {"16": "img/icon16.png", "48": "img/icon48.png", "128": "img/icon128.png"},
|
"icons": {"16": "img/icon16.png", "48": "img/icon48.png", "128": "img/icon128.png"},
|
||||||
@ -31,13 +31,14 @@
|
|||||||
],
|
],
|
||||||
"web_accessible_resources": [
|
"web_accessible_resources": [
|
||||||
"fg/css/frame.css",
|
"fg/css/frame.css",
|
||||||
|
"fg/frame.html",
|
||||||
"fg/img/add_kanji.png",
|
"fg/img/add_kanji.png",
|
||||||
"fg/img/add_term_kana.png",
|
"fg/img/add_term_kana.png",
|
||||||
"fg/img/add_term_kanji.png",
|
"fg/img/add_term_kanji.png",
|
||||||
"fg/img/play_audio.png",
|
"fg/img/play_audio.png",
|
||||||
"fg/img/spinner.gif",
|
"fg/img/spinner.gif",
|
||||||
"fg/js/frame.js",
|
"fg/js/frame.js",
|
||||||
"fg/frame.html",
|
"fg/mp3/button.mp3",
|
||||||
"fg/ttf/kanji-stroke-orders.ttf",
|
"fg/ttf/kanji-stroke-orders.ttf",
|
||||||
"fg/ttf/vl-gothic-regular.ttf"
|
"fg/ttf/vl-gothic-regular.ttf"
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user