Skip to content

Instantly share code, notes, and snippets.

@norio-nomura
Created August 19, 2014 05:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save norio-nomura/efb2dbf219f69cf9cacb to your computer and use it in GitHub Desktop.
Save norio-nomura/efb2dbf219f69cf9cacb to your computer and use it in GitHub Desktop.
Restore/Save Audio Volume
javascript:$.getScript('//cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js', function(){
audioVolume = $.cookie('audioVolume');
$('audio').each(function(){
if (audioVolume) {
this.player.setVolume(audioVolume);
}
$(this).on('volumechange', function(){
$.cookie('audioVolume', this.player.getVolume(), {expires: 100, path: '/'});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment