Skip to content

Instantly share code, notes, and snippets.

@imlucas
Created February 24, 2010 23:15
Show Gist options
  • Select an option

  • Save imlucas/314006 to your computer and use it in GitHub Desktop.

Select an option

Save imlucas/314006 to your computer and use it in GitHub Desktop.
/**
* You talk to sounds. sounds talk to sound players.
*/
var Sound = function(options){
this.id = options.id;
this.url = options.url;
this.__ready = options.on_ready || jQuery.noop();
this.__loading_progress = options.on_loading_progress || jQuery.noop();
this.__play_progress = options.on_play_progress || jQuery.noop();
this.__just_after_start = options.on_just_before_start || jQuery.noop();
this.__just_before_finish = options.on_just_before_finish || jQuery.noop();
this.__finish = options.on_finish || jQuery.noop();
this.__sp = SoundPlayer;
};
Sound.prototype = {
play: function(){
this.__sp.play(this);
},
pause: function(){
this.__sp.pause(this);
},
playOrPause: function(){
this.__sp.playOrPause();
}
}
SoundPlayerBase = function() {};
SoundPlayerBase.prototype = {
__playing: false, // Flag for play/pause/resume
nowPlaying: null, // Current Sound thats playing.
play: function(sound){},
pause: function(sound){},
playOrPause: function(sound){},
stop: function(sound){},
seek: function(sound, position_in_percent){},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment