Ok thanks for answering. Thanks for the idea. I include the first part of
the url and replace the code section with the argument passed to the view.
When I used the entire URL it did not work. The only problem I don't like
with this approach is that the user has to enter the code (which is
sometimes hard to extract for some users) in the form. Is there an easy way
for the user? To just copy the url or something like that.

Thanks again.


On Wed, Jun 6, 2012 at 10:48 PM, pbreit <pbreitenb...@gmail.com> wrote:

> 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<https://groups.google.com/forum/?fromgroups#%21topic/web2py/j8-EG58VbA4>
>>
>>
>> Thanks very much.
>>
>>


-- 
Kevin Miller
Acting Data Controller
Department of Computing
UWI, Mona
Kingston 7

Reply via email to