7
I have tried the code below to solve.
var volumeIcon = 1;
$(".ico-volume").on('click', function(event) {
if (volumeIcon == 1)
{
$(this).find("img").removeAttr('src');
$(this).find("img").attr('src', 'img/ico/volume-out-ico.png');
volumeIcon = 0;
setVolume(volumeIcon);
}
else
{
$(this).find("img").removeAttr('src');
$(this).find("img").attr('src', 'img/ico/volume-in-ico.png');
volumeIcon = 1;
setVolume(volumeIcon);
}
});
essa primeira função é de um icone de volume que eu tenho aqui, e quando o usuário apertar ele troca a imagem, mas se atentem na função que ele chama por ultimo. Pois bem, aqui vai as outras funções:
function onYouTubePlayerReady(playerId)
{
ytplayer = document.getElementById("video");
}
function setVolume(volume)
{
if (ytplayer)
ytplayer.volume = volume;
}
Obs: In the player’s HTML, I already put the parameter in the enablejsapi=1
in the <iframe>
.
Could someone help me, please? D
Well, from the way my code came out, I can tell it’s the first time I’ve ever put it here. kkkkkkkkkk I’m sorry about that. If anyone can tell me how to put a code in here I’d appreciate it too! ^^
– Caio Chaim
where Youtube video comes from?
– Danilo Pádua
@Caiochaim Welcome to Stackoverflow, it would be interesting to check out the http://answall.com/tour tour to see how the site works.
– Marconi
Thanks Marconi for the tip! = D yes Danilo, I forgot to mention, is from Youtube yes!
– Caio Chaim
You’re incorporating the iframe. For example: <iframe width="854" height="480" src="https://www.youtube.com/embed/PearQPnNzE?list=WL" frameborder="0" allowfullscreen></iframe>
– Danilo Pádua
that’s it, that’s it! :)
– Caio Chaim