서문
다음은 Playback API를 비디오 정보 소스로 사용하여 iTunes 및 Ruku용 피드를 생성하는 두 개의 PHP 앱입니다.
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('');
에코"\n";
인쇄('');
echo"\n";
print('');
echo"\n";
print(' '.$제목. ' ');
echo"\n";
print(' '. $링크.'');
echo"\n";
print(' '.$랭. ' ');
echo"\n";
print(' '.$저작권. ' ');
echo"\n";
print(' '.$자막. ' ');
echo"\n";
print(' '.$작성자. ' ');
echo"\n";
print(' '.$게시일. ' ');
echo"\n";
print(' ');
echo"\n";
print(' ');
echo"\n";
print(' ');
echo"\n";
print(' '.$소유자 이름. ' ');
echo"\n";
print(' '. $소유자 이메일.' ');
echo"\n";
print(' ');
echo"\n";
print(' ');
echo"\n";
print(' ');
echo"\n";
print(' '.$명시적. ' ');
에코 "\ n”;
에코 "\ n”;
함수 형식초 ($초)
{
$초 = ($초/1000);
$시간 = 0;
$밀리초 = str_replace (“0.“, “, $seconds - 바닥 ($초));
if ($초 > 3600)
{
$시간 = 바닥 ($초/3600);
}
$초 = $초% 3600; str_pad
반환 ($시간, 2, '0', STR_PAD_LEFT). gmdate (':i:s', $seconds);
}
$ch = curl_init ();
$time_out = 5;//타임아웃이 없으면 0으로 설정
curl_setopt ($ch, Curlopt_URL, $baseURL).$계정 ID. '/플레이리스트/'.$playlistid);
curl_setopt ($ch, CURLOPT_HTTPHEADER, 배열 ('권한 부여:BCOV-Policy').$ 정책 키), ('BCov-정책: '.$정책 키), ('수락: 애플리케이션/JSON; pk='.$policyKey)));
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch,
CURL_CONNECT TIMEOUT, $timeout);
$file_contents ($timeout); $file_contets ($timeout);
$file_contents, $timeout); $file_contents ($timeout); $file_contents;
foreach ($데이터->비디오를 $items로 반환)
{
print (' - ');
echo"\n";
print('
');
print_r($items->{"name"});
print(' ');
echo"\n";
print(' ');
print_r($items->custom_fields->{"itunesartist"});
print(' ');
echo"\n";
print(' ');
print_r($items->{"description"});
print(' ');
echo"\n";
print(' ');
print_r($items->{"description"});
print(' ');
echo"\n";
print(' ');
print_r($items->{"poster"});
print(' ');
echo "\ n”;
인쇄 ( < '엔클로저 URL="');
$newurl = $items->소스 [4] -> {"src"};
print_r ($newurl);
인쇄 ('” 길이="');
print_r ($items-> {"기간"});
인쇄 ('” 유형="비디오/mp4" />');
에코 "\ n”;
인쇄 (' ');
print_r($items->{"id"});
print(' ');
echo"\n";
print(' ');
print_r (날짜 (DATE_RFC2822, ($items-> {"published_at"})));
인쇄 (' ');
echo"\n";
print(' ');
print($duration = formatSeconds($items->{"duration"}));
print(' ');
echo"\n";
print(' ');
print_r($items->custom_fields->{"explicit"});
print(' ');
echo"\n";
print(' ');
echo"\n";
}
echo"\n";
print(' ');
echo"\n";
print(' ');
?>
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(' ');
?>