[Yanel-commits] rev 28895 - in public/yanel/contributions/resources/flow-player: . src/java/com/wyonapictures/yanel/impl/resources/flv

simon at wyona.com simon at wyona.com
Wed Nov 14 23:13:52 CET 2007


Author: simon
Date: 2007-11-14 23:13:51 +0100 (Wed, 14 Nov 2007)
New Revision: 28895

Modified:
   public/yanel/contributions/resources/flow-player/resource.xml
   public/yanel/contributions/resources/flow-player/src/java/com/wyonapictures/yanel/impl/resources/flv/FlowPlayerResource.java
Log:
-fixed default splash screen
-added ability to use external config file (use all config options of flowplayer)
-added flv path guess for use with map.rc. (one rc for multiple flv.)

Modified: public/yanel/contributions/resources/flow-player/resource.xml
===================================================================
--- public/yanel/contributions/resources/flow-player/resource.xml	2007-11-14 22:13:45 UTC (rev 28894)
+++ public/yanel/contributions/resources/flow-player/resource.xml	2007-11-14 22:13:51 UTC (rev 28895)
@@ -10,10 +10,11 @@
 </description>
 
 <rtd>
-  <property name="flvPath"/>
+  <property name="flvPath"/> <!-- ignored if configFileName is used. -->
   <property name="title"/>
-  <property name="splashImg"/> <!-- if not set standard splash image will be displayed. set to "none" if no splash image is desired. -->
+  <property name="splashImg"/> <!-- if not set standard splash image will be displayed. set to "none" if no splash image is desired. ignored if configFileName is used. -->
   <property name="width"/> <!-- optional. sample value 250px -->
   <property name="height"/> <!-- optional. sample value 250px -->
+  <property name="configFileName"/> <!-- see http://flowplayer.org/documentation/config how to config -->
 </rtd>
 </resource>

Modified: public/yanel/contributions/resources/flow-player/src/java/com/wyonapictures/yanel/impl/resources/flv/FlowPlayerResource.java
===================================================================
--- public/yanel/contributions/resources/flow-player/src/java/com/wyonapictures/yanel/impl/resources/flv/FlowPlayerResource.java	2007-11-14 22:13:45 UTC (rev 28894)
+++ public/yanel/contributions/resources/flow-player/src/java/com/wyonapictures/yanel/impl/resources/flv/FlowPlayerResource.java	2007-11-14 22:13:51 UTC (rev 28895)
@@ -101,20 +101,33 @@
             height = getResourceConfigProperty("height");
         }
         IOUtils.write("var fo = new SWFObject(\"?yanel.resource.viewid=flashplayer\", \"FlowPlayer\", \"" + width + "\", \"" + height +"\", \"7\", \"#000\", true);", baos);
+
         //IOUtils.write(" // need this next line for local testing, it's optional if your swf is on the same domain as your html page", baos);
-        IOUtils.write("fo.addParam(\"allowScriptAccess\", \"always\");", baos);
-        String splashImg = "";
-        if (getResourceConfigProperty("splashImg") == null) {
-            splashImg = "{ url: 'wyona-pictures.jpg' },";
+        //IOUtils.write("fo.addParam(\"allowScriptAccess\", \"always\");", baos);
+
+        if (getResourceConfigProperty("configFileName") != null) {
+            IOUtils.write("fo.addVariable(\"config\", \"{ configFileName: '" + getResourceConfigProperty("configFileName") +"' }\");", baos);
+        } else {
+            String splashImg = "";
+            if (getResourceConfigProperty("splashImg") == null) {
+                splashImg = "{ url: '" + PathUtil.getResourcesHtdocsPath(this) + "wyona-pictures.jpg' },";
+            }
+            if (getResourceConfigProperty("splashImg") != null && !getResourceConfigProperty("splashImg").equals("none")) {
+                splashImg = "{ url: '" + getResourceConfigProperty("splashImg") + "' },";
+            }
+            String flvPath;
+            if (getResourceConfigProperty("flvPath") == null) {
+                flvPath = getPath().substring(0, getPath().indexOf(".")) + ".flv";
+                Repository dataRepo = getRealm().getRepository();
+                if(!dataRepo.existsNode(flvPath)) {
+                    log.error("No .flv file specified. tried to guess (" + flvPath + ") but nothing found.");
+                    throw new Exception("No .flv file specified.");
+                }
+            } else {
+                flvPath = getResourceConfigProperty("flvPath");
+            }
+            IOUtils.write("fo.addVariable(\"config\", \"{ showPlayListButtons: true,  playList: [  " + splashImg + "  { url: '" + flvPath + "' } ], initialScale: 'fit' }\");", baos);
         }
-        if (getResourceConfigProperty("splashImg") != null && !getResourceConfigProperty("splashImg").equals("none")) {
-            splashImg = "{ url: '" + getResourceConfigProperty("splashImg") + "' },";
-        }
-        if (getResourceConfigProperty("flvPath") == null) {
-            log.error("No .flv file specified.");
-            throw new Exception("No .flv file specified.");
-        }
-        IOUtils.write("fo.addVariable(\"config\", \"{ showPlayListButtons: true,  playList: [  " + splashImg + "  { url: '" + getResourceConfigProperty("flvPath") + "' } ], initialScale: 'fit' }\");", baos);
         IOUtils.write("fo.write(\"flowplayerholder\");", baos);
         //IOUtils.write("// ]]>", baos);
         IOUtils.write("</script>", baos);
@@ -123,12 +136,10 @@
         return new java.io.ByteArrayInputStream(baos.toByteArray());
     }
 
-
     private InputStream getFlashPlayerFile() {
         File flowPlayerFile = org.wyona.commons.io.FileUtil.file(this.getRTD().getConfigFile().getParentFile().getAbsolutePath(),  "htdocs" + File.separator + "FlowPlayer.swf");
         try {
-            InputStream test = new FileInputStream(flowPlayerFile);
-            return test;
+            return new FileInputStream(flowPlayerFile);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }



More information about the Yanel-commits mailing list