, You seem to be having some kind of issue with output buffering. YouTubeToMp3Converter::UpdateVideoDownloadProgress() should look like the following:
function UpdateVideoDownloadProgress($downloadSize, $downloaded, $uploadSize, $uploaded)
$percent = round($downloaded/$downloadSize, 2) * 100;
if ($percent > $this->_percentVidDownloaded)
The following code:
...is what flushes the output buffer immediately, every time cURL accesses YouTubeToMp3Converter::UpdateVideoDownloadProgress(). For some reason, this is not happening for you, and the <script> blocks do not output until ALL code is completely done running. I don't know why this is happening for you.