[xiph-commits] r15713 - websites/celt-codec.org/docs

gmaxwell at svn.xiph.org gmaxwell at svn.xiph.org
Mon Feb 23 22:15:56 PST 2009


Author: gmaxwell
Date: 2009-02-23 22:15:55 -0800 (Mon, 23 Feb 2009)
New Revision: 15713

Added:
   websites/celt-codec.org/docs/LCA-video-thumb.jpg
   websites/celt-codec.org/docs/video.js
Modified:
   websites/celt-codec.org/docs/index.shtml.en
Log:
Add link/embedded video from Timothy's linux.conf.au tal, along with a slightly modified version of Maikmerten's video fallback script.

Added: websites/celt-codec.org/docs/LCA-video-thumb.jpg
===================================================================
(Binary files differ)


Property changes on: websites/celt-codec.org/docs/LCA-video-thumb.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: websites/celt-codec.org/docs/index.shtml.en
===================================================================
--- websites/celt-codec.org/docs/index.shtml.en	2009-02-22 23:49:54 UTC (rev 15712)
+++ websites/celt-codec.org/docs/index.shtml.en	2009-02-24 06:15:55 UTC (rev 15713)
@@ -9,8 +9,13 @@
 }
 -->
 </style>
+<script src="video.js" type="text/javascript"></script>
+<script language="vbScript">
+on error resume next
+vlcActiveX = (IsObject(CreateObject("VideoLAN.VLCPlugin.2")))
+</script>
 </head>
-<body>
+<body onload="initVideo();">
 <!--#include virtual="/common/xiphbar.include" -->
 <!--#include virtual="/ssi/pagetop.include" -->
 <!--  All your page content goes here  -->
@@ -20,7 +25,14 @@
    Unfortunately, there is no CELT manual yet. However, you can find some information about it:
 <ul>
    <li>On <a href="http://jmspeex.livejournal.com/">Jean-Marc Valin's blog</a></li>
-   <li>In the presentation that Timothy Terriberry gave at linux.conf.au 2009 (<a href="misc/lca-celt.pdf">slides</a>, <a href="misc/lca-celt-audio.tar.bz2">audio samples</a>)</li>
+   <li>In the presentation that Timothy B. Terriberry gave at linux.conf.au 2009 (<a href="misc/lca-celt.pdf">slides</a>, <a href="misc/lca-celt-audio.tar.bz2">audio samples</a>)
+   <br><center><table width=384 border=0><tr><td><video id="lcaceltvideo" width=384 height=288
+   poster="LCA-video-thumb.jpg" controls="True" autoplay="False"
+   src="http://people.xiph.org/~greg/video/linux_conf_au_CELT.ogv"/></td></tr><tr><td align="right"><a
+   href="http://people.xiph.org/~greg/video/linux_conf_au_CELT.ogv">Download
+   video</a>
+   <small>(Ogg/<a href="http://www.theora.org/">Theora</a>; 64 minutes; 81 MiB)</small></a></td></tr></table></center>
+   </li>
 </ul>
 
 </p>

Added: websites/celt-codec.org/docs/video.js
===================================================================
--- websites/celt-codec.org/docs/video.js	                        (rev 0)
+++ websites/celt-codec.org/docs/video.js	2009-02-24 06:15:55 UTC (rev 15713)
@@ -0,0 +1,137 @@
+var vlcActiveX = false;
+var vlcPlugin = false;
+var videoElement = false;
+var oggPlugin = false;
+var javaEnabled = false;
+var cortadourl ='';
+
+function initVideo() {
+
+	var video = document.createElement("video");
+
+	if(video.canPlayType && video.canPlayType("video/ogg;codecs=\"theora,vorbis\"") == "probably") {
+		videoElement = true;
+	}
+
+	var searchedMimeTypes = false;
+	var foundJavaMimeType = false;
+
+	// search for MIME-types
+	if(navigator.mimeTypes && navigator.mimeTypes.length > 0) {
+
+		searchedMimeTypes = true;
+
+		for (var i = 0; i < navigator.mimeTypes.length; i++) {
+			if(navigator.mimeTypes[i].type.indexOf("video/ogg") > -1) {
+				oggPlugin = true;
+    			}
+			if(navigator.mimeTypes[i].type.indexOf("application/x-vlc-plugin") > -1) {
+				vlcPlugin = true;
+			}
+			if(navigator.mimeTypes[i].type.indexOf("application/x-java-applet") > -1) {
+				foundJavaMimeType = true;
+			}
+		}
+	}
+
+	var nativePlayback = vlcActiveX || vlcPlugin || videoElement || oggPlugin;
+ 
+	if(searchedMimeTypes) {
+		javaEnabled = navigator.javaEnabled() && foundJavaMimeType;
+	} else {
+		javaEnabled = navigator.javaEnabled();
+	}
+
+	var htmlvideos = document.getElementsByTagName("video");
+	var oggvideos = document.getElementsByTagName("oggvideo");
+
+	var videos = new Array(htmlvideos.length + oggvideos.length);
+	for(i = 0; i < videos.length; ++i) {
+		if(i < htmlvideos.length) {
+			videos[i] = htmlvideos[i];
+		} else {
+			videos[i] = oggvideos[i - htmlvideos.length];
+		}
+	}
+
+	// replace all video elements with fallbacks
+	for(i = 0; i < videos.length; ++i) {
+
+		var video = videos[i];
+
+		if(videoElement && video.tagName.toLowerCase() == "video") {
+			continue;
+		}
+
+		var src = video.getAttribute("src");
+		var width = video.getAttribute("width");
+		var height = video.getAttribute("height");
+		var controls = video.getAttribute("controls");
+		var autoplay = video.getAttribute("autoplay");
+
+		var parent = video.parentNode;
+		if(videoElement) {
+			var videoelem = document.createElement("video");
+			videoelem.setAttribute("src", src);
+			videoelem.setAttribute("width", width);
+			videoelem.setAttribute("height", height);
+			if(controls) videoelem.setAttribute("controls",  "true");
+			if(autoplay) videoelem.setAttribute("autoplay",  "true");
+			parent.replaceChild(videoelem, video);
+		} else if(javaEnabled) {
+			if (cortadourl=='') {
+			  if (src.indexOf('/')!=-1)
+				cortadourl = src.substr(0,src.lastIndexOf('/'))+'/';
+                          cortadourl = cortadourl+'cortado.jar';
+			}
+			var applet = document.createElement("applet");
+			applet.setAttribute("code", "com.fluendo.player.Cortado.class");
+			applet.setAttribute("archive", cortadourl);
+			applet.setAttribute("width", width);
+			applet.setAttribute("height", height);
+
+			var param = document.createElement("param");
+			param.setAttribute("name","BufferSize");
+			param.setAttribute("value","4096");
+			applet.appendChild(param);
+			
+			param = document.createElement("param");
+			param.setAttribute("name","BufferHigh");
+			param.setAttribute("value","25");
+			applet.appendChild(param);
+			
+			param = document.createElement("param");
+			param.setAttribute("name","BufferLow");
+			param.setAttribute("value","5");
+			applet.appendChild(param);
+
+			param = document.createElement("param");
+			param.setAttribute("name","url");
+			param.setAttribute("value", src);
+			applet.appendChild(param);
+
+			parent.replaceChild(applet, video);
+
+		} else if(oggPlugin) {
+			var object = document.createElement("object");
+			object.setAttribute("width", width);
+			object.setAttribute("height", height);
+			object.setAttribute("data", src);
+			object.setAttribute("type", "video/ogg");
+			parent.replaceChild(object, video);
+		} else if(vlcActiveX) {
+			var span = document.createElement("span");
+			span.innerHTML = "<object classid='clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921' codebase='http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab' width='" + width + "' height='" + height + "' id='vlc' events='True'><param name='Src' value='"+ src +"'/> <param name='ShowDisplay' value='True'/><param name='AutoLoop' value='False'/><param name='AutoPlay' value='False'/></object>";
+			parent.replaceChild(span,video);
+		} else if(vlcPlugin) {
+			var span = document.createElement("span");
+			span.innerHTML = "<object type='application/x-vlc-plugin' id='vlc_element' width='"+width+"' height='"+height+"' data='" + src + "'></object><br>" + "<input type='button' value='play' onClick='document.getElementById(\"vlc_element\").play()'>" + "<input type='button' value='stop' onClick='document.getElementById(\"vlc_element\").stop()'>";
+			parent.replaceChild(span,video);
+			
+		} else {
+			var msg = document.createTextNode("No fitting Ogg decoder found. Install a proper browser with Ogg Theora support or a browser plugin fit for Ogg Theora playback.");
+			parent.appendChild(msg);
+		}
+	}
+
+}



More information about the commits mailing list