I can embed, at foreign sites, content stored at my site, but I would like to find the way of generating the embedding code automatically, and be able to display it for the user to be able to copy it and paste it at destination site, in the same way that yau can do it at youtube for instance:

This is the code I use to embed videos

<object width="667" height="375" type="application/x-shockwave-flash" data="http://www.exemple.com/sites/all/modules/fileframework/vendor/flowplayer/flowplayer-3.2.8.swf">
<param name="allowfullscreen" value="true">
<param name="allowscriptaccess" value="always">
<param name="quality" value="high">
<param name="bgcolor" value="#000000">
<param name="flashvars" value="config={&quot;playlist&quot;:[{&quot;url&quot;:&quot;http://www.exemple.com/bitcache/8fec79b89f4846e1a27073312aa08cac60e6fdca?vid=12&quot;,&quot;autoPlay&quot;:true,&quot;autoBuffering&quot;:true}],&quot;playerId&quot;:&quot;file-player-11-13969294&quot;,&quot;clip&quot;:{}}">
</object>

This is the code I use to embed not video files

<!--[if !IE]> <--><object type="application/x-shockwave-flash" data="http://www.exemple.com/bitcache/0a0474f3a25b4247e0352ea03565736416ff6550?vid=16" height="540" width="720"><!----> <!--[endif]---->
<!--[if IE]><object type="application/x-shockwave-flash" width="720" height="540" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><![endif]-->
<param name="movie" value="http://www.exemple.com/bitcache/0a0474f3a25b4247e0352ea03565736416ff6550?vid=16"></object>	

This is the code i use to embed audio files:

<object data="http://exemple.com/sites/all/modules/fileframework/vendor/xspf_player/xspf_player_slim.swf?playlist_url=http:%2F%2Fexemple.com%2Fca%2Ffile_audio%2Fxspf%2Fab4f98a17053b59c29c89cf0c7f0583ed4097b80%2F23%2F23&amp;player_title=Gustavo%20Cerati%20-%20Coraz%C3%B3n%20Delator" height="15" type="application/x-shockwave-flash" width="400"><param name="movie" value="http://exemple.com/sites/all/modules/fileframework/vendor/xspf_player/xspf_player_slim.swf?playlist_url=http:%2F%2Fexemple.com%2Fca%2Ffile_audio%2Fxspf%2Fab4f98a17053b59c29c89cf0c7f0583ed4097b80%2F23%2F23&amp;player_title=Gustavo%20Cerati%20-%20Coraz%C3%B3n%20Delator" /></object></p>

In two first cases the information that changes is the bitcache string of the file followed by the node id:

  1. 8fec79b89f4846e1a27073312aa08cac60e6fdca?vid=12
  2. 3fa86e941cd86cadaefb52b35e55d956bf7d64b4?vid=19

In the case of the audio file, it is only needed the bitcache string

  1. ab4f98a17053b59c29c89cf0c7f0583ed4097b80

Any idea?

Thanks for helping

Comments

andrés chandía’s picture

By the way, you can see the site in action at: http://parles.upf.edu/llocs/ceru

andrés chandía’s picture

Issue summary: View changes

some minor changes and addition of some code

johanneshahn’s picture

hi,
i think u have to create a custom embed code like utube too.

u tube code looks like this
<iframe width="560" height="315" src="http://www.youtube.com/embed/Zs2O7PlhoYA" frameborder="0" allowfullscreen></iframe>

now u only have to create a custom page on your website which only returns the video. may a custom page.
the url have to be the url to the video nid something like this

http://parles.upf.edu/llocs/ceru/mycustomvideopage/667

if u call directly the url from the utube embed code "http://www.youtube.com/embed/Zs2O7PlhoYA" u can watch the video.
(look at html source code, its only the video code)

andrés chandía’s picture

Hi johanneshahn

I'm coming back to this work, I had to install organic group module because of the requirements of our institution.
About the embedding, I understand the idea, but do you have any tip on how should the custom page be, I mean
do I create a new content type? which fields should I include? should I insert some php code?, how do I link the file uploaded (video, presentation, sound) to the custom embedding page, etc.

Thanks for the advice.

andrés chandía’s picture

Issue summary: View changes

corrections

andrés chandía’s picture

HI there,
I have arrived to a solution that I want to share, just for you to take it or improve it.
The solution implies the creation of a view and a page with php as input format. At the view I used rewrite to send the variables to the php page that will return the embedding code, I have named this page "embedding-code-generator".
This is how it looks the view block:
Only local images are allowed.

And this is how the generated code (the php page) looks like:
Only local images are allowed.

Here you have the view code (replace the www.exemple.com with your own site url before importing the view to your system):

$view = new view;
$view->name = 'embeding_code';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Web Widget Node';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Embedding code generator';
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'some';
$handler->display->display_options['pager']['options']['items_per_page'] = '1';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Field: Files: View link */
$handler->display->display_options['fields']['view']['id'] = 'view';
$handler->display->display_options['fields']['view']['table'] = 'file_nodes';
$handler->display->display_options['fields']['view']['field'] = 'view';
$handler->display->display_options['fields']['view']['label'] = 'Copy this code';
$handler->display->display_options['fields']['view']['alter']['alter_text'] = 1;
$handler->display->display_options['fields']['view']['alter']['text'] = '<iframe src="[view]"></iframe>fsdf';
$handler->display->display_options['fields']['view']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['view']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['view']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['view']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['view']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['view']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['view']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['view']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['view']['alter']['trim'] = 0;
$handler->display->display_options['fields']['view']['alter']['html'] = 0;
$handler->display->display_options['fields']['view']['element_type'] = '0';
$handler->display->display_options['fields']['view']['element_label_colon'] = 1;
$handler->display->display_options['fields']['view']['element_wrapper_type'] = '0';
$handler->display->display_options['fields']['view']['element_default_classes'] = 0;
$handler->display->display_options['fields']['view']['hide_empty'] = 0;
$handler->display->display_options['fields']['view']['empty_zero'] = 0;
$handler->display->display_options['fields']['view']['hide_alter_empty'] = 1;
/* Sort criterion: Node: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Argument: Node: Nid */
$handler->display->display_options['arguments']['nid']['id'] = 'nid';
$handler->display->display_options['arguments']['nid']['table'] = 'node';
$handler->display->display_options['arguments']['nid']['field'] = 'nid';
$handler->display->display_options['arguments']['nid']['default_action'] = 'default';
$handler->display->display_options['arguments']['nid']['style_plugin'] = 'default_summary';
$handler->display->display_options['arguments']['nid']['default_argument_type'] = 'node';
/* Filter: Node: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;

/* Display: Block */
$handler = $view->new_display('block', 'Block', 'block');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['title'] = 'Embedding code generator';
$handler->display->display_options['defaults']['fields'] = FALSE;
/* Field: Files: URI */
$handler->display->display_options['fields']['uri']['id'] = 'uri';
$handler->display->display_options['fields']['uri']['table'] = 'file_nodes';
$handler->display->display_options['fields']['uri']['field'] = 'uri';
$handler->display->display_options['fields']['uri']['label'] = 'Click on the appropriate format to generate embedding code';
$handler->display->display_options['fields']['uri']['alter']['alter_text'] = 1;
$handler->display->display_options['fields']['uri']['alter']['text'] = '<ul><li>Video<br><a href="embedding-code-generator?URI=[uri]&NID=!1&FILETYPE=Video&WIDTH=320&HEIGHT=264">320x264</a>|<a href="embedding-code-generator?URI=[uri]&NID=!1&FILETYPE=Video&WIDTH=480&HEIGHT=360">480x360</a>|<a href="embedding-code-generator?URI=[uri]&NID=!1&FILETYPE=Video&WIDTH=640&HEIGHT=480">640x480</a></li>
<li>Audio<br><a href="embedding-code-generator?URI=[uri]&NID=!1&FILETYPE=Audio&WIDTH=200&HEIGHT=35">200x35</a>|<a href="embedding-code-generator?URI=[uri]&NID=!1&FILETYPE=Audio&WIDTH=400&HEIGHT=35">400x35</a>|<a href="embedding-code-generator?URI=[uri]&NID=!1&FILETYPE=Audio&WIDTH=600&HEIGHT=35">600x35</a></li>
<li>Pdf<br><a href="embedding-code-generator?URI=[uri]&NID=!1&FILETYPE=Pdf&WIDTH=320&HEIGHT=414">320x414</a>|<a href="embedding-code-generator?URI=[uri]&NID=!1&FILETYPE=Pdf&WIDTH=480&HEIGHT=621">480x621</a>|<a href="embedding-code-generator?URI=[uri]&NID=!1&FILETYPE=video&WIDTH=640&HEIGHT=828">640x828</a></li>
</ul>';
$handler->display->display_options['fields']['uri']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['uri']['alter']['path'] = 'http://www.exemple.com/';
$handler->display->display_options['fields']['uri']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['uri']['alter']['external'] = 1;
$handler->display->display_options['fields']['uri']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['uri']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['uri']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['uri']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['uri']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['uri']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['uri']['alter']['trim'] = 0;
$handler->display->display_options['fields']['uri']['alter']['html'] = 0;
$handler->display->display_options['fields']['uri']['element_label_colon'] = 1;
$handler->display->display_options['fields']['uri']['element_default_classes'] = 1;
$handler->display->display_options['fields']['uri']['hide_empty'] = 0;
$handler->display->display_options['fields']['uri']['empty_zero'] = 0;
$handler->display->display_options['fields']['uri']['hide_alter_empty'] = 0;
$handler->display->display_options['defaults']['filters'] = FALSE;
/* Filter: Node: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter: Node: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'file' => 'file',
);
$translatables['embeding_code'] = array(
  t('Master'),
  t('Embedding code generator'),
  t('more'),
  t('Apply'),
  t('Reset'),
  t('Sort by'),
  t('Asc'),
  t('Desc'),
  t('Copy this code'),
  t('<iframe src="[view]"></iframe>fsdf'),
  t('All'),
  t('Block'),
  t('Click on the appropriate format to generate embedding code'),
  t('<ul><li>Video<br><a href="embedding-code-generator?URI=[uri]&NID=!1&FILETYPE=Video&WIDTH=320&HEIGHT=264">320x264</a>|<a href="embedding-code-generator?URI=[uri]&NID=!1&FILETYPE=Video&WIDTH=480&HEIGHT=360">480x360</a>|<a href="embedding-code-generator?URI=[uri]&NID=!1&FILETYPE=Video&WIDTH=640&HEIGHT=480">640x480</a></li>
<li>Audio<br><a href="embedding-code-generator?URI=[uri]&NID=!1&FILETYPE=Audio&WIDTH=200&HEIGHT=35">200x35</a>|<a href="embedding-code-generator?URI=[uri]&NID=!1&FILETYPE=Audio&WIDTH=400&HEIGHT=35">400x35</a>|<a href="embedding-code-generator?URI=[uri]&NID=!1&FILETYPE=Audio&WIDTH=600&HEIGHT=35">600x35</a></li>
<li>Pdf<br><a href="embedding-code-generator?URI=[uri]&NID=!1&FILETYPE=Pdf&WIDTH=320&HEIGHT=414">320x414</a>|<a href="embedding-code-generator?URI=[uri]&NID=!1&FILETYPE=Pdf&WIDTH=480&HEIGHT=621">480x621</a>|<a href="embedding-code-generator?URI=[uri]&NID=!1&FILETYPE=video&WIDTH=640&HEIGHT=828">640x828</a></li>
</ul>'),
  t('http://www.exemple.com/'),
);

And here you have the "embedding-code-generator" php page content (replace the www.exemple.com with your own site url before pasting the code to your system)::

<?php
$FILETYPE = $_GET['FILETYPE'];
$WIDTH = $_GET['WIDTH'];
$HEIGHT = $_GET['HEIGHT'];
$SITEURL = "http://www.exemple.com/";
$URI = $_GET['URI'];
$NID = $_GET['NID'];
$TRAD = array("bitcache://" => "bitcache/");
$URITRAD = strtr("$URI",$TRAD);
echo "<p>$FILETYPE properties<ul><li>width: $WIDTH px</li><li>height: $HEIGHT px</li><ul></p><p>&nbsp;</p>";
echo '<p><div class="site-slogan">Copy the content from inside the textbox and paste it at the destination page.</div></p>';
echo '<textarea cols="60" rows="10">';
echo '<iframe width="';
echo "$WIDTH";
echo '" height="';
echo "$HEIGHT";
echo '" src="';
echo "$SITEURL$URITRAD?vid=$NID";
echo '&disposition=inline&op=view" frameborder="0" allowfullscreen></iframe></textarea>';
echo '<p></p><p><a href="#" onclick="history.go(-1)">&#60;&#60; Go back to the file view</a></p>';
?>
gobinathm’s picture

Status: Active » Closed (outdated)

Closing the issue. It was inactive for a long time & it's related to a Drupal Version which is not supported anymore