Red5服务器学习(1)流媒体服务搭建-续

前篇文章里的simpleplayer的例子需要完善一下

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="320" minHeight="200"
			   applicationComplete="init()">
			   
	<fx:Script>
		<![CDATA[
			
		import mx.core.FlexGlobals;
		public function init() : void {
		var vWidth:int;
		var vHeight:int;

		vWidth = parseInt( FlexGlobals.topLevelApplication.parameters.videoWidth );
		vHeight = parseInt( FlexGlobals.topLevelApplication.parameters.videoHeight );
		if ( vWidth > 0 )
		     myPlayer.width = vWidth;
		if ( vHeight > 0 )
		     myPlayer.height = vHeight;
					
		myPlayer.autoPlay = parseInt( FlexGlobals.topLevelApplication.parameters.videoAutoPlay );
		myPlayer.source = FlexGlobals.topLevelApplication.parameters.videoFullName; 
		}
			
		]]>
	</fx:Script>
	
	
	<s:VideoPlayer id="myPlayer" x="0" y="0" width="320" height="200" autoPlay="false" scaleMode="zoom" loop="true"/>
</s:Application>

 

增加了FlashVars参数的支持,可以页面传入播放参数

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
	<head>
		<style type="text/css" media="screen">
                        html, body, #containerA, #containerB { height:100%; }
                        body { margin:0; padding:0; overflow:hidden; }
                </style>
		<title>Test</title>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<script type="text/javascript" src="assets/swfobject.js"></script>
		<script type="text/javascript">

        var flashvars = {
            videoFullName : "rtmp://localhost/myvod/test.flv",
            videoAutoPlay : "1",
            videoWidth : "600",
            videoHeight : "400"
		};

		swfobject.embedSWF("hello.swf", "myContent", "100%", "100%", "10.0.0", "assets/expressInstall.swf",flashvars);
		</script>
	</head>
	<body>
		<div id="myContent">
			<h1>You need the Adobe Flash Player for this demo, download it by clicking the image below.</h1>
			<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
		</div>
	</body>
</html>

 

*swfobject.js 来自 http://code.google.com/p/swfobject/ 

目前对RED5和Flex的使用和了解也只有这些了

 

 

你可能感兴趣的:(JavaScript,XHTML,Flex,Flash,Adobe)