Actually I use the createMedia function to upload a video to Brightcove:
$id = $bc->createMedia('video', $file_bc, $metaData, $options);
It works fine, but I want to get the download URL of my file immediately after uploaded it - like this:
$id = $bc->createMedia('video', $file_bc, $metaData, $options);
$searchParams = array(
'video_id' => $id,
'media_delivery' => 'HTTP',
'video_fields' => 'FLVURL'
);
$cbf = $bc->find('videobyid', $searchParams);
$flvurl = $cbf->{'FLVURL'};
die(var_dump($flvurl)) ;
In this case, my $cbf remains NULL, I need to add a sleep() method since it looks like the datas need some time to be queryable from Brightcove - like this:
$id = $bc->createMedia('video', $file_bc, $metaData, $options);
sleep(30); //added this sleep()
$searchParams = array(
'video_id' => $id,
'media_delivery' => 'HTTP',
'video_fields' => 'FLVURL'
);
$cbf = $bc->find('videobyid', $searchParams);
$flvurl = $cbf->{'FLVURL'}; // the data is not NULL
die(var_dump($flvurl)) ;
Is there a workaround to avoid this?