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

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

@F3L1X79

Description

@F3L1X79

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions