You are here

function theme_video_cck_yahoomusic_flash in Embedded Media Field 5

The embedded flash displaying the yahoomusic video.

2 theme calls to theme_video_cck_yahoomusic_flash()
video_cck_yahoomusic_preview in contrib/video_cck/providers/yahoomusic.inc
hook video_cck_PROVIDER_video this actually displays the preview-sized video we want, commonly for the teaser
video_cck_yahoomusic_video in contrib/video_cck/providers/yahoomusic.inc
hook video_cck_PROVIDER_video this actually displays the full/normal-sized video we want, usually on the default page view

File

contrib/video_cck/providers/yahoomusic.inc, line 292
This include processes Yahoo Music API media files for use by emfield.module.

Code

function theme_video_cck_yahoomusic_flash($embed, $width, $height, $autoplay, $options = array()) {
  static $count;
  if ($embed) {
    $variables = array();
    $variables['id'] = 'v' . $embed;
    $variables['eID'] = _video_cck_yahoomusic_locale_lookup('eid');
    $variables['ympsc'] = _video_cck_yahoomusic_locale_lookup('ympsc');
    $variables['lang'] = _video_cck_yahoomusic_locale_lookup('lang');
    $fullscreen = variable_get('video_cck_yahoomusic_full_screen', 1);
    $fullscreen_value = $fullscreen ? "true" : "false";
    $variables['enableFullScreen'] = $fullscreen ? "1" : "0";
    $variables['autoStart'] = $autoplay ? '1' : '0';
    $variables['bw'] = variable_get('video_cck_yahoomusic_bandwidth', '');
    $variables['eh'] = variable_get('video_cck_yahoomusic_event_handler', '');
    $variables['closeEnable'] = variable_get('video_cck_yahoomusic_close_enable', 0);
    $variables['controlsEnable'] = variable_get('video_cck_yahoomusic_controls_enable', 1);
    $variables['infoEnable'] = variable_get('video_cck_yahoomusic_info_enable', 1);
    $variables['nowplayingEnable'] = variable_get('video_cck_yahoomusic_now_playing_enable', 1);
    $variables['postpanelEnable'] = variable_get('video_cck_yahoomusic_post_panel_enable', 1);
    $variables['prepanelEnable'] = variable_get('video_cck_yahoomusic_pre_panel_enable', 1);
    $variables['shareEnable'] = variable_get('video_cck_yahoomusic_share_enable', 1);
    $bgcolor = variable_get('video_cck_yahoomusic_bgcolor', EMVIDEO_YAHOOMUSIC_BGCOLOR_DEFAULT);
    foreach ($variables as $name => $value) {
      if ($value !== '') {

        // Add to flashvars string.
        if ($name == 'id') {
          $flash_vars = $name . '=' . $value;
        }
        else {
          $flash_vars .= '&' . $name . '=' . $value;
        }
      }
      else {

        // Remove from variables array
        unset($variables[$name]);
      }
    }
    $id = isset($options['id']) ? $options['id'] : 'video-cck-yahoomusic-flash-' . ++$count;
    $div_id = isset($options['div_id']) ? $options['div_id'] : 'video-cck-yahoomusic-flash-wrapper-' . $count;
    $url = "http://d.yimg.com/cosmos.bcst.yahoo.com/up/fop/embedflv/swf/fop.swf";
    if (variable_get('emfield_swfobject', FALSE) && (module_exists('swfobject_api') || variable_get('emfield_swfobject_location', ''))) {
      if (module_exists('swfobject_api')) {
        $params['width'] = $width;
        $params['height'] = $height;
        $params['div_id'] = $id;
        $params['allowFullScreen'] = $fullscreen_value;
        $params['bgcolor'] = $bgcolor;
        $output .= theme('swfobject_api', $url, $params, $variables, $id);
      }
      else {
        drupal_add_js(variable_get('emfield_swfobject_location', ''));
        $output .= <<<FLASH
          <div id="{<span class="php-variable">$div_id</span>}">
            Sorry, you need to install flash to see this content.
          </div>
          <script type="text/javascript">
            var so = new SWFObject('{<span class="php-variable">$url</span>}', '{<span class="php-variable">$id</span>}', '{<span class="php-variable">$width</span>}', '{<span class="php-variable">$height</span>}', '9', '#ffffff');

FLASH;
        foreach ($variables as $name => $value) {
          $output .= "so.addVariable({$name}, '{$value}');\n";
        }
        $output .= <<<FLASH
            so.addParam("allowFullScreen", "{<span class="php-variable">$fullscreen_value</span>}");
            so.addParam("bgcolor", "{<span class="php-variable">$bgcolor</span>}");
            so.addParam("allowScriptAccess", "always");  // for scripting access
            so.write("{<span class="php-variable">$div_id</span>}");
          </script>
FLASH;
      }
    }
    else {
      $output .= <<<FLASH
        <div id="{<span class="php-variable">$div_id</span>}">
        <object height="{<span class="php-variable">$height</span>}" width="{<span class="php-variable">$width</span>}" type="application/x-shockwave-flash" data="{<span class="php-variable">$url</span>}" id="{<span class="php-variable">$id</span>}" style="visibility: visible;">
          <param name="div_id" value="{<span class="php-variable">$div_id</span>}"/>
          <param name="allowFullScreen" value="{<span class="php-variable">$fullscreen_value</span>}"/>
          <param name="type" value="movie"/>
          <param name="flashvars" value="{<span class="php-variable">$flash_vars</span>}"/>
          <param name="bgcolor" value="{<span class="php-variable">$bgcolor</span>}"/>
        </object>
        </div>
FLASH;
    }
  }
  return $output;
}