<?php

# Include the PHP Media API Wrapper
require 'bc-mapi.php';
# Instantiate the class, passing it our Brightcove API tokens
$bc = new BCMAPI('CO6uYEeNyUGE22AEvZkMKniQorK2vmR2bhYMNKXiKeHa_fqtcv640A..', '');
# Set up Constants
define("TIMESTART", mktime(00, 00, 01, 01, 01, 2012));
#Timestamp of Jan 01, 2012 00:00:01
# Set up variables
$tNow = time();
#Time stamp as of UNIX Epoch
$tPassed = $tNow - TIMESTART;
// Change this playlist if you want a different playlist to be simulated
// could also pass this in as a parameter in the AJAX request
$liveList = $bc->find('find_playlist_by_id', '2520498283001');
$totalDuration = 0;
$videoIDs = array();
// go through each video to find the total duration
foreach ($liveList->videos as $item => $video) {
    $totalDuration = $totalDuration + round($video->length / 1000);
    array_push($videoIDs, $video->id);
}
// find our location
$plsection = $tPassed % $totalDuration;
$totalDuration = 0;
$currentvideo;
$videoremainder;
foreach ($liveList->videos as $item => $video) {
    $totalDuration = $totalDuration + round($video->length / 1000);
    if ($totalDuration > $plsection) {
$fbautoplay = "true";
//enter the player id and player key you would like to publish on this page
$playid = 1463030068001.0;
$playkey = "AQ~~,AAAADXdqFgE~,aEKmio9UXaj62LQZfWSovLDmHDDA8rXn";
//set the page URL you want - you can use the curPageURL function to set to the current page.
$pageulr = curPageURL();
//default video to load
$vidid = 734462565001.0;
//check if video id field populated in query string.
if (isset($_GET['bctid'])) {
    $vidid = $_GET['bctid'];
}
$params = array('video_id' => $vidid, 'video_fields' => 'shortDescription,name,videoStillURL,id');
# Make our API call
try {
    $video = $bc->find('videoById', $params);
} catch (Exception $error) {
    echo $error;
}
// function to get the current page URL - used to set the share link of the player.
function curPageURL()
{
    $pageURL = 'http';
    if ($_SERVER["HTTPS"] == "on") {
        $pageURL .= "s";
    }
    $pageURL .= "://";
    if ($_SERVER["SERVER_PORT"] != "80") {
        $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
    } else {
        $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
Exemple #3
0
<?php

require_once '../../scripts/bc-mapi.php';
/* https://github.com/BrightcoveOS/PHP-MAPI-Wrapper
  On a production site use the cache extension */
$read_token = "4padFp2KtFo3R8px9Gy8ugjQ1Pedl6fqsdp71_6Z9b6YOmzse5_G5g..";
$playlist_id = "1492396528001";
$bc_api = new BCMAPI($read_token, '');
$params = array('video_fields' => 'id,name,shortDescription,videoStillURL', 'playlist_id' => $playlist_id);
try {
    $playlist = $bc_api->find('playlistbyid', $params);
} catch (Exception $error) {
    echo $error;
    die;
}
?>
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Playlist</title>
	<style type="text/css">
		.playlist-item {
			float: left;
			width: 400px;
			height:90px;
			background-color: #EEE;
			font-size: 80%;
			padding: 5px;
			margin: 2px;
		}
    $bc->__set('url_read', 'api.brightcove.co.jp/services/library?');
    $bc->__set('url_write', 'api.brightcove.co.jp/services/post');
    $bc_serviceDomain = "brightcove.co.jp";
} else {
    $bc_serviceDomain = "brightcove.com";
}
// Replace video id from url parameters if bctid is present.
if (isset($_GET['bctid'])) {
    $bc_videoID = $_GET['bctid'];
}
// Set up params
$bc->__set('media_delivery', 'http');
$bc_params = array('video_id' => $bc_videoID, 'video_fields' => 'name,shortDescription,videoStillURL,FLVURL');
// Make call
$bc_api_error = false;
$bc_video = $bc->find('videoById', $bc_params);
// Check if Facebook is doing the crawling
$bc_isFb = eregi("facebookexternalhit", $_SERVER['HTTP_USER_AGENT']) ? true : false;
// Get the page URL for Opengraph
$bc_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
?>
<!DOCTYPE html>
<html>
<head>
	<title>Title</title>
	<meta name="description" content="<?php 
echo htmlspecialchars($bc_video->shortDescription);
?>
" />

<?php