Toolbox
  • Printable version
 
Toolbox
LANGUAGES
Language
Personal tools
Categories
Wikipedia Affiliate Button
 

Media handlers

From BrightByte

Jump to: navigation, search

It seems my MediaWiki media dreams are coming true: Tim Starling has written a media handler framework for MediaWiki. It is pretty much exactly what i had in mind with "Presentation Handlers", but doesn't cover format validation and the meta-data yet. On IRC he said it should be easy to add that.

I believe we'll have to think a bit more about what abilities a hander should have, what it specializes on, and thus if we need more than one type of handler. Basically, I think there should be two:

  • handlers for specific file formats (called "upload handlers" earlier, but that may not be the best term). These would be responsible for verifying uploaded files, extracting (and maybe displaying) meta-data, and transforming/scaling/transcoding files.
  • handlers for media types which determine how the media is presented to the user (what Tim's "media handlers" currently do, and I called "presentation handlers" earlier); ideally, there would just be handlers for image, video, audio, etc. In practice, we'd probably need special presentation handlers for specific formats (or groups of formats): for example it may be a good idea to have a specialized player for OGG audio and video (with two modes for these types), instead of expecting the default audio and video handlers to handle OGG. Similarly, SVG would have to be treated specially.

Earlier, I suggested to bind upload handlers to file extensions, and presentation handlers to mime-type + "flavor" (like application/ogg#vorbis); Tim suggested to let the file format (upload) handler specify directly which presentation handler would be appropriate. This would give more control to the code, and would allow the different handlers to interact more closely. But it would also be less flexible in terms of configuration and customization.

I'm a bit unclear about where the transform/transcode functionality belongs, especially since Tim mentions something about asynchronous, on-the-fly conversion. This seems to be entangled with the presentation, while the actual transcoding code would be specific to a given file format.

Free Content
Freecontent.png

[talk page]Talk:Media handlers

[edit] Would it also work for XML

Hoi, SignWriter is a script that is used for writing sign languages. It would be great if the specific type of XML would be shown in MediaWiki .. when SignPuddle is the external editor that creates the content it might mean that in this way we could support the deaf and their languages.

Thanks,

   GerardM
The architecture would work with any type of file. For a specific format (XML or whatever else), an appropriate plugin would have to be written that converts this to something a browser understands (PNG or whatever). The point of the new architecture is to make it possible to write such plugins, where previously you would have to hack around various places in the core code if you wanted to add support for another format. -- Daniel 15:14, 25 April 2007 (CEST)

[edit] MediaHandler a mysterious beast

Has there been any head way on this front. I see that in my SVN copy of version 1.10 all media is passed through a MediaHandler.

So far only Images are used and any other type produces a MediaHandler::getHandler: no handler found for MIME Type. where MIME Type is what ever type you have (i.e. audio/mp3)

This suggests to me that one could program a MediaHandler similar to an extension. So I looked at the code to try and figure out how. Most unfortunately the abstract methods seem very Image oriented and I cannot find any documentation (Not even a rouge email on an obscure mailing list). I tried to mimic the ImageHandler but found the learning curve almost too steep.

I like that MediaWiki is moving in this direction but was wondering to what extent. Has anyone else attempted a MediaHandler extension yet?

[edit] As an example

I was attempting to provide a "how to display" non-displayable media types. Before version 1.10 in order to play an MP3 file I had to use the FlashMP3 extension. But forcing the layman user to remember Yet Another wikitext syntax was too much. I wanted a flash player to added to the HTML when ever you got the [[Media:File.mp3]] syntax.

The MediaHadler looks perfect for this. However I have yet been able to find were the MediaHandler actually processes the Output to HTML function.

Any ideas? -- Sukima 22:13, 1 May 2007 (CEST)

Yes, this seems to be pretty much what you are looking for. But this part of the code is pretty new, so there's not much documentation yet. I haven't looked to closely at the code, but it seems like all generation of HTML is done through ThumbnailImage::toHTML. The thumbnail image in turn is supplied by the ImageHandler's doTransform and getTransform (there's also getScriptedTransform). Not sure which is for what, perhaps look at the basic implementation for simple images to get an idea. If you register a MediaHandler for MP3s, you can controll what "ThumbnailImage" is returned (even if it's not an image at all), and what HTML is generated (insert an MP3 player or whatever).
As an alternative, have a look at the Player extension - it allows easy integration of any type of player for any format. It uses <tag> syntax though. -- Daniel 00:48, 2 May 2007 (CEST)

Well I will look into the code. Perhaps I'm a bit too bleeding edge. As for the above extension: That looks like a possibility. I will investigate further. I may have to use the extension untill the MediaHandler framework matures a bit. Thank you for the suggestions. -- Sukima 10:24, 2 May 2007 (CEST)



The above comments may have been left by visitors.

This site's operators can not take responsibility for the content of such comments.