if (player.getPlayerState()==5 || player.getPlayerState()==1) { // alert('player.getPlayerState()='+player.getPlayerState()); alert('$("#duration").val('+player.getDuration()+')'); var time = player.getDuration(); $("#duration").val(time); };