Server Side playlists are built on the server and are in the page before javascript or the player is invoked. This is best for cases where you need to optimize your playlists for search engine discoverability. A sample file getKalturaPlaylist.php is included that includes a single simple method for translating kaltura playlist api response into a ul list The on-page plugin handles binding all elements of your choosing.
- kWidget.embed({
- 'targetId': 'kaltura_player',
- 'wid': '_243342',
- 'uiconf_id' : '12905712',
- 'entry_id' : '0_l1v5vzh3',
- 'readyCallback': function( playerId ){
- var kdp = $( '#' + playerId ).get(0);
- $('li.kaltura-video').click(function(){
- var entryId = $(this).find('a').attr('data-entryid');
- kdp.sendNotification('changeMedia', {'entryId': entryId } );
- })
- }
- });
- <?php
- include_once dirname( __FILE__ ) . '/getKalturaPlaylist.php';
- $playlist = getKalturaPlaylist( '243342', '1_h92ak5el' );
- ?>
- <ul class="thumbnails">
- <?php
- foreach( $playlist['playlist'] as $key => $entry ){
- $entry = (array)$entry;
- ?>
- <li itemscope itemtype="http://schema.org/VideoObject"
- class="kaltura-video span2">
- <meta itemprop="duration" content="<?php echo $entry['duration'] ?>"
- <meta itemprop="thumbnailURL" content="<?php echo $entry['thumbnailUrl'] ?>">
- <a data-entryid="<?php echo $entry['id'] ?>" href="#" class="thumbnail" title="<?php echo $entry['name'] ?>">
- alt="<?php echo htmlspecialchars( $entry['name'] )?>"
- style="width: 160px; max-height: 120px;"
- src="<?php echo $entry['thumbnailUrl'] ?>/width/160">
- </a>
- <span itemprop="description"><?php echo htmlspecialchars( $entry['name'] )?></span>
- </li>
- <?php
- }
- ?>
- </ul>
html5 qunit | flash qunit
- <?php
- // Include the kaltura php api, you can get your copy here:
- // http://www.kaltura.com/api_v3/testme/client-libs.php
- require_once( dirname( __FILE__ ) . '/../../../modules/KalturaSupport/Client/kaltura_client_v3/KalturaClient.php');
- /**
- * Takes in a :
- * $wid, string, The widget id
- * $playlistId, string, The playlist_id
- */
- function getKalturaPlaylist( $partnerId, $playlistId ){
- $config = new KalturaConfiguration($partnerId);
- $config->serviceUrl = 'http://www.kaltura.com/';
- $client = new KalturaClient($config);
- $client->startMultiRequest();
- // the session:
- $kparams = array();
- $client->addParam( $kparams, 'widgetId', '_' . $partnerId );
- $client->queueServiceActionCall( 'session', 'startWidgetSession', $kparams );
- // The playlist meta:
- $kparams = array();
- $client->addParam( $kparams, 'ks', '{1:result:ks}' );
- $client->addParam( $kparams, 'id', $playlistId );
- $client->queueServiceActionCall( 'playlist', 'get', $kparams );
- // The playlist entries:
- $client->queueServiceActionCall( 'playlist', 'execute', $kparams );
- $rawResultObject = $client->doQueue();
- return array(
- 'meta' => (array)$rawResultObject[1],
- 'playlist' => (array)$rawResultObject[2]
- );
- }
- ?>