1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
echo 'ob='.ob_get_level();
if (ob_get_level() == 0) ob_start();
# We'll poll the status of one of our asset
while(1) {
$cnt ++;
ob_start();
# We fetch the informations of the asset 'mp4_h264_aac'
$res = $dm->media->get_assets(array('id' => $media_id, 'assets_names' => array('mp4_h264_aac')));
$res2 = $dm->media->get_assets(array('id' => $media_id, 'assets_names' => array('jpeg_thumbnail_source')));
$res3 = $dm->media->get_assets(array('id' => $media_id, 'assets_names' => array('jpeg_thumbnail_small')));
$res4 = $dm->media->get_assets(array('id' => $media_id, 'assets_names' => array('jpeg_thumbnail_large')));
$res5 = $dm->media->get_assets(array('id' => $media_id, 'assets_names' => array('jpeg_thumbnail_medium')));
//trace($res);
//trace($res2);
$asset = $res->mp4_h264_aac;
$asset2 = $res2->jpeg_thumbnail_source;
$asset3 = $res3->jpeg_thumbnail_small;
$asset4 = $res4->jpeg_thumbnail_large;
$asset5 = $res5->jpeg_thumbnail_medium;
echo '. ';
echo str_pad('',6096)."\n";
for ($j = 0; $j < ob_get_level(); $j++) { ob_end_flush(); }
ob_implicit_flush(1);
# If it is ready we ask for the url of the flash player
if ($asset2->status == 'ready' && $asset->status == 'ready' && $asset3->status == 'ready' && $asset4->status == 'ready' && $asset5->status == 'ready') {
echo "Your media is ready, here is the url for your embed code:\n";
echo $dm->media->get_stream_url(array('id' => $media_id, 'asset_name' => 'mp4_h264_aac')) . "\n";
break;
# If the transcoding process failed we display an error
} else if ($asset->status == 'error') {
echo "Error while transcoding the media\n";
}
sleep(1);
} |
Partager