Element.Media 0.2

Element.Media is a Mootools plugin that provides easier handling of media interaction via a JavaScript interface. This plugin works with both media elements, that means audio and video — given that your browser has support for these elements.



Details

Author
Robin Grass
Current version
0.2
GitHub
vondoom/Element.Media
Downloads
4918
Category
Media
Tags
Report
GitHub Issues

Releases


Dependencies

  • core/1.2.3:
    • Array
    • Function
    • Number
    • String
    • Hash
    • Event
    • Class
    • Class.Extras
    • Element
    • Element.Event

How to use

The Element.Media constructor accepts a selector-object (via $ or $$ etc), a string (assumes id-selector) or an Element object.

Simple usage

var media = new Element.Media('my_element_id')

There is an option to create the media element on the fly, if so, input selector/element will act as it's parent.

Element creation

var media = new Element.Media('my_element_id', {
    element: {
        create: true,
        type: 'video',
        properties: {
            id: 'cinemoo'
        },
        sources: [
            { url: 'feature_moovie.ogg', type: 'video/ogg' },
            { url: 'feature_moovie.m4v', type: 'video/mp4' }
        ]
    }   
});

Features

0.2

  • A pretty slick API for media event and interaction.
  • Creation of media elements via JavaScript.
  • Transcripts

Transcript Syntax

Transcripts, in simple words, return data and/or fires an callback on a specified time in the media's playback. This gives a neat way to have (for example) subtitles to an video element, or add some interaction to your media.

var myTranscript = new Hash({
    '00:00:01': 'Media playback started',
    '00:00:10': {
        text: 'Show some nifty diagram...',
        callback: function() {
            myDiagramObject.showDiagram(insertSumDataz);
        }
    }
});

Discuss

A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.

Found a bug in this plugin? Please report it this repository's Github Issues.

blog comments powered by Disqus