Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

Is it possible to use findById immediately after createMedia? #39

Open
F3L1X79 opened this issue Dec 15, 2016 · 0 comments
Open

Is it possible to use findById immediately after createMedia? #39

F3L1X79 opened this issue Dec 15, 2016 · 0 comments

Comments

@F3L1X79
Copy link

F3L1X79 commented Dec 15, 2016

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant