or maybe and option to choose since it doesn't force you to use flash.

and some config for width and height can be great too. just simple things

CommentFileSizeAuthor
#2 googtube.zip1.96 KBbenlotter
#1 iframe-1331380-1.patch8.59 KBjeffam

Comments

jeffam’s picture

StatusFileSize
new8.59 KB

This is such a nice, simple module and it did just what I wanted, although I, too wanted the iframe embedding and some default filter settings for height and width. So here's a patch.

I know it's not generally a good idea to bundle multiple changes together, but I also updated some help text and removed the google video embedding, since Google has discontinued that service.

benlotter’s picture

StatusFileSize
new1.96 KB

Thanks for this module. I too found that the iframe was a better way to go. Attached are my revised googtube.module and new player.css file with the following modifications.

  1. Added link to player.css and class="youtube-video"
  2. Added support for the other 2 types of youtube links I found. YouTu.Be and /embed
  3. Changed to iframe for the 3 youtube links plus hard-coded a larger width and height to suite my Drupal theme

I hope you enjoy these enhancements and continue to build upon them.

Here's a quick preview of the changes I made in case you don't want to download the attachment. If you're going to implement the changes and you're new like me, then you'll want to grab the entire file inside the zip.
new function to add player.css

function googtube_init() {
    $path = drupal_get_path('module', 'googtube');
    drupal_add_css($path .'/player.css', 'module', 'all', FALSE);
}

new youtube link type

	  //IMPORTANT: this one must come first or multiple video links in the same post will fail
  	  //youtube embed regex
      $text = preg_replace_callback('#(((http://)?)|(^./))(((www.)?)|(^./))youtube\.com/embed/([^\[\]()<.,\s\n\t\r]+)(?![^<]*</a>)#i', 'googtube_youtube_embed', $text);

another new youtube link type

  	  //youtube shortened regex
      $text = preg_replace_callback('#(((http://)?)|(^./))(((www.)?)|(^./))youtu\.be/([^\[\]()<.,\s\n\t\r]+)(?![^<]*</a>)#i', 'googtube_youtube_short', $text);

my iframe replacement

  return '<iframe class="youtube-video" width="672" height="504"' .
		' src="http://www.youtube.com/embed/' . $youtube_id . '" frameborder="0" allowfullscreen></iframe>';

alexandreracine’s picture

Status: Active » Closed (fixed)

The version 7.x-2 is now online! Check it out! It has this feature.