1function stateChange(newState) {
2 setTimeout(function () {
3 if (newState == -1) {
4 alert('VIDEO HAS STOPPED');
5 }
6 }, 5000);
7}
8
1timeout(ms) { //pass a time in milliseconds to this function
2 return new Promise(resolve => setTimeout(resolve, ms));
3 }