Starting Samsung Maple implementation of new media API; brought the basic state machine implementation in from tag (where it was HTML5, but generic) and updated it to use the updated API (as there have been changes since that tag was taken).