Help:Extension:Wikispeech/zh
![]() |
注意:當您編輯本頁面時,即同意以CC0協議授權您的貢獻。您可以在公有領域帮助页面找到更多信息。 | ![]() |
Wikispeech is an extension for MediaWiki that reads the content of a page out loud. It is still under development and features will change and be added.
Activating
If Wikispeech is enabled on a wiki, you may still need to activate it to show the interface and start listening. To do this, click on the tab "Listen" (or equivalent for the language in question). You can hide the interface again by clicking on the same tab. You can also choose to show the interface automatically in your preferences.
As gadget or user script
If Wikispeech is not installed on your wiki, it may still be possible to run it as a gadget or user script. This relies on there being another wiki that runs Wikispeech and allows other wikis to use it. If there is such a wiki available, an administrator can add a gadget that enables Wikispeech or you can add a bit of code to your user script. There is a template for the script in the Wikispeech repository.[1] Then to enable the gadget:
- Go to your common.js, e.g for English Wikipedia go to en:Special:MyPage/common.js.
- Click "Edit source" or "Create source".
- Copy and paste the following text to the bottom of the page:
importScript('m:User:Sebastian Berlin (WMSE)/js/wikispeech.js');
- Click "Publish changes".
介面
The player can be found at the bottom of the page and looks like the picture below. With the player, you can start and stop listening to the text. You can also navigate by skipping back and forward in the text.
Here follows a description of what each button does. The shortcuts are the defaults and may be different on your wiki.
- Play Alt+⇧ Shift+↵ Enter
- Starts playing from the top of the page. Changes the button to Stop. Your web browser may not allow playback to start, since this is regarded as autoplay. To start playing, either allow audio autoplay for the site or interact with the page, e.g. by clicking somewhere.
- Stop Alt+⇧ Shift+↵ Enter
- Stops playing. Changes the button to Play.
- Skip back one sentence Alt+⇧ Shift+←
- Starts playing the previous sentence. If the current sentence has played for more than three seconds (default duration, may vary depending on configuration), rewinds to the start of the sentence instead.
- Skip forward one sentence Alt+⇧ Shift+→
- Starts playing the next sentence.
- Skip back one word Alt+⇧ Shift+↑
- Rewinds to the previous word.
- Skip forward one word Alt+⇧ Shift+↓
- Fast forward to the next word.
The following buttons may not appear, depending on configuration.
- Help
- Go to the help page.
- Feedback
- Go to the page for leaving feedback.
Selection Player
When you select text in the page, a smaller selection player will show up at the end of the selection. This player only contains the play/stop button, which works the same way as it does in the regular player. You can still use the regular player and the keyboard shortcuts to control the playback. When you deselect the text, the selection player will disappear.
Text Highlighting
Wikispeech highlights parts of the text as they are read. Both the current word and the sentence containing that word are highlighted, with different colours.
You can customize the look of the highlighting by editing your "common.css" or "global.css". Links to these can be found under Preferences -> Appearance. Below is example code for changing the sentence highlighting colour (to green) and removing the word highlighting colour, and instead highlighting words by underlining them. Note that it may not be a good idea to add rules that change the size of text (such as font size and bold), as it will cause the text to move around.
.ext-wikispeech-highlight-sentence {
background-color: rgb( 150, 255, 100 );
}
.ext-wikispeech-highlight-word {
all: unset;
text-decoration: underline;
}
For more help on editing CSS, see the user style help.
Known limitations
Sometimes there may be delays when a new sentence is read. This is in part due to not wanting to load too much audio before knowing if the user wants to listen to it; this would be unnecessary taxing, both for the server and the user's network. There are some plans for mitigating this, including smarter buffering.
Some things aren't read, like images and tables. This is because it's not obvious how these should be read, e.g. in what order should the cells in a table be read?
There is no way to pause and continue listening from the same place. There is also no way to start listening from anywhere but start of the page. This is functionality that we have not yet had time to implement, but something we plan to do since it would make listening more user friendly.
Wikispeech does not work in the standard mobile view. This is because it behaves differently than the desktop view. Until support is added for the mobile view, you can switch to the desktop view on your mobile to use Wikispeech. A link for this can be found at the bottom of every page.