samedi 25 juin 2016

Heroku. Flask. App works correct on local machine but works incorrect on Heroku

I use ffmpeg buildpack. heroku run "ffprobe http://91.192.180.66:1935/tv-channels/stream02/playlist.m3u8" works correct.

My code:

<?php 
// require('../vendor/autoload.php');
function run($url){
    $testArr=[];
    exec("timeout 20s ffprobe $url".' 2>&1',$output);
    foreach ($output as $i) {
        if (strpos($i, 'kb/s') !== false) {
    array_push($testArr,$i);
}
print_r("test<br>");
    }
    print_r($testArr);
    if ($testArr){
        return "good";
    }
    else{
        return "bad";
    }
}

print_r(run("http://91.192.180.66:1935/tv-channels/stream02/playlist.m3u8"));
return "ok";


 ?>

It works correct on local machine, and returns:

test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
Array ( [0] => Stream #0:2: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 108 kb/s ) good

On heroku it works incorrect and returns:

test
Array ( ) bad

My Procfile:

web: vendor/bin/heroku-php-apache2 web/

Source: https://github.com/taketa/testStream.git

I'am new in Flask and has no idea how to fix it. Very need your help Thanks.

Aucun commentaire:

Enregistrer un commentaire