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

added createCaptions method #18

Closed steevhise closed 6 years ago

steevhise commented 12 years ago

Hi, in light of the new Brightcove closed captioning functionality in the Media API, I added an appropriate method in the PHP wrapper that I thought you might want to pull in. (in fact, a brightcove person on the BC community forum suggested it.)

So far this just handles remote-hosted captions, not uploading xml directly to BC.

example use (from a Drupal implementation) would be:

              //  set the closed-caption XML file url, if there is one.
              if($cc_xml_path = $node->field_cc_xml[0]['filepath']) {
               $cc_xml_url = "$base_url/$cc_xml_path";
               // $cc_xml_url = "http://mun2.tv/$cc_xml_path";   // for now., testing
               $caption_source = array( 'displayName' => "caption for " . $node->title,
                                        'url' => $cc_xml_url,
                                        );
               try {
                 $response = $bc->createCaptions($caption_source, $id = $meta['id']);
               } catch (Exception $error) {
                 drupal_set_message('Brightcove Error: Unable to set closed captions: ' . $error);
               }
              }

reference:
http://forum.brightcove.com/t5/Media-APIs/adding-Closed-Captions-via-Media-API/m-p/21306

thanks,

steev