/** * Override or insert variables into the node templates. */ function lullacog_preprocess_node(&$vars) { if ($vars['node']->type == 'media' && module_exists('swftools') && count($vars['field_media'])) { foreach ($vars['field_media'] as $file) { $vars['content'] .= swf($file['filepath']); } } }
* * You can then add additional data to the playlist array as you wish, picking up * other fields that have been fetched out of Views. For example, you can fetch * the node body and attach it on an element called 'description' and then that * can be used by TiltViewer to populate the reverse of the images. */ // Get the fields we are using $keys = array_keys($view->field); // Initialise a playlist ready for SWF Tools $files = array(); // Iterate over each row of the results - this is a clever bit of processing to match files with their thumbnails foreach ($rows as $key => $row) { // Reset the work array $work = array(); // Render each field in this row using the assigned handler foreach ($keys as $id) { $work[$id] = $view->field[$id]->theme($row); } // Add this item to the playlist swftools_views_add_playlist_element($files, $key, $options, $work); /** * If you want to add arbitrary data to the playlist then you can do so here * Add your additional elements to $files[$key]['myKey'] = myValue * Rendered fields are available in $work[$id] where $id is the field name. * * See swftools.views.theme.inc to see mappings available by default */ } // Call swf to output the result print swf($files, $swftools['options']);
<?php $r = array(); foreach ($rows as $row) { $r[] = array('fileurl' => $row['field_photo_fid_1']->content, 'filename' => $row['field_photo_fid_1']->content, 'description' => $row['title']->content); } print swf($r, array('flashvars' => array('width' => '900', 'height' => '600'), 'methods' => array('embed' => SWFTOOLS_NOJAVASCRIPT)));
?> </div> </div> <? endforeach; ?> </div> <div class="vertical-video-detail-items"> <? foreach ($rows as $row): ?> <div id="vertical-video-<?php echo $row['nid']; ?> " class="vertical-video-detail-item"> <div id="vertical-video-swf-<?php echo $row['nid']; ?> "><?php echo swf($row['video'], array('flashvars' => array('width' => '200', 'height' => '355'))); ?> </div> <h3><?php echo $row['title']; ?> </h3> <div class="vertical-video-item-body"><?php echo $row['body']; ?> </div> </div> <? endforeach; ?> </div> <script type="text/javascript"> $(function() {
?> <?php $videojs_sources .= "<source src=\"{$filepath}\" type='{$mimetype}; codecs=\"" . $codecs[$mimetype] . "\"' />"; ?> <?php } ?> <?php } ?> <?php print $videojs_sources; ?> <!-- Flash Fallback. Use any flash video player here. Make sure to keep the vjs-flash-fallback class. --> <?php if (module_exists('swftools')) { $options = array('params' => array('width' => variable_get('videojs_width', 640), 'height' => variable_get('videojs_height', 264)), 'othervars' => array('image' => $poster)); $themed_output = swf($flash, $options); } elseif (module_exists('flowplayer')) { // kjh: use a playlist to display the thumbnail if not auto playing if (!empty($poster)) { $options = array('playlist' => array($poster, array('url' => urlencode($flash), 'autoPlay' => FALSE, 'autoBuffering' => TRUE))); } else { $options = array('clip' => array('url' => urlencode($flash), 'autoPlay' => FALSE, 'autoBuffering' => TRUE)); } $themed_output = theme('flowplayer', $options, array('style' => 'width:' . variable_get('videojs_width', 640) . 'px;height:' . variable_get('videojs_height', 264) + 24 . 'px;')); } ?> </video> </div> <!-- End VideoJS -->
function flv($url) { $str = swf('flvplayer.swf?id=' . $url . ''); return $str; }