Now that we have an abstract MediaElement
class, we want to build on top of it to allow for audio playback. Starting with the base template we've established, we'll create an App.Audio
class that contains all the functionality for this page; from creating an instance of MediaElement
, to creating a drop-down menu for switching tracks and managing the volume of each track.
We can establish a base template by following the pattern we have previously established. Here is some code you can start out with as a template:
var App = window.App || {}; App.Audio = (function(window, document, $){ 'use strict'; var _defaults = { 'element': 'audio', 'name': 'Audio' }; function Audio(options) { this.options = $.extend({}, _defaults, options); this.element = this.options.element; this.$element = $(this.element); attachEvents.call(this); } function attachEvents() { } Audio.prototype.getDefaults...