How to Use flvplayer.swf flv Video Player

Source: Internet
Author: User
Tags xspf flv file

1. Load directly in an html file: Copy codeThe Code is as follows: <div id = "FlashFile">
<Object type = "application/x-shockwave-flash" width = "470px" height = "403px"
Data = "flvplayer.swf? File = movies/company. flv ">
<Param name = "movie" value = "flvplayer.swf? File = movies/company. flv & showfsbutton = true & autostart = true "/>
<Param name = "wmode" value = "transparent"/>
<Param name = "quality" value = "high"/>
<Param name = "allowfullscreen" value = "true"/>
</Object>
</Div>

Ii. Dynamic Loading using javascript:Copy codeThe Code is as follows: <script type = "text/javascript">
Function PlayFlv (filename ){
Var videoname = filename; // video file name
Var floder = "video"; // folder where the flash video is stored. The cursor is the location of the relative flvplayer.swf file (images/flvplayer.swf)
Var div = document. getElementById ("flvPlayDiv ");
Div. innerHTML = " "; // adding a waiting image increases user experience;
Div. style. display = "none ";
Var result = "<table align = 'center'> <tr> <td align = 'center'> <object type = 'application/x-shockwave-flash' width = '470px 'height = '403px '";
Result + = "data = 'images/flvplayer.swf? File = "+ floder +"/"+ filename +" '> ";
Result + = "<param name = 'movie 'value = 'images/flvplayer.swf? File = "+ floder +"/"+ filename +" & showfsbutton = true & autostart = true '/> ";
Result + = "<param name = 'wmode' value = 'transparent '/> ";
Result + = "<param name = 'quality' value = 'high'/> ";
Result + = "<param name = 'allowfullscreen 'value = 'true'/> ";
Result + = "</object> </td> </tr> </table> ";
Div. innerHTML = result;
Div. style. display = "inline"; // div display Mode
}
</Script>

Add the following code to the body area:Copy codeThe Code is as follows: <button id = "kk" type = "button" onclick = "PlayFlv ('company1. flv')"> play 1 </button>
<Br/> <button id = "k2" type = "button" onclick = "PlayFlv ('company2. flv')"> playback 2 </button>
<Div id = "flvPlayDiv"> </div> <! -- Div region of video playback -->

Jw flv player Online flvplayer Chinese instructions
How to Use: copy the catalog to the same directory, and then add
Program code
<Object type = "application/x-shockwave-flash" width = "400" height = "220"
Wmode = "transparent" data = "flvplayer.swf">
<Param name = "movie" value = "flvplayer.swf"/>
<Param name = "wmode" value = "transparent"/>
<Object/>
“Flvplayer.swf automatically finds "video. flv" in the same directory. You can also add the URL of the FLV file after "Unzip flvplayer.swf" to play the video. The method is as follows:
Program code
<Object type = "application/x-shockwave-flash" width = "400" height = "220"
Wmode = "transparent data =" flvplayer.swf? File = movies/holiday. flv ">
<Param name = "movie" value = "flvplayer.swf? File = movies/holiday. flv "/>
<Param name = "wmode" value = "transparent"/>
</Object>
"File = movies/holiday. flv" is a parameter. You can use a relative or absolute address.
Other parameters:
If you do not need to play the video automatically when loading the video, you can use the "autostart" parameter.
Example
Program code
<Object type = "application/x-shockwave-flash" width = "400" height = "220"
Wmode = "transparent" data = "flvplayer.swf? Autostart = false ">
<Param name = "movie" value = "flvplayer.swf? Autostart = false "/>
<Param name = "wmode" value = "transparent"/>
</Object>
Multiple parameters can be used together. A valid parameter list is as follows:
Program code
File (FLV file address)
Autostart (whether automatic playback is allowed, "true" or "false ")
Image (Preview image when not playing, only JPEG format is supported)
Repeat (whether to play repeatedly)
Clicktext (the text displayed at the beginning. The default value is "click to play ")
The following is version 3.12of http://www.cgfans.net/bbs/medias/2007/10/?_flv_player.zip.
This document contains the installation and configuration of JW MP3 Player, JW FLVPlayer, JW Media Player, and JW Image Rotator.
Method
Jw players 3.12 documentation
1. Install (embedded in your site)
2. parameters (configuration)
Basic parameters
Color Parameters
Interface Parameters
Playback Parameters
Interaction Parameters
3. playlist
4. Custom
5. Supported
Quick configuration. You can run the Configuration Wizard.
1. Install
After downloading, you can get an example. When you open it in a text or HTML editor, you can find that swf uses a short
Javascript is embedded on the page. This Javascript is swfobject. js written by Geoff Stearns. It solves the needs of Flash
Active troubles. When copying swf to your site, do not forget to copy swfobject. js together. And in
Add the following code to Head:
Program code
<Script type = "text/javascript" src = "swfobject. js"> </script>
In swfobject. with the help of js, you can easily set the swf path, width, height, background color, and the desired Flash Player version. You can also set a set of parameters to configure swf. When a page is loaded, javascript replaces the nodes on the page according to the id.
Program code
<P id = "player"> <a href = "http://www.macromedia.com/go/getflashplayer"> Get Flash </a> to see this player. </p>
<Script type = "text/javascript">
Var so = new SWFObject('mediaplayer.swf ', 'player', '123', '123', '7 ');
So. addParam ("allowfullscreen", "true ");
So. addVariable ("file", "test. flv ");
So. addVariable ("displayheight", "300 ");
So. write ('player ');
</Script>
If you cannot use javascript (for example, your bsp does not support it, such as myspace), you can use the "embed" method to insert swf.
It should be noted that swf may not be on this server, but if you need to use an xml playlist, there may be problems, because xml must be on the same server as swf, otherwise, it will be organized due to security issues. Mp3, jpg, and flv may not be on this server.
Program code
<Embed src = "http://www.myfileserver.com/folder/mediaplayer.swf" width = "400" height = "400"
Type = "application/x-shockwave-flash" pluginspage = "http://www.macromedia.com/go/getflashplayer"
Flashvars = "file = http://www.myfileserver.com/folder/test.flv&displayheight=300"/>
2. Parameters
These parameters can be used to configure the behavior and appearance of the player embedded in html. If swfobject. js, which can be configured using the addVariable () method. If you use the embed method, you can configure variables by defining the "flashvars" attribute. Note that the variables are separated by the "&" symbol.
Marked by the asterisk (*) also applies to JW Image Rotator.
Basic Variables
Displayheight (number): the height of the display area. The minimum height of the control area is 20px. When the value is greater than or equal to the swf height, the playlist is automatically hidden. Otherwise, the playlist is displayed.
File * (url): the address of the file to be played. Supports single-file playback (MP3, FLV, RTMP, JPG, SWF, PNG, and GIF) and playback list. JW Image Rotator only supports list
Height * (number): sets the swf height. When you insert a swf image using the embed method, it is already set in the attributes of the embed. However, sometimes (especially when IE is used) the height will become uncertain and affect the layout. In this case, you need to set this parameter, and the unit of this value is px.
Image (url): When you play mp3 and flv videos, you can set a preview image as the album art. JPG, SWF, PNG, and GIF files are supported. you can also set each item in the playlist.
Shownavigation * (true, false): this parameter is only supported by JW Image Rotator. Used to display or hide image navigation.
Transition * (fade, bgfade, blocks, bubbles, circles, fluids, lines, random, slowfade): this parameter is only supported by JW Image Rotator. Used to set the effect of image replacement. Set "random" to randomly set the effect. The default value is "fade ".
Width * (number): Set the swf width. The other values are the same as the height;
Color variable
Backcolor * (color): Set the background color of the player. JW Media Player and other default values are 0 xFFFFFF (white) JW Image Rotator 0x000000 (black) by default ).
Fontcolor * (color): Set the color of text and buttons. JW Media Player defaults to 0x000000 (black) JW Image Rotator defaults to 0 xFFFFFF (white ).
Lightcolor * (color): Set the color of the activated state. JW Media Player defaults to 0x000000 (black) JW Image Rotator defaults to 0xCC0000 (red ).
Interface Parameters
Autoscroll (true, false): When the playlist is too long, the scroll bar is automatically displayed by default. When this value is set to 'true', the playback list is automatically rolled over based on the mouse.
Displaywidth (number of pixes): sets the width of the display area. When the value is small, the playlist is displayed on the right side of the display area rather than the bottom.
Kenburns * (true, false): used to achieve the effect of kb during motion (Ken Burns effect). Note that when the figure is large and the network speed is fast, it is recommended to enable it, otherwise, disable it. We recommend that you set transition to "slowfade.
Largecontrols (true, false): set this value to true to enlarge the button in the control area. We recommend that you enable this function for users with poor eyesight.
Logo * (url): sets an image as a watermark in the upper-right corner. It supports all image formats and png with transparent layers for the best effect.
Overstretch * (true, false, fit, none): sets the scaling of the image/video in the display area. "True" and other proportional stretching are used to match the display area. "False": Stretch only the display area. "Fit" is displayed in full screen. "None" shows the original size. JW Media Player and others are "fit" by default, and JW Image Rotator is "false" by default"
Showdigits (true, false, total): this parameter is set to "false" to hide information such as the playback time to save space in the control area. Set "total" to display all the time.
Showdownload (true, false): set this value to display the Download button in the control area. Link to the link address.
Showeq (true, false): used to display a fake audio fluctuation. You can set this value when playing mp3.
Showicons * (true, false): Used to show or hide the image in the middle of the display area. JW Media Player is set to true by default. JW Image Rotator defaults to false;
Showvolume (true, false): Used to set whether to display the volume control button
Thumbsinplaylist (true, false): sets whether a preview is displayed in the list.
Playback Parameters
Autostart (true, false, muted): If it is set to true, the page is automatically played after loading. When muted is set, it is automatically played in the mute mode and the mute icon is displayed in the middle of the display area. Bufferlength (number): Set the flv cache time. The default value is 3 seconds.
Repeat * (true, false, list): The default value is flase. It is played from the current playback position to the end of the list and then stopped. If it is set to list, all items in the list will be played. If it is set to true, the loop will be played.
Rotatetime * (number): Set the display time of the image. JW Media Player and others are set to 10 seconds by default, and JW Image Rotator is set to 5 seconds by default.
Shuffle * (true, false): Set to false for sequential playback and set to true for unordered playback.
Smoothing (true, false): Set to false to disable smooth video processing. We recommend that you set true to achieve better results. However, it is advantageous to set false for large screens or machines with low configurations.
Start * (second): This variable is used to accurately locate the start position when RTMP or HTTP streaming media (unconventional flv/mp3) is used. This parameter is set in the XSPE format list for the accurate and correct settings file section.
Volume * (number): sets the volume. The default value is 80.
Interaction Parameters
Audio * (url): this parameter is used to add an mp3 file as a separate audio file, which can be used as the background music commentary of the image.
Bwfile (url): the address of the file used for bandwidth detection. You can put an image or rtmp streaming media. You can right-click to view the loan value.
Bwstreams (comma-separated list of bitrates ):
Used with bwfile to select different files based on the bandwidth value. For example, if you want to play video. flv and set the value of this item to 100,250,500,100 0, when the player finds that the bandwidth is 349kbps, it will play video_250.flv. So he has a set of effective naming settings, and he will switch automatically, even if the playlist is used.
Callback (url): set this parameter to the address of the server (php/asp) program to return data. When each item is played and stopped, data is sent to the server to save the playback statistics on the server.
Captions (url): set this value to load text in a text format as a subtitle. Subtitle from the player to the SRT format that supports SMIL and DVD. If your flv file has a built-in font, you can set this value to "captionate". If you have multi-channel subtitles, you can set this value to "captionate0", "captionate3", and so on. You can set the value of each item in the list.
Enablejs * (true, false): Set to true to enable javascript support. It can only be used online. Javascript can control playback, load media, and obtain detailed information about the current playback item.
Fsbuttonlink (url): If your Flash Player version is later than (9.0.28), a full screen button is automatically displayed. By setting this value, you can link to another page for full screen display. The server end can set the file to be played.
Id (string): the unique identifier of the player. Will be uploaded back to the server.
Javascriptid * (string): If there are multiple players on your page, you can set this parameter to different IDs for each player, so that javascript can be easily used for control. It will be uploaded back to the getUpdate () event.
Link (url): this parameter is used to set a current version, or force the user to download the current item through this address. You can set this value for each item in the playlist.
Linkfromdisplay * (true, false): Set the page to be accessed when the display area is clicked. By default, you can play or pause a video when you click the show area.
Linktarget * (frame): sets the Link Target. "_ self" is displayed on the current page. "_ Blank" is displayed on the new page.
Streamscript (url): set this parameter to be compatible with the 'pseudo stream' FLV file.
Type (mp3, flv, rtmp, jpg, png, gif, swf, rbs, 3gp, mp4, and m4v): The Player determines the type based on the last three characters in the file name. This method will no longer work when you use server-side language for redirection. So you can set this parameter to tell the Player file type. You can also set each item in the playlist. If the player cannot find the file type, it will be recognized as a playlist.
Useaudio (true, false): Set to false to change to mute.
Usecaptions (true, false): Set to false to hide subtitles.
Usefullscreen (true, false): If you do not want to use the full screen mode of flashplayer9. You can set the "fsbuttonlink" parameter to replace the full screen button event.
Usekeys (true, false): set to "false" to cancel keyboard operations (SPACE, UP, DOWN, LEFT, RIGHT)
Note: Do you have? = & Character transfer .? → % 3F, =→ % 3D, & → % 26. Your "file" variable is getplaylist. php? When id = 123, it must be set to getplaylist. php % 3Fid % 3D123.
Playlist
When there is only one project in the playlist, the player plays the video in single file playback mode. The player distinguishes between a single file and a playlist file based on the file name. For example, if your file name is testbench, the player will play mp3 in single file playback mode, because the extension is mp3. if your file name is getlist. php, the player will regard it as a playlist. If you use a dynamic script to load a single file, such
The player supports three common formats of playlist to ensure versatility. XSPF, RSS, and ATOM.
Common tags of the xspf/RSS/ATOM list supported by the player.
Table

* Image Rotator only supports the first 'audio' item in the playlist and is used as the background music for playing. The player plays all the music items.

** The "category" element can be used to support advertisements. You can set this value to "preroll", "postroll", or "overlay ".
The value of a single item in the "link" playlist is the advertising address.

* ** The "start" element is only supported by the XSPF playlist format. This element is used to set the starting position of the streaming media file (HTTP or RTMP), in seconds.

* *** If the "location" element in the XSPF List format does not contain common extensions (such as "mp3" or "flv"), you can use the "meta" element to specify the file format. (For example, <meta rel = '"type"> mp3 </meta>). When RSS and ATOM are used, the file format is automatically identified by mimetype.

RTMP streams, the additional "id" flashvar has to be sent as well. Example: "file = rtmp: // my. streaming. server/mypath" and "id = video_one ".

Note: When you play a single file, you support all parameters, such as adding an image, title, id, and link. For example, when you play "video" in single file playback mode. you also want to add a preview image when using flv. You can set the parameter "file = video. flv "," image1_preview.jpg ". when you play RTMP streaming media, you can add the parameter "id ". for example, "file = rtmp: // my. streaming. server/mypath "," id = video_one ".

In particular, there are two areas that are prone to errors. The first list must be on the same server as the player, which is caused by flash Security. Second, use the complete address format to include http, so that the player cannot find the file.

Custom
Several people asked me to create some customizable versions. Many of their requirements can be achieved by setting parameters. I made an online Configuration Wizard to easily configure these parameters. I don't have the energy to meet everyone's requirements. However, there will be many interesting additional functions in the next version.

If you are familiar with the actionscript script language, you can modify the program adding function by yourself.

The player adds configuration and playlist variables to the instance, and enters the MCV lifecycle. In the MCV lifecycle, configuration and List Manager (feeder) are always valid.

All methods of the two objects marked in red can be called using javascript.

The player can be referenced in another flash program. You only need to reproduce the image from the downloaded flv file to your flv file, and make sure that the downloaded com directory is copied to your flv file, which contains all the scripts. Then you can access the variable at the first frame of the timeline. Be sure to set the height and width variables. Otherwise, the player will stretch and deform according to your size.
For example

Program code

// Set the flashvars (booleans and numbers shoshould also be quoted)
Var width = "320 ";
Var height = "240 ";
Var file = "my_video.flv ";
Var autostart = "true ";
// Start the player
Var mpl = new com. jeroenwijering. players. MediaPlayer (this. player );
Additionally, I have made the controller a public object, so you can control the mediaplayer with the sendEvent () function from anywhere in your flash site (the schematic above has a list of all sendEvent () options ). let's continue the small script above:

I have created a public controller object for the player, so you can use sendEvent () to control the player anywhere in your program, such:

Program code mpl. controller. sendEvent ("volume", 50 );
Mpl. controller. sendEvent ("playpause ");

Supported

FAQ list

1. if you encounter layout disorder when using ie, it may be that the size is not properly set. You can use the variables "width" and "height" to forcibly set the size.
2. Note that the flash and javascript Security mechanisms will affect your local testing. When your files are stored on different servers, they will also be affected. You can try to put them on the same server.
3. The full screen function can only be used in flash player9.028.0 or later versions. If you use swfobject to embed your player, you can use its automatic upgrade function. Note: Set "allowfullscreen" to true.
4. If your progress bar does not move, or your video length is incorrect. It may be that your flv has not set the correct metadata. You can use a small tool www.buraks.com/flvmdi /.

The two versions are slightly different. For more information, see the description.
Official download link: http://www.jeroenwijering.com/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.