BrightcoveOS / PHP-MAPI-Wrapper

This project provides a starting point for integrating the Brightcove Media API into your application. It provides simple ways to interact with the API, as well as a long list of helper functions.
http://opensource.brightcove.com/project/PHP-MAPI-Wrapper/
48 stars 51 forks source link

Get video_fields from Playlist? #37

Closed bcolflesh closed 8 years ago

bcolflesh commented 8 years ago

Currently I can return specific fields from a video asset:

        $paramsprev = array(
            'video_id' => 1111111111111,
            'video_fields' => 'id,name,shortDescription,FLVURL,captioning'
        );
        $video_urls[] = $bc->find('videoById', $paramsprev);

I want to specify a playlist via ID and get all the video_fields for the contents, like above.

        $paramsprev = array(
            'playlist_id' => 1111111111111,
            'fields' => 'id,name,shortDescription,FLVURL,captioning'
        );
        $video_urls[] = $bc->find('playlistbyid', $paramsprev); 

just returns the fields associated with the playlist, not all the videos in it.

Is this possible?

bcolflesh commented 8 years ago

Ok, I figured this out - example below for future reference:

        $paramsprev = array(
            'playlist_id' => 1111111111111,
            'fields' => 'id,name,shortDescription,videos'
        );          

        $playlist_videos = $bc->find('playlistbyid', $paramsprev);

        for ($i = 0; $i < count($playlist_videos->videos); ++$i) {
            $params2 = array(
                'video_id' => $playlist_videos->videos[$i]->id,
                'video_fields' => 'id,name,shortDescription,FLVURL,captioning'
            );
            $video_urls[] = $bc->find('find_video_by_id', $params2);
        }