We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello, I writed a jQuery plugin for simple usage of jquery.mb.audio. I hope that was usefull for you.
(function(window, $) { $.fn.mbAudio = function( options ) { var default_opts = { ended : function() {}, pause: function() {}, started : function() {}, sprite: "", } var opts = $.extend(default_opts, options); $.mbAudio.sounds = { }; selector = this.selector; return $("body").on("click", selector, function() { if( typeof $(this).data('src') === 'undefined') { return false; } var name = 'file_'+$(selector).index( this ); if( typeof $.mbAudio.sounds[name] === 'undefined' ) { var object_data = { id : name, mp3 : $(this).data('src'), elm : this }; $.mbAudio.sounds[name] = object_data; } if( typeof $(this).data('played') !== 'undefined' ) { $.mbAudio.pause( name ); $(this).removeData( 'played' ); opts.pause( this ); return false; } $(this).data( 'played', true ); opts.started( this ); var sprite = $( this ).data('sprite') ? $(this).data('sprite'): ""; $.mbAudio.play( name, sprite, function( a, id ) { opts.ended( id.elm ); $( id.elm ).removeData( 'played' ); }); return false; }); } })(window, jQuery); $(function() { $("a.audio-player").mbAudio({ ended : function( a ) { console.log( 'ended' ); }, pause : function( a ) { console.log( 'pause' ); }, started : function( a ) { console.log( 'started' ); } }); });
<a href="#" data-src="sounds/test.wav" data-sprite='{"id": "intro", "start": 10, "end": 20, "loop": true}' class="audio-player">test1</a> <a href="#" data-src="sounds/test.wav" data-sprite="" class="audio-player">test2</a>
Also i changed plugin in line 214 to :
callback(player, $.mbAudio.sounds[sID] );
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello,
I writed a jQuery plugin for simple usage of jquery.mb.audio.
I hope that was usefull for you.
Also i changed plugin in line 214 to :
The text was updated successfully, but these errors were encountered: