Author: max
Date: 2007-11-13 14:29:20 -0800 (Tue, 13 Nov 2007)
New Revision: 7237
Modified:
openlaszlo/trunk/demos/youtube/youtube.jsp
openlaszlo/trunk/demos/youtube/youtube.lzx
Log:
Change 20071113-maxcarlson-3 by [EMAIL PROTECTED] on 2007-11-13 13:54:12 PST
in /Users/maxcarlson/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Fix the youtube player
New Features:
Bugs Fixed: LPP-5070 - Videos not playing in YouTube demo
Technical Reviewer: jcrowley
QA Reviewer: promanik
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details: youtube.jsp - Add support for passing the 't' parameter though to
get_video.
youtube.lzx - Use proxied mode - the server helps with http redirect calls that
sometimes get returned from get_video.
Tests: youtube.lzx mostly works now.
Modified: openlaszlo/trunk/demos/youtube/youtube.jsp
===================================================================
--- openlaszlo/trunk/demos/youtube/youtube.jsp 2007-11-13 21:56:22 UTC (rev
7236)
+++ openlaszlo/trunk/demos/youtube/youtube.jsp 2007-11-13 22:29:20 UTC (rev
7237)
@@ -10,10 +10,10 @@
<%@ page import="org.jdom.xpath.*" %>
<%!
- /* X_LZ_COPYRIGHT_BEGIN
****************************************************
- * Copyright 2007 Laszlo Systems, Inc. All Rights Reserved.
*
- * Use is subject to license terms.
*
- * X_LZ_COPYRIGHT_END
******************************************************/
+/* X_LZ_COPYRIGHT_BEGIN ****************************************************
+ * Copyright 2007 Laszlo Systems, Inc. All Rights Reserved. *
+ * Use is subject to license terms. *
+ * X_LZ_COPYRIGHT_END ******************************************************/
public String devId =
@@ -217,7 +217,8 @@
Element resultEl =
new Element("videoGetFlvUrlResult");
- String videoId = "";
+ String videoId = "";
+ String tId = "";
while (true) {
String line = null;
@@ -236,22 +237,32 @@
if (start == -1) {
continue;
} else {
- // Extract the video_id from the args line
- Pattern p =
Pattern.compile("video_id:'[\\w\\d]+'?");
- Matcher m = p.matcher(line);
- if ( m.find() ) {
- videoId = (line.substring(m.start(),
m.end()));
- videoId = videoId.substring(10,
videoId.length()-1);
- } else {
- reportError("video_id argument not
found in HTML page", result);
- return;
- }
+ // 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://cache.googlevideo.com/get_video?video_id=" + videoId;
-
+ "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 2007-11-13 21:56:22 UTC (rev
7236)
+++ openlaszlo/trunk/demos/youtube/youtube.lzx 2007-11-13 22:29:20 UTC (rev
7237)
@@ -7,9 +7,8 @@
<canvas
width="100%"
height="100%"
- proxied="false"
+ proxied="true"
>
-
<include href="av/videoutils.lzx"/>
<include href="av/videotogglebutton.lzx"/>
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins