OggPlayer is a script that makes playing Ogg files easier. It has two features:
- Removes the button and initializes all players for Ogg files (both audio and video) added through wiki-syntax
- Allows you to add a compact one-button audio player for things like sound bites.
Note: it doesn't fix the lack of support for Ogg format in some browsers (like IE, Older Legacy Edge Versions, or Safari).
By default, all files in the Ogg format that are inserted like images (
[[File:Some file.ogg]]) produce a button that initializes the player and a thumbnail if it's a video. The script removes the necessity to click the button for the player to show up (and in some cases rearrange the layout). It also removes the link "⧼ogg-more⧽".
Player auto-initialization is optional and can be turned off if you only want the button described below. To do that just add this to your MediaWiki:Common.js:
var oggPlayerButtonOnly = false;
This allows you to make a single button that after clicking will play a sound and stop and can be stopped by clicking again. If multiple buttons appear on the same page, clicking one will stop the playthrough of any other button.
There are multiple ways to insert it, whichever works best.
<span class="audio-button">[[File:Some sound.ogg]]</span> // a player <span class="audio-button">[[Media:Some sound.ogg]]</span> // a media link <span class="audio-button" data-src="http://.../Some_sound.ogg"></span> // a direct link
- Note: You can use
- Using this method will not trigger the "File Used By" tracker
- Note: Only files hosted on Fandom and Wikimedia servers with .ogg, .oga or .ogv extension.
If you want to change the appearance of the button you can use both inline style and CSS classes:
audio-button– all buttons have it ofc
now-playing– when the button is currently playing the sound
no-audio– when there's no sound for the button or the browser doesn't support Ogg format.
- You can add
click-parentclass to make the button play sound when the parent element is clicked (like the whole table cell).
- Everything inside the
.audio-buttonwill be removed.
Add i18n via translations editor.