You are here

function theme_emvideo_yahoomusic_flash in Embedded Media Field 6.3

Same name and namespace in other branches
  1. 6 contrib/emvideo/providers/yahoomusic.inc \theme_emvideo_yahoomusic_flash()

The embedded flash displaying the yahoomusic video.

2 theme calls to theme_emvideo_yahoomusic_flash()
emvideo_yahoomusic_preview in contrib/emvideo/providers/yahoomusic.inc
hook emvideo_PROVIDER_video this actually displays the preview-sized video we want, commonly for the teaser
emvideo_yahoomusic_video in contrib/emvideo/providers/yahoomusic.inc
hook emvideo_PROVIDER_video this actually displays the full/normal-sized video we want, usually on the default page view

File

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

Code

function theme_emvideo_yahoomusic_flash($embed, $width, $height, $autoplay, $options = array()) {
  static $count;
  if ($embed) {
    $variables = array();
    $variables['id'] = 'v' . $embed;
    $variables['eID'] = _emvideo_yahoomusic_locale_lookup('eid');
    $variables['ympsc'] = _emvideo_yahoomusic_locale_lookup('ympsc');
    $variables['lang'] = _emvideo_yahoomusic_locale_lookup('lang');
    $fullscreen = variable_get('emvideo_yahoomusic_full_screen', 1);
    $fullscreen_value = $fullscreen ? "true" : "false";
    $variables['enableFullScreen'] = $fullscreen ? "1" : "0";
    $variables['autoStart'] = $autoplay ? '1' : '0';
    $variables['bw'] = variable_get('emvideo_yahoomusic_bandwidth', '');
    $variables['eh'] = variable_get('emvideo_yahoomusic_event_handler', '');
    $variables['closeEnable'] = variable_get('emvideo_yahoomusic_close_enable', 0);
    $variables['controlsEnable'] = variable_get('emvideo_yahoomusic_controls_enable', 1);
    $variables['infoEnable'] = variable_get('emvideo_yahoomusic_info_enable', 1);
    $variables['nowplayingEnable'] = variable_get('emvideo_yahoomusic_now_playing_enable', 1);
    $variables['postpanelEnable'] = variable_get('emvideo_yahoomusic_post_panel_enable', 1);
    $variables['prepanelEnable'] = variable_get('emvideo_yahoomusic_pre_panel_enable', 1);
    $variables['shareEnable'] = variable_get('emvideo_yahoomusic_share_enable', 1);
    $bgcolor = variable_get('emvideo_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', ''));
        $flashvars = array();
        foreach ($variables as $name => $value) {
          $flashvars[] = "{$name}: '{$value}'";
        }
        $flashvars = implode(',', $flashvars);
        $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 params = { allowFullScreen: "{<span class="php-variable">$fullscreen_value</span>}", bgcolor: "{<span class="php-variable">$bgcolor</span>}", allowScriptAccess: "always" };
            var flashvars = { {<span class="php-variable">$flashvars</span>} };
            swfobject.embedSWF("{<span class="php-variable">$url</span>}", "{<span class="php-variable">$div_id</span>}", "{<span class="php-variable">$width</span>}", "{<span class="php-variable">$height</span>}", "9.0.0", false, flashvars, params);
          </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;
}