Introduction
Vous trouverez ci-dessous deux applications PHP permettant de générer des flux pour iTunes et Ruku, en utilisant l'API de lecture comme source d'informations vidéo.
générateur de flux iTunes
  // UPDATED sample Video Cloud iTunes feed
  
  // Please use this at your own risk.
  // This is just a sample to get you started. You can customize further as your requirements
  // grow.
  
  // The following is a list of requirements and conditions in order for this podcast feed
  // to function properly;
  
  //1) You must have a Pro or Enterprise level Video Cloud Account.
  //2) You need to create the following custom fields. They are in your Account Settings: 
  // Video Fields page on the Video Cloud Studio Home page:
  //			1) itunesartist(text)
  //			2) explicit(text) values = yes|no, true|false, explicit|clean
  //
  //3) You will have to manually or programmatically set the custom metadata values when you
  // upload content.
  
  
  
  // Please customize the variables below:
  
  // This is the title of the podcast itself.
  $title = "Test Podcast";
  // This is a link to where the podcast can be found.
  $link = "https://www.someplace.com/php/brightcove_itunes.php";
  // This is the language you display for this podcast.
  $lang = "en-us";
  // This is the copyright information.
  $copyright = "℗ & © 2021 Updated iTunes Feed";
  // This is the subtitle of the podcast.
  $subtitle = "iTunes Test XML FEED via the Video Cloud Playback APIs";
  // This is the author's name.
  $author = "Some One";
  // The publication date of this iTunes Feed
  $pubDate = date("m-d-Y"); // OPTIONALLY USE THE "updated_at" VARIABLE FROM THE RETURNED JSON
  // This is the summary for the podcast.
  $summary = "This is a sample iTunes XML generated from Video Cloud.";
  // This is a description of this iTunes Feed.
  $description= "Description of the Video Cloud iTunes Test Feed";
  // This is the owner's name.
  $ownername = "Some One";
  // This is the owner's email address.
  $owneremail = "someone@somewhere.com";
  // This is the podcast thumbnail image url.
  $imageurl = "https://www.someplace.com/php/logo.jpg";
  // This is the podcast category.
  $category = "TV & Film";
  // This is a yes or no boolean if the podcast is explicit.
  $explicit = "no";
  
  //Brightcove Account ID
  $accountId = "123456789";
  // This is your Policy Key associated with your account. 
  $policyKey = "mMm1VoineewK4tkFbfDakfEwYInEMSa_fAJ7HxVMIN1ItBJHXEDYGMnPbJrkK0U";
  // The ID of the playlist you wish to publish.
  $playlistid = "987654321";
  
  // This is the baseURL of the API endpoint you would like to use
  $baseURL = "https://edge.api.brightcove.com/playback/v1/accounts/";
  
  
  
  
  // Please DO NOT alter the code below;
  print('«) ;
  écho "\ n » ;
  print('') ;
 écho "\ n » ;
 print ('') ;
 écho "\ n » ;
 print ('	'. $titre. ' ') ;
 écho "\ n » ;
 print ('	'. $link. '') ;
 écho "\ n » ;
 print ('	'. $lang. ' ') ;
 écho "\ n » ;
 print ('	'. $copyright. ' ') ;
 écho "\ n » ;
 print ('	'. $subtitle. ' ') ;
 écho "\ n » ;
 print ('	'. $auteur. ' ') ;
 écho "\ n » ;
 print ('	'. $PubDate. ' ') ;
 écho "\ n » ;
 print ('	 ') ;
 écho "\ n » ;
 print ('	 ') ;
 écho "\ n » ;
 print ('	') ;
 écho "\ n » ;
 print ('		'. $nom_propriétaire. ' ') ;
 écho "\ n » ;
 print ('		'. $owneremail. ' ') ;
 écho "\ n » ;
 print ('	 ') ;
 écho "\ n » ;
 print ('	 ') ;
 écho "\ n » ;
 print ('	 ') ;
 écho "\ n » ;
 print ('	'. $explicite. ' ') ;
 echo « \ n » ;
 echo « \ n » ;
  
  
 fonction FormatSeconds ($seconds)
 {
$seconds = ($secondes/1 000) ;
 $hours = 0 ;
 $millisecondes = str_replace (« 0. «, «, $secondes - étage ($secondes)) ;
  
 if ($secondes > 3600)
 {
$heures = étage ($secondes/3600) ;
}
 $secondes = $secondes % 3600 ;
  
  
 return str_pad ($hours, 2, '0', STR_PAD_LEFT). gmdate (':i:s', $secondes) ;
}
  
  
  
 $ch = curl_init () ;
 $timeout = 5 ;//mis à zéro pour qu'il n'y ait pas de délai d'attente 
curl_setopt ($ch), CURLOPT_URL, $baseUrl. $accountId. '/playlists/'. $playlistid) ;
 curl_setopt ($ch), CURLOPT_HTTPHEADER, array (('Autorization:BCOV-Policy '). $policyKey), ('Politique BCoV : '). $policyKey), ('Accept:application/JSON ; pk='. $policyKey))) ;
 curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1) ;
 curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout) ;
 $file_contents = curl_exec ($ch) ;
 curl_close ($ch) ;
  
 $returndata = json_decode ($file_contents) ;
  
 $each (returndata->vidéos (sous forme de $items)
 {
print (')	- ') ;
 écho "\ n » ;
 print ('		
') ;
 print_r ($items-> {"nom"}) ;
 print (' ') ;
 écho "\ n » ;
   
 print ('		') ;
 print_r ($items->champ_personnalisés-> {"itunesartist"}) ;
 print (' ') ;
 écho "\ n » ;
   
 print ('		') ;
 print_r ($items-> {"description"}) ;
 print (' ') ;
 écho "\ n » ;
  
 print ('		') ;
 print_r ($items-> {"description"}) ;
 print (' ') ;
 écho "\ n » ;
   
 print ('		') ;
 print_r ($items-> {"affiche"}) ;
 print (' ') ;
 echo "\ n » ;
   
 print (' 		<enclosure url="') ;
 $newurl = $items->sources [4] -> {"src"} ;
 print_r ($newurl) ;
 print ('» length="') ;
 print_r ($items-> {"duration"}) ;
 print (' » type="video/mp4" />') ; 
echo "\ n » ;
   
 print ('		') ;
 print_r ($items-> {"id"}) ;
 print (' ') ;
 écho "\ n » ;
   
 print ('		') ;
 print_r (date (DATE_RFC2822, ($items-> {"published_at"}))) ;
 print (' ') ;
 écho "\ n » ;
   
 print ('		') ;
 print ($duration = formatSeconds ($items-> {"duration"})) ;
 print (' ') ;
 écho "\ n » ;
  
 print ('		') ;
 print_r ($items->champ_personnalisés-> {"explicite"}) ;
 print (' ') ;
 écho "\ n » ;
  
   
 print ('	 ') ;
 écho "\ n » ;
}
  
 écho "\ n » ;
  
 print (' ') ;
 écho "\ n » ;
 print (' «) ;
  
  ? >
  Générateur de flux Roku
  // Sample Video Cloud Roku Direct Publisher feed
  
  // Please use this at your own risk.
  // This is just a sample to get you started. You can customize further as your requirements
  // grow.
  
  // The following is a list of requirements and conditions in order for this Roku Direct Publisher feed
  // to function properly;
  
  //1) You must have a Pro or Enterprise level Video Cloud Account.
  //2) You need to create the following custom fields. They are in your Account Settings: 
  // Video Fields page on the Video Cloud Studio Home page:
  //			1) roku_category
  //			2) 
  //
  //3) You will have to manually or programmatically set the custom metadata values when you
  // upload content.
  
  
  
  // Please customize the variables below:
  
  // This is the title of the Roku Feed itself.
  $title = "Brightcove Test Roku Direct Publisher Feed";
  // This is a link to where the podcast can be found.
  $link = "https://www.blacktreeproductions.com/brightcove_roku_direct_publisher.php5";
  // This is a description of this Roku Direct Publisher Feed.
  $description= "Description of the Video Cloud Roku Direct Publisher Test Feed";
  
  
  //Brightcove Account ID
  $accountId = "1234567890";
  // This is your Policy Key associated with your account. 
  $policyKey = "m1VoineewK4tkFbfDakfEwYInEMSa_fAJ7HxVMIN1ItBJHXEDYGMnPbJrkK0U";
  // The ID of the playlist you wish to publish.
  $playlistid = "987654321";
  
  // This is the baseURL of the API endpoint you would like to use
  $baseURL = "https://edge.api.brightcove.com/playback/v1/accounts/";
  
  
  
  
  // Please DO NOT alter the code below;
  header('Content-Type: text/xml');
  print('');
  echo"\n";
  print('');
  echo"\n";
  print('	'. $title .' ');
  echo"\n";
  print('	'. $link .'');
  echo"\n";
  print('	 ');
  echo"\n";
  
  $ch = curl_init();
  $timeout = 5; // set to zero for no timeout
  curl_setopt ($ch, CURLOPT_URL, $baseURL . $accountId . '/playlists/'. $playlistid);
  curl_setopt ($ch, CURLOPT_HTTPHEADER, array(('Authorization:BCOV-Policy '. $policyKey),('BCOV-Policy:'. $policyKey),('Accept:application/json;pk='. $policyKey)));
  curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
  $file_contents = curl_exec($ch);
  curl_close($ch);
  
  $returndata = json_decode($file_contents);
  
  foreach($returndata->videos as $items)
  {
  print('	- ');
  echo"\n";
  
  print('		
');
  print_r($items->{"id"});
  print(' ');
  echo"\n";
  
  print('		');
  print_r(date(DATE_RFC2822,($items->{"published_at"})));
  print(' ');
  echo"\n";
  
  print('		');
  print_r($items->{"name"});
  print(' ');
  echo"\n";
  
  print('		');
  print_r($items->{"description"});
  print(' ');
  echo"\n";
  
  print('		');
  print_r($items->custom_fields->{"roku_category"});
  print(' ');
  echo"\n";
  
  print('		 ');
  echo"\n";
  
  
  print('		 ');
  echo"\n";
  
  
  print('		 ');
  echo"\n";
  
  // print_r($items);  DUMP THE ENTIRE ARRAY FOR TESTING
   
  print('	 ');
  echo"\n";
  }
  
  echo"\n";
  
  print(' ');
  echo"\n";
  print(' ');
  
  ?>