JQuery has nice visual fadeIn/fadeOut functions that work on different elements such as div. I need the same thing for sound.
More precisely, if two YouTube iFrame API players are playing from within 2 different div, is there a way to fadeIn/fadeOut the sound between them?
Try something like this,
$('<div/>').animate({ left: 100 }, {
duration: 1000,
step: function(now, fx){
var volume = now;
player.setVolume(volume)
}
});
the step function will give you a callback on every change of the val and you can call the youtube player to set the volume.
I am not sure how fast the youtube player can respond to the volume set... but this method allows you to have jquery tween effects just like in a div
Example usage with fadeTo function,
$('<div/>').fadeTo({
duration: 1000,
step: function(now, fx){
var volume = now * 100;
player.setVolume(volume)
}
},1);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With