You are here

function emvideo_ina_emvideo_emcode in Asset 7

Implements hook_emvideo_emcode().

File

modules/emvideo/modules/emvideo_ina/emvideo_ina.module, line 68
Emvideo ina module.

Code

function emvideo_ina_emvideo_emcode($params) {
  $output = FALSE;
  if (isset($params['provider']) && $params['provider'] == 'ina') {
    $width = $params['width'];
    $height = $params['height'];
    $source = $params['source'];
    if (strpos($source, 'http://player.ina.fr/player/embed/') === 0) {

      // IFrame URL contain sized, so we need to substitute them.
      $source = explode('/', $source);
      $tmp_id_1 = array_pop($source);
      $tmp_id_2 = array_pop($source);

      // Skip old width and height.
      array_pop($source);
      array_pop($source);
      $source[] = $width;
      $source[] = $height;
      $source[] = $tmp_id_2;
      $source[] = $tmp_id_1;
      $source = implode('/', $source);
      $attrs = array(
        'width' => $width,
        'height' => $height,
        'frameborder' => '0',
        'marginheight' => '0',
        'marginwidth' => '0',
        'scrolling' => 'no',
        'src' => $source,
      );
      $output = '<iframe' . drupal_attributes($attrs) . '></iframe>';
    }
    elseif (strpos($source, 'http://player.ina.fr/player/ticket/') === 0) {
      $output = "<object width='{$width}' height='{$height}' >\n        <param name='movie' value='{$source}' />\n        <param name='allowScriptAccess' value='always' />\n        <param name='allowFullScreen' value='true' />\n        <param name='bgcolor' value='#000000' />\n        <embed src='{$source}' width='{$width}' height='{$height}' allowScriptAccess='always' allowFullScreen='true' type='application/x-shockwave-flash'>\n        </embed>\n      </object>";
    }
    else {
      $embed = explode('/', $source);
      $id_notice = $embed[1];
      $id_user = $embed[3];
      $hashcode = $embed[5];
      $output = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
        id="Visionneuse" width="' . $width . '" height="' . $height . '"
        codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
        <param name="movie" value="http://www.ina.fr/video/ticket/' . $id_notice . '/' . $id_user . '/' . $hashcode . '" />
        <param name="pluginspage" value="http://www.macromedia.com/go/getflashplayer">
        <param name="align" value="middle">
        <param name="quality" value="high" />
        <param name="scale" value="showall">
        <param name="wmode" value="transparent">
        <param name="menu" value="true">
        <param name="devicefont" value="false">
        <param name="bgcolor" value="#FFFFFF" />
        <param name="allowScriptAccess" value="always" />
        <param name="allowFullScreen" value="true" />
        <param name="flashvars" value="config=http://www.ina.fr/player/configurationEmbed&amp;type_media=video">
        <embed src="http://www.ina.fr/video/ticket/' . $id_notice . '/' . $id_user . '/' . $hashcode . '" quality="high" bgcolor="#FFFFFF"
            width="' . $width . '" height="' . $height . '" name="Viewer" align="middle"
            quality="high"
            wmode="transparent"
            allowScriptAccess="always"
            allowFullScreen="true"
            type="application/x-shockwave-flash"
            pluginspage="http://www.adobe.com/go/getflashplayer"
            flashvars="config=http://www.ina.fr/player/configurationEmbed&amp;type_media=video">
        </embed>
      </object>';
    }
  }
  return $output;
}