0

I'd like to know, how could I render links to video sites like youtube and vimeo as a video, the way Facebook does when a user simply pastes a link.

The other modules or solutions I've found involved embedding videos as a field requiring users to go through a process like the one from Embeded Media Field module does. The closest one is the Video Filter module, but it still more complicated that Facebook.

I'd like this feature over because I'm implementing this for a forum and I'd like to make it as simple and familiar (since everyone uses Facebook) as possible.

2 Answers 2

1

I guess the simplest solution would be a normal textfield with a youtube-specific formatter. A formatter is some code that takes the value of a certain field and uses it to generate a chunk of html, displaying the field on your page the way you want. The downside of this solution is that it will add a separate field to your form.

A quick search found two sandboxes with youtube field formatters:

Unfortunately I could't find an oficially released, stable module.

If you want complete control over your formatter, here's a tutorial how to create your own: Creating Custom Formatters with the Field API . In the comments, some commenters even say it helped them create a youtube field formatter.

[Update]

I just noticed the Googtube module, it seems to be exactly what you're looking for: like Video Filter module, but parsing regular YouTube URL's as embedded video's.

2
  • Thx the update... I was so interested in a Youtube filter that I whipped out my own text format filter module, that was complicated stuff... Didn't know googtube existed :(.
    – Marcel
    Commented May 12, 2014 at 22:52
  • 1
    Googtube does it! Thanks a million this is amazing :) I was searching for it for hours but I couldn't find it.
    – ashash
    Commented May 13, 2014 at 11:23
0

Regarding Youtube, I just used the iframe link that Youtube provided and defined my own size for the frame:

<div><iframe width="220" height="165" src="//www.youtube.com/embed/XgYu7-DQjDQ" frameborder="0" allowfullscreen></iframe></div>

This displayed as a video frame right there on the page, which could be viewed in the thumbnail size and in full screen view as well as on Youtube, since the frame contains the link.

Edit: see the example at http://www.crossroadpublishing.com/crossroad/title/call-to-serve The only thing is that my above code was sized for a front page thumbnail size space.

I hope this helps. Gábor

5
  • The question is about setting up a forum, and for security reasons you should not allow forum users to paste iframes in your site. Commented May 12, 2014 at 7:29
  • I see. Thank you for the clarification. However, many times I find that folks do ask the question about managed content pages and in that case this works. In fact, if the forum is moderated it may work. What do you think?
    – tanitani
    Commented May 12, 2014 at 7:36
  • OK, I understand. Still, I think the risk is too big. IMHO, moderating a forum is the best way to prevent a forum from becoming successful and waste your own time in the process. Commented May 12, 2014 at 7:43
  • Huh! Good find @marcvangend! There is also the drupal.org/project/video_filter maybe?
    – tanitani
    Commented May 12, 2014 at 7:45
  • Of course there is, it's even mentioned in the original question :-) Commented May 12, 2014 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.