Should be pretty easy. Once you capture the YouTube URL, just pass it to a 
view and then:

=== view.html ===
<iframe id="ytplayer" type="text/html" width="640" height="390"
  src="{{=video.url}}?autoplay=1&origin=http://example.com";
  frameborder="0"/>

=== controller.py ===
def play_video():
    video = db.video(request.args(0))
    return dict(video=video)

video.url would need to be something like 
"http://www.youtube.com/embed/u1zgFlCw8Aw";. You can store the whole URL or 
just the YouTube code ("u1zgFlCw8Aw").

From:
https://developers.google.com/youtube/player_parameters#Embedding_a_Player


On Wednesday, June 6, 2012 7:26:45 PM UTC-7, dundee wrote:
>
> I have been trying to figure out the best way to embed a youtube video in 
> web2py. I would like a form with an entry for the youtube video link/code 
> then at some point it will be displayed.
> I found this comment using the widget from plugin_wiki, but that did not 
> work for me:
>
> https://groups.google.com/forum/?fromgroups#!topic/web2py/j8-EG58VbA4
>
>
> Thanks very much.
>
>

Reply via email to