Page MenuHomePhabricator

Support inline player for MIDI files
Closed, ResolvedPublic

Description

Author: public.wiki

Description:
Could you consider supporting the play of Midi files?


Version: unspecified
Severity: enhancement

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:41 PM
bzimport set Reference to bz18852.

public.wiki wrote:

Could any developers give an reply? Please.

Moving this out of OggHandler extension to 'extension requests' generally.

I'm not sure how fully or consistently inline midi players are supported on modern browsers; if common and consistent, a MidiHandler class could probably be tossed into core pretty easily. If not, it might require jumping through some hoops to provide a player, which would be kinda uggy.

  • Bug 18922 has been marked as a duplicate of this bug. ***

alex.farlie wrote:

On Commons and other Mediawiki Wikis, there are uploads of MIDI files,

However, to play these 'in-browser' currently requires a non-free plugin (such as Quicktime)

By providing an 'inline' player for Midi (possibly based on Java) this dependence on a non-free plugin would be reduced.

One possible solution, but this would involve some work, is for the server side to do a one-shot rendering of MIDI files into a format like OGG (using something like FluidSynth and a suitable 'free' sample set).

A second solution would be to have a specific inline MIDI plugin.

The third solution is the current one, whereby the MIDI file is offered for
download to an external player.

There is now a MIDI player available in TMH (see Bug 43388). Maybe it could be used for all the MIDI files on commons?

Tentatively moving to TMH, though not sure if TMH itself needs further code changes, or if this falls into a server configuration category.

Jan / Michael: Do you know?

FWIW the Score extension invokes /usr/bin/timidity (the TiMidity++ MIDI converter) in Score.body.php's generateOgg() to convert MIDI files generated by GNU Lilypond into .ogg files. It seems plausible to do just this part of Score's processing for other MIDI files.

A different approach is to read, process, and play MIDI files directly in sufficiently powerful recent browsers, see http://mudcu.be/midi-js/

spage, thank you for clarifying this. I hadn't looked closely at Score and only saw that the player was JS. I didn't look at the source and only saw that Bug 43388 called for MIDI and assumed that, as a result, TMH was using MIDI.

But, yes, midi.js was the other tool I looked at for this. From my tests (and information on the website), it doesn't work as well in recent Firefox as it does in Chrome. Filing a bug with Mozilla.

I suddenly realize we have midi to ogg transcoding inside the Score extension...
Sounds like it would be doable to move that into TimedMediaHandler. Then we could have Score reuse it from there.

Change 511015 had a related patch set uploaded (by Ebe123; owner: Ebe123):
[mediawiki/extensions/TimedMediaHandler@master] Transcode MIDI files to OGG Vorbis and MP3

https://gerrit.wikimedia.org/r/511015

Ebe123 subscribed.

Gonna be resolved through T135597

Change 511015 merged by jenkins-bot:
[mediawiki/extensions/TimedMediaHandler@master] Transcode MIDI files to OGG Vorbis and MP3

https://gerrit.wikimedia.org/r/511015

T20852 hasn't really solved this issue because you still can't play MIDIs inline. The problem is not unique to MIDI, however, because not all browsers support all of the audio formats Commons accepts, especially Ogg/FLAC/Wave/WebM. Servers transcode them into Ogg and MP3 to fill this gap but the derived files cannot be linked to via a method like [[Media:...]] or {{filepath:...}}, while {{Audio}} remains to be one of the most common ways to refer to an audio clip on Wikipedia.

The best solution obviously would be to support embedding an audio via <audio>, which would not only solve the compatibility issue but also spare readers the trouble of interrupting the reading and going to a different page. This may be achieved effectively by something like [[File:Example.ogg|20px]], but that's a very clumsy way to do it (I wish each control button could be specifically turned off in [[File:...]]).

[[Media:]] is nothing more than a file download link and never will be anything but that. It has nothing to do with inline playing. [[File:]] transclusions exist to create players (or technically: has the responsibility to transform a file into HTML for a page.

Anything you want to change (I suspect you want to change the layout of the player ?) has to be provided via (either existing or new) options to [[File:]]. Please file anything like that as separate tickets.

{{Audio}} is a broken design and needs to be fixed, but that is not easily possible as long as the old player is still deployed for people, it will have to wait.