Last modified: 2013-09-20 11:54:06 UTC
Original bug title: Provide a JavaScript API to activate TMH/create a player on a given video/audio and document it The issue: User- and gadget-scripts, and when option "use live preview" in the user's preferences is activated (that's why this is not just an enhancement), no player can be / is created on dynamically created/inserted content. Something simple like tmh.makePlayer({ node: // optional video node to convert to a player file: // name of the file that should be played }) would be welcome.
Please put the documentation at [[:mw:Extension:TimedMediaHandler/API]]. Thank you.
We do have a jQuery api: $('#videoTarget').embedPlayer( callback ) and it supports loading sources via mwtitle ... So something like: $('<video>') .addClass('kskin') .css({ width:'400px', height:'300px' }) .attr({ 'data-mwtitle' : "0DRIVE.ogv", // the wiki title name }) .appendTo('#mw-content-text') // must append to dom before calling embedPlayer .embedPlayer(); // rewrites the video tag with player interface, loads sources via mwtitle attribute. Would "work" but its missing poster and duration hint, so we should probably enhance to load thous items from mwtitle as well ( if not defined in the video tag )