Recent activity
Subscribe to this feed
adrien Gibrat replied on November 22, 2009 19:00 to the idea "Using SoundManager 2 as Jquery plugin" in Schillmania!:
adrien Gibrat replied on November 17, 2009 01:52 to the question "sm2 with jquery and dynamic song list" in Schillmania!:
adrien Gibrat replied on November 17, 2009 01:51 to the idea "Using SoundManager 2 as Jquery plugin" in Schillmania!:
A wrote a proper plugin, check:
http://github.com/adriengibrat/jQuery...
adrien shared an idea in Schillmania! on January 28, 2009 11:07:
Using SoundManager 2 as Jquery pluginI wrote a simple plugin actig like inlineplayer.js, but with jQuery (Feel free to use/modify!):
$.playable = function( url, settings ) {
var sm = soundManager,
playable = arguments.callee;
sm.url = url;
sm.consoleOnly = window.location.hash.match(/console$/i);
sm.debugMode = window.location.hash.match(/^#debug/i);
$.extend( sm.defaultOptions,
{
autoStart : false,
autoNext : true,
pauseSkip : true,
playAlone : true,
doUnload : false,
css : {
playable: 'playable',
playing : 'playing',
paused : 'paused'
},
onload : function() {
if ( this.readyState == 2 )
playable.next.call( this );
},
onplay : function() {
var options = this.options,
current = options.element.removeClass( options.css.paused ).addClass( options.css.playing ).focus();
if ( playable.current && playable.current != current )
playable.current.data( 'playable' )[ options.pauseSkip ? 'pause' : 'stop' ]();
if ( options.playAlone )
playable.current = current;
},
onstop : function() {
var options = this.options;
options.element.removeClass( options.css.playing + ' ' + options.css.paused );
if ( options.doUnload )
this.unload();
},
onpause : function() {
var options = this.options;
options.element.removeClass( options.css.playing ).addClass( options.css.paused );
},
onresume : function() {
this.options.onplay.call( this );
},
onfinish : function() {
var options = this.options;
if ( options.autoNext )
playable.next.call( this );
options.onstop.call( this );
}
},
settings
);
$.extend( playable, {
count : 0,
current : null,
init : function( options ) {
var self = this,
options = $.extend( true, {}, sm.defaultOptions, options );
this.addClass( options.css.playable )
.click( function( event ) {
event.preventDefault();
$( this ).data( 'playable' ).togglePause();
} )
.each( function() {
$( this ).data( 'playable', sm.createSound( $.extend(
{
id : 'playable' + playable.count++,
url : this.href,
element : $( this ),
selector: self.selector
},
options
) ) );
} );
if ( options.autoStart )
self.filter( ':first' ).click();
},
next : function() {
var options = this.options,
next = $( options.element ).next( options.selector ).data( 'playable' );
if ( next && ! next.playState )
next.play();
}
}
);
};
$.fn.playable = function( options ) {
var self = this.is( 'a[href]' ) ? this : this.find( 'a[href]' );
soundManager.onload = function() {
if ( soundManager.canPlayURL( self.attr( 'href' ) ) )
$.playable.init.call( self, options );
};
};
$(function(){
/* Simple usage */
$.playable('soundmanager/swf/');
$('a').playable();
/* Full usage, with options
$.playable('soundmanager/swf/', { //options used here are stored as soundManager.defaultOptions
// You can use all SM2 default options, plus the following:
autoStart : false, // Start playing the first item
autoNext : false, // Play next itemwhen previous ends
pauseSkip : false, // Just pause previous on skip
playAlone : false, // Force stop/pause previous on skip
doUnload : false // Unload sound on stop/finish
});
//Exemples configurations
$('.playlist').playable({autoStart: true, autoNext: true, playAlone: true, doUnload: false});
$('.sampler').playable({autoStart: false, autoNext: false, playAlone: true});
$('.listen').playable({autoStart: false, autoNext: false, playAlone: true,pauseSkip: true, doUnload: true});
*/
});
adrien asked a question in Mozilla on October 24, 2008 00:28:
call ubiquity command from bookmarklet / javascriptIt could be usefull... i'm bored to write 'translate this in french'... and other frequent command i use, it could be great to be able to create buttons that trigger an ubiquity command!
Loading Profile...
