JitsiMeetExternalApi doesn't start conference immediately

I start video conference using JitsiMeetExternalApi but sometimes video conference is not started just print first console log every 3 seconds. After a while, also prints second console log. How can solve this problem? I think api.getCurrentDevices() request replies late.

function getcurrent()
{
         console.log("getcurrent function..");
         api.getCurrentDevices().then(devices => {
                  console.log("getcurrentdevice: " + JSON.stringify(devices));
         });
}
var myVar = setInterval(getcurrent, 3000);