VP Factory
unread,Nov 4, 2010, 4:29:09 PM11/4/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to VP Factory API, vl...@vpfactory.com
This example will show you how to create a playlist outside your
player, together with thumbnails, video description and other video
information.
<?php
require_once('../misc/api/apivpf.class.php');
$api = new ApiVPF($key);
$xml_playlist = $api-
>getPlaylist('caf1a3dfb505ffed0d024130f58c5cfa');
$myPlaylist = simplexml_load_string($xml_playlist);
$playlist_title = $myPlaylist->name;
$playlist_videos = $myPlaylist->videos->video;
$videos = array();
foreach ($playlist_videos as $video) {
$xml_video = $api->getVideo($video);
$myVideo = simplexml_load_string($xml_video, NULL,
LIBXML_NOCDATA);
$myVideo->title = str_replace('<![CDATA[', '', (string)
$myVideo-
>title);
$myVideo->title = str_replace(']]>', '', (string)$myVideo-
>title);
array_push($videos, $myVideo);
}
$player_txtid = 'b337e84de8752b27eda3a12363109e80';
$first_video = '';
if (isset($videos[0]->mdid)) {
$first_video = $videos[0]->mdid;
}
?>
Notes:
To build the HTML playlist menu, we parse the $videos array for its
attributes.
To build the player, we embed it using the following code:
<script type="text/javascript">
var id = "<?php echo $player_txtid; ?>";
var serverURL = "<?php echo $api->serverURL(); ?>";
var firstVideo = "<?php echo $first_video; ?>";
var refVideo = swfobject.getQueryParamValue("referralVideo");
if (refVideo == '' && firstVideo != '') {
refVideo = firstVideo;
}
if (id != '') {
var flashvars = {
htmlPage: document.location,
referralVideo: refVideo,
settingsFile: "/publicfeed/?id=" + id
};
var params = {
allowFullScreen: "true",
allowScriptAccess: "always",
wmode: "transparent"
};
swfobject.embedSWF(serverURL + "/videoPlayer.swf", "vpf" + id,
"100%", "100%", "9.0.115", serverURL + "/swfobject/
expressInstall.swf", flashvars, params);
}
</script>