It is - should be fixed now.

Mamye Kratt wrote:
http://www.openlaszlo.org/jira/browse/LPP-5424
YouTube demo is broken, clicking on picture does not load video
is the YouTube bug.

    ----- Original Message -----
    *From:* Amy Muntz <mailto:[EMAIL PROTECTED]>
    *To:* Lou Iorio <mailto:[EMAIL PROTECTED]> ; Amy
    <mailto:[EMAIL PROTECTED]>
    *Cc:* OpenLaszlo development list <mailto:[email protected]>
    *Sent:* Thursday, February 14, 2008 11:03 AM
    *Subject:* Re: [Laszlo-dev] Freya migration proposal for r8021 -
    openlaszlo/trunk/demos/youtube

    Yes, it does go in the release notes.
    There is an open bug number for this LPP-5242 that Max will resolve
    against Freya, as well as trunk.

    Thanks,
    Amy


    On Thu, Feb 14, 2008 at 10:55 AM, Lou Iorio wrote:

    Does this go in the 4.0.10 release notes?

    Lou

    On Feb 14, 2008, at 11:41 AM, Amy Muntz wrote:

    Agreed. Please check it in to freya/pagan as well.
    Thanks,
    Amy


    On Wed, Feb 13, 2008 at 9:15 PM, Max Carlson < [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>> wrote:
    I suggest merging this to freya/pagan.
-- Regards,
    Max Carlson
    OpenLaszlo.org

    Author: max
    Date: 2008-02-13 17:33:32 -0800 (Wed, 13 Feb 2008)
    New Revision: 8021

    Modified:
      openlaszlo/trunk/demos/youtube/youtube.jsp
      openlaszlo/trunk/demos/youtube/youtube.lzx
    Log:
    Change 20080213-maxcarlson-o by [EMAIL PROTECTED] on 2008-02-13
    15:13:18 PST
       in /Users/maxcarlson/openlaszlo/trunk
       for _http://svn.openlaszlo.org/openlaszlo/trunk_

    Summary: Fix youtube video loading, for real this time!

    New Features:

    Bugs Fixed: LPP-5424 - YouTube demo is broken, clicking on picture
    does not load video

    Technical Reviewer: promanik
    QA Reviewer: mkratt
    Doc Reviewer: (pending)

    Documentation:

    Release Notes:

    Details: youtube.jsp - Parse out Location header from different URL
    - totally bulletproof now.

    youtube.lzx - Proxied loads are no longer supported/required!


    Tests: Any video will play in youtube.lzx now.



    Modified: openlaszlo/trunk/demos/youtube/youtube.jsp
    ===================================================================
    --- openlaszlo/trunk/demos/youtube/youtube.jsp  2008-02-14 00:40:55
    UTC (rev 8020)
    +++ openlaszlo/trunk/demos/youtube/youtube.jsp  2008-02-14 01:33:32
    UTC (rev 8021)
    @@ -11,7 +11,7 @@
     <%!

     /* X_LZ_COPYRIGHT_BEGIN
    ****************************************************
    - * Copyright 2007 Laszlo Systems, Inc.  All Rights
    Reserved.               *
    + * Copyright 2007, 2008 Laszlo Systems, Inc.  All Rights
    Reserved.         *
     * Use is subject to license
    terms.                                        *
     * X_LZ_COPYRIGHT_END
    ******************************************************/

    @@ -199,18 +199,22 @@
            Document result)
        {
            String pageUrl =
    -            " _http://www.YouTube.com/watch?v=_
    <http://www.youtube.com/watch?v=>";
    -        pageUrl += id;
    +            " _http://www.youtube.com/v/_"; + id;

    -        BufferedReader inputFile = null;
    +        // Based on
    _http://www.jeroenwijering.com/?thread=5484#msg50818_
    +        // Get Location header and parse strings from that...
    +        String redirURL = null;
            try {
                URL u = new URL(pageUrl);
    -            inputFile =
    -                new BufferedReader(
    -                    new InputStreamReader(
    -                        u.openStream()));
    +            HttpURLConnection redir =
    (java.net.HttpURLConnection)u.openConnection();
    +            redir.setFollowRedirects(false);
    +            redir.connect();
    +            redirURL = redir.getHeaderField("Location");
    +            if (redirURL == null) {
    +                throw new Exception("No Location header found");
    +            }
            } catch (Exception e) {
    -            reportError("Could not load url.", result);
    +            reportError("Could not load url " + redirURL + ": " +
    e.toString(), result);
                return;
            } // try

    @@ -219,57 +223,34 @@

            String videoId = "";
            String tId = "";
    -        while (true) {
    -            String line = null;

    -            try {
    -                line = inputFile.readLine();
    -            } catch (IOException e) {
    -                line = null;
    -            }
    -
    -            if (line == null) {
    -                break;
    -            }
    -
    -            int start =
    -                line.indexOf("swfArgs");
    -            if (start == -1) {
    -                continue;
    -            } else {
    -                // Extract the video_id from the args line
    -                Pattern vidpat =
    Pattern.compile("video_id:'[\\w\\d]+'?");
    -                Pattern tpat = Pattern.compile("t:'[\\w\\d]+'?");
    -                Matcher vidmatcher = vidpat.matcher(line);
    -                Matcher tmatcher = tpat.matcher(line);
    -                if ( vidmatcher.find() ) {
    -                    videoId = (line.substring(vidmatcher.start(),
    vidmatcher.end()));
    -                    videoId = videoId.substring(10,
    videoId.length()-1);
    -                } else {
    -                    reportError("video_id argument not found in
    HTML page", result);
    -                    return;
    -                }
    -                if ( tmatcher.find() ) {
    -                    tId = (line.substring(tmatcher.start(),
    tmatcher.end()));
    -                    tId = tId.substring(3, tId.length()-1);
    -                } else {
    -                    reportError("t argument not found in HTML
    page", result);
    -                    return;
    -                }
    -            }
    -
    -            String url =
    -                " _http://www.youtube.com/get_video?video_id=_"; +
    videoId + "&t=" + tId;
    -
    -            resultEl.setAttribute("id", videoId);
    -            resultEl.setAttribute("t", tId);
    -            resultEl.setAttribute("url", url);
    -            result.setRootElement(resultEl);
    -
    +        // Extract the video_id and t fields from
    +        Pattern vidpat = Pattern.compile("video_id=[\\w\\d]+'?");
    +        Pattern tpat = Pattern.compile("t=[\\w\\d\\-]+'?");
    +        Matcher vidmatcher = vidpat.matcher(redirURL);
    +        Matcher tmatcher = tpat.matcher(redirURL);
    +        if ( vidmatcher.find() ) {
    +            videoId = (redirURL.substring(vidmatcher.start(),
    vidmatcher.end()));
    +            videoId = videoId.substring(9, videoId.length());
    +        } else {
    +            reportError("video_id argument not found in HTML page",
    result);
                return;
            }
    +        if ( tmatcher.find() ) {
    +            tId = (redirURL.substring(tmatcher.start(),
    tmatcher.end()));
    +            tId = tId.substring(2, tId.length());
    +        } else {
    +            reportError("t argument not found in URL", result);
    +            return;
    +        }

    -        reportError("Could not find SWFObject at url " + pageUrl,
    result);
    +        String url =
    +            " _http://www.youtube.com/get_video?video_id=_"; +
    videoId + "&t=" + tId;
    +
    +        resultEl.setAttribute("id", videoId);
    +        resultEl.setAttribute("t", tId);
    +        resultEl.setAttribute("url", url);
    +        result.setRootElement(resultEl);
        }



    Modified: openlaszlo/trunk/demos/youtube/youtube.lzx
    ===================================================================
    --- openlaszlo/trunk/demos/youtube/youtube.lzx  2008-02-14 00:40:55
    UTC (rev 8020)
    +++ openlaszlo/trunk/demos/youtube/youtube.lzx  2008-02-14 01:33:32
    UTC (rev 8021)
    @@ -1,5 +1,5 @@
     <!-- X_LZ_COPYRIGHT_BEGIN
    ************************************************
    -* Copyright 2007 Laszlo Systems, Inc.  All Rights
    Reserved.              *
    +* Copyright 2007, 2008 Laszlo Systems, Inc.  All Rights
    Reserved.        *
     * Use is subject to license
    terms.                                       *
     * X_LZ_COPYRIGHT_END
    ************************************************** -->

    @@ -7,7 +7,6 @@
     <canvas
      width="100%"
      height="100%"
    -  proxied="true"
     >

        <include href="av/videoutils.lzx"/>


    _______________________________________________
    Laszlo-checkins mailing list
    [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
    _http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins_

    <http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins>



--
Regards,
Max Carlson
OpenLaszlo.org

Reply via email to