Php 检测流媒体上中止的连接

Php 检测流媒体上中止的连接,php,nginx,video-streaming,httpurlconnection,Php,Nginx,Video Streaming,Httpurlconnection,使用PHP读取流媒体链接,我想检测用户何时断开连接意味着关闭播放器,这样我就可以在断开连接的时间上进行统计 但是,连接似乎没有被执行 下面是我的例子: ob_end_clean(); //Clean (erase) the output buffer and turn off output buffering ob_start(); // Turn on output buffering ignore_user_abort(true); //TRUE ignores user aborts in

使用PHP读取流媒体链接,我想检测用户何时断开连接意味着关闭播放器,这样我就可以在断开连接的时间上进行统计

但是,连接似乎没有被执行

下面是我的例子:

ob_end_clean(); //Clean (erase) the output buffer and turn off output buffering
ob_start(); // Turn on output buffering
ignore_user_abort(true); //TRUE ignores user aborts in a script

$file = "http://192.168.1.2:8000/hls/250.m3u8";
header("location: $file");

$fd = fopen($file, "r");
while(!feof($fd)) {
    echo fread($fd, 1024 * 5);
    ob_flush();
    flush();
    if (connection_aborted()){
//this part not executing...
    $ManagerActiv->deleteClient_activity($activity);
    break;
    }
}
fclose ($fd);

exit();
die(); 
}

有人有主意吗?有人有主意吗?