hello,
my problem is bout embedding youtube's video in my application. I found 
some workarounds, the first, works for a normal iframe, and uses the url.py 
to redirect the src tag to 
youtube:<http://stackoverflow.com/questions/11837169/django-converting-youtube-url-to-html-embed-code>

http://stackoverflow.com/questions/11837169/django-converting-youtube-url-to-html-embed-code

And the second is a manner to use iframe throu an ajax call:

<div id="player"></div>
<script>
    //Load player api asynchronously.
    var tag = document.createElement('script');
    tag.src = "//www.youtube.com/iframe_api";
    var firstScriptTag = document.getElementsByTagName('script')[0];
    firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
    var done = false;
    var player;
    function onYouTubeIframeAPIReady() {
        player = new YT.Player('player', {
          height: '150',
          width: '275',
          videoId: 'UzUO8TYsVRI',
          events: {
            'onReady': onPlayerReady,
            'onStateChange': onPlayerStateChange
          }
        });
    }
    function onPlayerReady(evt) {
        evt.target.playVideo();
    }
    function onPlayerStateChange(evt) {
        if (evt.data == YT.PlayerState.PLAYING && !done) {
            setTimeout(stopVideo, 6000);
            done = true;
        }
    }
    function stopVideo() {
        player.stopVideo();
    }
</script>

Well the second works without changing template tags and regular expression 
but it crushes without giving any clear error message.

Can anyone help about this?
Why does it crash?
Is there any easier workaround to face the problem?
Agnese

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/T_yGPd8pegMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to