code to add video to HTML
automatically load video
As with music playback, we can use the embed tag to play video,
<embed src= "http://blog.163.com/qianxue126@126/blog/video file Address" >
properties are:
Src= "Http://blog.163.com/qianxue126@126/blog/filename" |
Set the path of the file |
Autostart=true/false |
If you want the file to be routed automatically, True is, false is not, default is False |
Loop=true/false |
Set the number of playback repeats, Loop=6 says repeat 6 times, true to show infinite playback, false play once stop. |
Startime= "Minutes: Seconds" |
Set start playback time, such as 20 seconds after playback write as Startime=00:20 |
volume=0-100 |
Set the volume size. If it's not set, use the system's volume. |
WIDTH HEIGHT |
To set the size of the control panel |
Cases:
*************************************
<title> Play Video </title>
<body>
<b><font size=4> Play Video windows95</font></b>
<P>
<embed src= "Http://blog.163.com/qianxue126@126/blog/welcome.avi" Autostart=false loop=false width=350 height=250 >
</P>
</body>
Introduction to param usage of parameters in SWF file
<object classid= "clsid27cdb6e-ae6d-11cf-96b8-444553540000" codebase= "http://download.macromedia.com/pub/ shockwave/cabs/flash/swflash.cab#version=6,0,29,0 "width=" 580 "height=" > <param name= "_cx" value= "10372" > <param name= "_cy" value= "2355" > <param name= "flashvars" value= "-1" > <param name= "Movie" value= "SWF. swf "> <param name=" SRC "value=" 1.swf "> <param name=" wmode "value=" Transparent "> <param name=" Play "va Lue= "-1" > <param name= "Loop" value= "-1" > <param name= "Quality" value= "High" > <param name= "salign" Val Ue> <param name= "menu" value= "0" > <param name= "Base" value> <param name= "allowscriptaccess" Value= "al Ways "> <param name=" Scale "value=" ShowAll "> <param name=" devicefont "value=" 0 "> <param name=" EMBEDMO Vie "value=" 0 "> <param name=" bgcolor "value> <param name=" Swremote "value> <embed src=" http://blog.16 3.com/qianxue126@126/blog/1.swf "width=" 580 "height= "quality=" High "pluginspage=" Http://www.macromedia.com/go/getflashplayer "type=" application/
X-shockwave-flash "wmode=" Transparent "menu=" false "></embed> </object>
Parameters and properties
The following markup properties and parameters describe the HTML code created by the Publish command. You can refer to this list when writing your own HTML for displaying Flash content. Unless otherwise stated, all entries apply both to object tags and embed tags. Optional entries are also listed here. Internet Explorer recognizes the parameters used for the object tag, while Netscape recognizes the parameters for the embed tag. Properties can be used both for object tags and for embed tags. When customizing a template, you can replace the corresponding value with the template variables listed here. See Customizing HTML Publishing Templates.
Note: The properties and parameters listed in this section are deliberately displayed in lowercase letters to conform to the XHTML standard.
Devicefont Properties/Parameters
Value: TRUE | False
Template variables: $DE
Description
Optionally, for static text objects that do not have the Device Font option selected, specify whether the device font is still being drawn (if the operating system provides the desired font).
SRC attribute
Value: moviename.swf
Template variables: $MO
Description: Specifies the name of the SWF file to load. Applies only to embed.
Movie Parameters
Value: moviename.swf
Template variables: $MO
Description: Specifies the name of the SWF file to load. Applies only to object.
ClassID Property
Value: clsid:d27cdb6e-ae6d-11cf-96b8-444553540000
Description: Identifies the browser's ActiveX control. The value entered must be exactly the same as the above display. Applies only to object.
Width Property
Value: N or n%
Template variables: $WI
Description: Specifies the width of the application as a pixel value or as a percentage of the browser window.
Height property
Value: N or n%
Template variables: $HE
Description: Specifies the height of the application as a pixel value or as a percentage of the browser window.
Note: Because Flash applications are scalable, their quality will not degrade as long as the aspect ratio remains unchanged, regardless of the size of the playback. (for example, the aspect ratios for the following dimensions are 4:3:640 x 480 pixels, 240 pixels x and 180 pixels.) )
CodeBase Property
Value: active.macromedia.com/flash7/cabs/swflash.cab#version=7,0,0,0
Description: Identifies the location of the Flash Player ActiveX control so that the browser can download it automatically when the control is not installed. The value entered must be exactly the same as the above display. Applies only to object.
Pluginspage Property
Value: Www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash
Description: Identifies the location of the Flash Player plug-in so that the user can download it when the plugin is not already installed. The value entered must be exactly the same as the above display. Applies only to embed.
Swliveconnect Property
Value: TRUE | False
Description: (optional) Specifies whether the browser should start Java the first time the Flash Player is loaded. If this property is omitted, the default value is False. The Fscommand () function works if both JavaScript and Flash,java on the same page must be in a running state. However, if you run JavaScript just to detect the browser or for other purposes unrelated to the Fscommand () action, you can prevent Java startup by setting the Swliveconnect to False. When JavaScript and Flash are not used together, you can also force Java startup by explicitly setting the Swliveconnect property to True. Starting Java significantly increases the time required to start the SWF file, so you should set this tag to true only if necessary. Applies only to embed.
Use the Fscommand () action to start Java from a stand-alone show file.
Play Properties/Parameters
Value: TRUE | False
Template variables: $PL
Description: (optional) Specifies whether the application starts playing when it is loaded in the browser. If your Flash application is interactive, you can have the user start playing by clicking the button or performing some other task. In this case, setting the play property to false prevents the application from starting automatically. If this property is omitted, the default value is true.
Loop Properties/Parameters
Value: TRUE | False
Template variables: $LO
Description: (optional) Specify whether the Flash content is unlimited repeat playback or stop after it reaches the last frame. If this property is omitted, the default value is true.
Quality Properties/Parameters
Value: Low | Medium | High | Autolow | Autohigh | Best
Template variables: $QU
Description: Optionally specifies the anti-aliasing level that is used during application playback. Because anti-aliasing requires a faster processor to smooth each frame of the SWF file before it is rendered to the audience screen, you need to select a value based on whether you want to optimize the speed or the appearance of the image:
Low makes playback speed take precedence over appearance, and never uses anti-aliasing.
"Autolow" gives priority to speed, but it also improves appearance as much as possible. Anti-aliasing is turned off when playback begins. If Flash Player detects that the processor can handle anti-aliasing, it opens the feature.
"Autohigh" starts with both playback speed and appearance, but sacrifices the appearance to ensure playback speed if necessary. Anti-aliasing is turned on when playback begins. If the actual frame frequency falls below the specified frame rate, anti-aliasing is turned off to improve playback speed. Use this setting to simulate the anti-aliasing command in Flash (View > Preview mode > Anti-aliasing).
"Medium" applies some anti-aliasing, but does not smooth the bitmap. This setting generates an image quality that is higher than the "low" setting, but is less than the image quality generated by the "high" setting.
High makes the appearance take precedence over playback speed, and it always applies anti-aliasing. If the SWF file does not contain animations, the bitmap is smoothed and the bitmap is not smoothed if the SWF file contains animations.
Best provides the optimal display quality without regard to playback speed. All output is anti-aliasing, and all bitmaps are smoothed.
If you omit the quality property, the default value is high.
BgColor Properties/Parameters
Value: #RRGGBB (hexadecimal RGB value)
Template variables: $BG
Description: (optional) Specifies the background color of the application. Use this property to overwrite the background color settings specified in the Flash SWF file. This property does not affect the background color of the HTML page.
Scale Properties/Parameters
Value: ShowAll | Noborder | Exactfit
Template variables: $SC
Description: (optional) defines how the application is placed in the browser window when the width and height values are percentages.
The ShowAll (default) causes the entire Flash content to be displayed in the specified range without distortion, while maintaining its original aspect ratio. The border may appear on both sides of the application.
"Noborder" zooms in on the contents of the flash to fill the specified area without distortion, which causes the application to maintain the original aspect ratio, but it is possible that some cropping will occur.
Exactfit makes the entire Flash content appear in the specified range, but does not attempt to maintain the original aspect ratio. may be distorted.
If this property is omitted (and the width and height values are percentages), its default value is ShowAll.
Align property
Value: Default | L | R | T | B
Template variables: $HA
Description: Specifies the align value of the object, embed, and IMG tags, and determines how to place the Flash SWF file in the browser window.
Default causes the application to be centered in the browser window, cropping the edge if the browser window is smaller than the application.
L, R, T, and B align the application along the left, right, top, and bottom edges of the browser window, and crop the remaining three edges as needed.
Salign parameters
Value: L | R | T | B | TL | TR | BL | Br
Template variables: $SA
Description: (optional) Specifies the position of the scaled Flash SWF file in the area defined by the width and height settings. For more information about these conditions, see Scale Properties/Parameters.
L, R, T, and B align the application along the left, right, top, and bottom edges of the browser window, and crop the remaining three edges as needed.
TL and TR align the application with the upper-left and upper-right corners of the browser window, and crop the bottom and left edges as needed.
BL and BR align the application with the lower-left and lower-right corners of the browser window, and crop the top and left edges as needed.
If this property is omitted, the Flash content is centered in the browser window.
Base Property
Value: Base directory or URL
Description: (optional) specifies the base directory or URL used to resolve all relative path statements in the Flash SWF file. This property is useful if the SWF file is saved in a different directory than your other files.
Menu Properties/Parameters
Value: TRUE | False
Template variables: $ME
Description: (optional) specifies the type of menu that will be displayed when the audience right-clicks (Windows) in the browser or while holding down the Command key click (Macintosh) application zone.
True displays the complete menu, allowing the user to enhance or control playback with various options.
"False" displays a menu that contains only the "About Macromedia Flash Player 6" option and the "Settings" option.
If this property is omitted, the default value is true.
Wmode Properties/Parameters
Value: Window | Opaque | Transparent
Template variables: $WM
Description: (optional) enables you to use the features of transparent Flash content, absolute positioning, and layered display in Internet Explorer 4.0. This tag/property is only valid in Windows with the Flash Player ActiveX control.
Window plays the application on a Web page using the movie's own rectangular window. "Window" indicates that the Flash application has no interaction with the HTML layer and is always at the top level.
Opaque causes the application to hide all the content that is behind it on the page.
"Transparent" enables the background of an HTML page to be displayed through all transparent portions of the application, which may degrade animation performance.
Both "Opaque windowless" and "transparent windowless" can interact with the HTML layer and allow the layers above the SWF file to obscure the application. The difference between the two options is that "transparent" allows transparency, so if a portion of the SWF file is transparent, the HTML layer underneath the SWF file can be displayed through that section.
If this property is omitted, the default value is Window. Applies only to object.
allowScriptAccess Properties/Parameters
Value: Always | Never | Samedomain
Description: Use allowScriptAccess to enable the Flash application to communicate with the HTML page that hosts it. This parameter is required because the Fscommand () and GetURL () actions may cause JavaScript to use the permissions of the HTML page, which may differ from the permissions of the Flash application. This has an important relationship to cross-domain security.
Always allows scripting operations to be performed at any time.
Never prevents all scripts from performing operations.
Samedomain allows script operations to be performed only when the Flash application comes from the same domain as the HTML page.
The author takes IE5.0 as an example to illustrate the implementation of an embedded web video-on-demand system, in which some PHP and JavaScript technologies are used, and the readers who are puzzled should refer to the relevant information.
Inserts the RealPlayer ActiveX object (if you want to test, you need to install the RealPlayer player first)
Assume that the following code is included in the video.php document (the file will be linked through <iframe> in the main page).
<object width= "height=" classid= "CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" > <param name= "CONT" Rols "value=" Imagewindow > <param name= "CONSOLE" value= "video" > <param name= "CENTER" value= "TRUE" > <param name= "maintainspect" value= "TRUE" > </object>//define Playback interface <object width= "30" "Classid=" CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA "> <param name=" CONTROLS "value=" StatusBar "> <para M name= "CONSOLE" value= "video" > </object>//define status bar <object width= "height=" "classid=" CLSID:CF CDAA03-8BE4-11CF-B84B-0020AFBBCCFA "> <param name=" CONTROLS "value=" ControlPanel "> <param name=" CONSOLE "value=" video "> <param name=" SRC "value=" <?php Echo getsrc ();?> "> <param name=" AUTOSTART "V Alue= "TRUE" > <param name= "PREFETCH" value= "0" > <param name= "LOOP" value= "0" > <param name= " Numloop "value=" 0 "; </object>//define Control Panel
Where the controls parameter is used to specify the appearance of the control for the player, it can be combined with multiple controls and associated with the console parameter.
For Param parameters, readers can refer to the RealPlayer official website http://service.real.com/help/library/guides/production/htmfiles/control.htm.
The SRC parameter is particularly important here to specify the URL address of the video stream file. Here the author uses the method of PHP code to specify SRC dynamically, the reader can also use other such as ASP, or completely through
JavaScript implementation.
Ii. using DHTML to dynamically control playback of RealPlayer controls
Tips: The magical uses of <IFRAME>. Because the new SRC needs to be refreshed for the RealPlayer control, you can embed the RealPlayer control in a separate page using <IFRAME>, so that dynamic refresh is done in <IFRAME>. Does not affect the user viewing other content on the page.
The following code is included in the main page:
<iframe id= "Ivideo" src= "http://blog.163.com/qianxue126@126/blog/video.php" width=500 Height=345
frameborder=0 scrolling= "No" >
, where the video.php file displays the RealPlayer control forcefully.
Here we add a simple JavaScript code to control the playback of the video.
<script language= "JavaScript" >
function Play (filename) {
top.document.all ("Ivideo"). src = "video.php?" Src= "Http://blog.163.com/qianxue126@126/blog/+filename;
} Ivideo is the identifier of the IFRAME just defined
</script>
We can use JavaScript to control the more complex features of the RealPlayer plug-in, such as extracting the length of the video, testing the user's network rate, customizing playback events, and so on. About RealPlayer
For specific details of ActiveX development, please refer to the RealPlayer official website http://service.real.com/help/library/guides/extend/embed.htm.
Let's say we have a video file with a URL of http://YourURL/filename.ram, so we can define it like this:
<a href= "Javascript:play (' Http://YourURL/filename.ram ')" > file 1 </a>, if the file is local, the URL can also be a relative path.
Third, detect whether the user installs RealPlayer player
Add the following JavaScript code in the
<script language=javascript> <!--var realmode=0;
var realplayer5=0;
var realplayer4=0;
var realplayerg2=0;
if (Navigator.userAgent.indexOf ("MSIE") < 0) {numplugins = Navigator.plugins.length;
for (i = 0; i < numplugins i++) {plugin = navigator.plugins[i];
if (plugin.name.substring (0,10) = = "RealPlayer") {realmode=1;
The following code creates the RealPlayer object document.write (' <script language=vbscript\> ') dynamically through the CreateObject () function of VBScript;
document.write (' On Error Resume Next \ n '); document.write (' RealPlayerG2 = (not IsNull (CreateObject) (Rmocx.
RealPlayer G2 Control ")) \ n ');
document.write (' RealPlayer5 = (not IsNull (CreateObject (Realplayer.realplayer (tm) ActiveX control (32-bit))) \ n ');
document.write (' RealPlayer4 = (not IsNull (CreateObject (Realvideo.realvideo (tm) ActiveX control (32-bit))) \ n ');
document.write (' </SCRIPT\> \ n '); if (RealPlayerG2 | | RealPlayer5 | | REALPLAYER4) {//Can add <object> object}else if (ReaLmode) {//Netscape browser user//Can join <embed> object}else{window.location.replace ("install.htm") in this place; Transfer to install.htm page to instruct user to install}-->