You are here

function theme_emvideo_flickr_sets_flvmediaplayer in Media: Flickr 6

Outputs a custom player, such as JW Flash Player, and pulls in the XML feed for the videos.

1 theme call to theme_emvideo_flickr_sets_flvmediaplayer()
theme_emvideo_flickr_sets_custom in providers/emvideo/flickr_sets.inc

File

providers/emvideo/flickr_sets.inc, line 211
This include processes flickr.com photosets for use by emfield/emvideo.module.

Code

function theme_emvideo_flickr_sets_flvmediaplayer($item, $width, $height, $autoplay, $options = array()) {
  global $base_path;
  $formatter = isset($options['formatter']) ? $options['formatter'] : 'video';
  $delay = isset($options['delay']) ? $options['delay'] : (isset($options['field']['widget']['media_flickr_delay_' . $formatter]) ? $options['field']['widget']['media_flickr_delay_' . $formatter] : variable_get('media_flickr_options_delay', 10));

  // Currently, for best performance, we need the
  // Media: Flickr -- XSPF Playlist module to continue.
  if (module_exists('media_flickr_xspf')) {
    $captions = isset($options['captions']) ? $options['captions'] : (isset($options['field']['widget']['media_flickr_captions_' . $formatter]) ? $options['field']['widget']['media_flickr_captions_' . $formatter] : variable_get('media_flickr_xspf_caption_type', MEDIA_FLICKR_XSPF_CAPTION_TYPE_TITLE));
    $flashvars['file'] = url('media/flickr/photoset/' . $item['value'] . '/xspf/' . $delay . '/' . $width . '/' . $height . '/' . $captions);
  }
  else {

    // Grab a playlist from Flickr for this. However, this has a limit of
    // 20 items in the feed, and has no duration.
    $flashvars['file'] = url('media/flickr/remote/' . $item['value']);
  }
  $params['width'] = $width;
  $params['height'] = $height;
  $params['allowfullscreen'] = isset($options['allowfullscreen']) ? $options['allowfullscreen'] : (isset($options['field']['widget']['media_flickr_allowfullscreen_' . $formatter]) ? $options['field']['widget']['media_flickr_allowfullscreen_' . $formatter] : variable_get('media_flickr_options_allowfullscreen', TRUE));
  $params['allowfullscreen'] = $options['allowfullscreen'] ? 'true' : 'false';
  $params['allowscriptaccess'] = isset($options['allowscriptaccess']) ? $options['allowscriptaccess'] : (isset($options['field']['widget']['media_flickr_allowscriptaccess_' . $formatter]) ? $options['field']['widget']['media_flickr_allowscriptaccess_' . $formatter] : variable_get('media_flickr_options_allowscriptaccess', 'always'));
  $flashvars['autostart'] = $autoplay ? 'true' : 'false';
  $flashvars['playlist'] = isset($options['playlist']) ? $options['playlist'] : (isset($options['field']['widget']['media_flickr_playlist_' . $formatter]) ? $options['field']['widget']['media_flickr_playlist_' . $formatter] : variable_get('media_flickr_options_playlist', 'right'));
  $flashvars['playlistsize'] = isset($options['playlistsize']) ? $options['playlistsize'] : (isset($options['field']['widget']['media_flickr_playlistsize_' . $formatter]) ? $options['field']['widget']['media_flickr_playlistsize_' . $formatter] : variable_get('media_flickr_options_playlistsize', 86));
  $flashvars['repeat'] = isset($options['repeat']) ? $options['repeat'] : (isset($options['field']['widget']['media_flickr_repeat_' . $formatter]) ? $options['field']['widget']['media_flickr_repeat_' . $formatter] : variable_get('media_flickr_options_repeat', 'list'));
  $flashvars['controlbar'] = isset($options['controlbar']) ? $options['controlbar'] : (isset($options['field']['widget']['media_flickr_controlbar_' . $formatter]) ? $options['field']['widget']['media_flickr_controlbar_' . $formatter] : variable_get('media_flickr_options_controlbar', 'none'));
  $logo = isset($options['logo']) ? $options['logo'] : (isset($options['field']['widget']['media_flickr_logo_' . $formatter]) ? $options['field']['widget']['media_flickr_logo_' . $formatter] : variable_get('media_flickr_options_logo', ''));
  if ($logo) {
    $flashvars['logo'] = url($logo);
  }
  if (function_exists('emfield_flvmediaplayer_url')) {
    $path = emfield_flvmediaplayer_url();
  }
  if (module_exists('flvmediaplayer')) {
    if (!$path) {
      $path = variable_get('flvmediaplayer_path', drupal_get_path('module', 'flvmediaplayer') . '/mediaplayer.swf');
    }
    return theme('flvmediaplayer_render_player', $base_path . $path, $params, $flashvars);
  }
  else {
    if ($path && module_exists('swfobject_api')) {
      return theme('swfobject_api', $base_path . $path, $params, $flashvars);
    }
  }

  // Fallback if things fail from here. @TODO: Just embed the sucker.
  return theme('emvideo_flickr_sets_flash', $item, $width, $height, $autoplay, $options);
}