jeudi 16 janvier 2020

If var empty do something else

I got an issue. I got a function here

    function onPlayerStateChange(event) {
if (event.data == YT.PlayerState.ENDED){
    player.current_video++;
    playVideo();
}
}

Which says that when my video ended it will add player.current_video by 1, however sometimes there is no next video.. then it just stops, i want something else to happen then.

My soulotion was something like this

    function onPlayerStateChange(event) {
if (event.data == YT.PlayerState.ENDED){
    player.current_video++;
    playVideo();
          if(!!player.current_video){
          newFunction();
          }
}
}

But it doesn't work, How am I supposed to write it to make it work?

Aucun commentaire:

Enregistrer un commentaire