You are overwriting your ready
function in every iteration of your loop. So only the last ready
function will be executed.
An example solution would be to replace ready
with ready<?php echo $nummy ?>
(I suppose that $nummy
is unique):
function ready<?php echo $nummy ?>(player_id) {
// your function body
}
window.addEventListener('load', function() {
//Attach the ready event to the iframe
$f(document.getElementById('play<? echo $nummy?>')).addEvent('ready', ready<?php echo $nummy ?>);
});
P.s.: It is not an ideal solution. But a possible solution.