How to use flvplayer.swf FLV video Player

Source: Internet
Author: User
Tags xspf flv file

First, load directly in the 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>


Second, 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"; The folder where the Flash video is stored, note the location of the relative flvplayer.swf file (images/flvplayer.swf)
var div = document.getElementById ("Flvplaydiv");
div.innerhtml = "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 + "&AMP;SHOWFSBUTTON=TRUE&A Mp;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>
&LT;BR/><button id= "K2" type= "button" onclick= "playflv (' company2.flv ')" > Play 2</button>
<div id= "Flvplaydiv" ></div><!--video playing div area--


JW flv Player online FLV player instructions for use in Chinese
How to use: if you only need to play an FLV file [such as "video.flv"], then simply copy the "video.flv" and the flvplayer.swf inside the package into the same directory, and then add it inside the page
Program code
<object type= "Application/x-shockwave-flash" width= "height=" 220 "
Wmode= "Transparent" data= "flvplayer.swf" >
<param name= "movie" value= "flvplayer.swf"/>
<param name= "wmode" value= "Transparent"/>
<object/>
"Flvplayer.swf" will automatically find "video.flv" playback in the same directory. You can also add the URL of the flv file after "flvplayer.swf" to play. Here's how:
Program code
<object type= "Application/x-shockwave-flash" width= "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 that can use a relative or absolute address.
Additional parameter Description:
If you don't need autoplay to load your movie, you can use the Autostart parameter
Example
Program code
<object type= "Application/x-shockwave-flash" width= "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 mixed using a valid parameter list:
Program code
File (the address of the FLV file)
Autostart (whether AutoPlay 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 is "click to play")
Here is the 3.12 version Http://www.cgfans.net/bbs/Medias/2007/10/jw_flv_player.zip this is version 3.12
This document contains the installation methods and configuration of the JW MP3 player,jw flvplayer,jw Media player,jw Image Rotator
Method
JW PLAYERS 3.12 Documentation
1, install (embed in your site)
2, parameters (configuration)
Basic parameters
Color parameters
Interface parameters
Playback parameters
Interactive parameters
3, Play List
4, Custom
5, support
Quick configuration to run the configuration Wizard
1, installation
After downloading, you can get an example that when opened with a text or HTML editor, you can see that the SWF is using a short
JavaScript is embedded on the page. This javascript is Geoff Stearns write Swfobject.js, it solves the flash need to stress
The trouble of living. When copying the SWF to your site, don't forget to copy the Swfobject.js together. and in the page
Add the following code to the head
Program code
<script type= "Text/javascript" src= "Swfobject.js" ></script>
With the help of swfobject.js you can easily set the SWF path, width, height, background color and the desired version of the Flash Player, or you can set a set of parameters to configure the SWF. When the page loads, JavaScript replaces the nodes in the page based on 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 ', ' 400 ', ' 400 ', ' 7 ');
So.addparam ("allowFullScreen", "true");
So.addvariable ("File", "test.flv");
So.addvariable ("Displayheight", "300");
So.write (' Player ');
</script>
In situations where you cannot use JavaScript (such as your BSP is not supported, such as MySpace), you can use "embed" to insert the SWF.
It is important to note that the SWF can not be on the server, but if you need to use an XML playlist it may be problematic because the XML must be on the same server as the SWF, otherwise it will be organized because of security issues. MP3,JPG,FLV can not be on this server.
Program code
<embed src= "http://www.myfileserver.com/folder/mediaplayer.swf" width= "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 allow you to configure the behavior and appearance of the player that is embedded in the HTML. If you use Swfobject.js, you can configure it with the AddVariable () method, and if you use the Embed method, you can configure the variable by defining the "Flashvars" attribute, and be careful to split the variables with the "&" symbol.
The same as the * number is applied to the JW Image rotator
Basic variables
Displayheight (number): Displays the height of the area. The minimum height of the control area is 20px, and when the value is greater than or equal to the height of the SWF, the playlist is automatically hidden, no this is displayed.
file* (URL): The address of the file to play. Supports single-file playback (mp3/flv/rtmp/jpg/swf/png/gif), and also supports playlists. JW Image Rotator only supports lists
height* (number): Sets the height of the SWF, which is already set in the properties of embed when inserted using embed mode. But sometimes (especially when using IE) the height will become uncertain, affecting the layout, this time needs to be set by this parameter, the value of the unit is PX
Image (URL): When you play mp3,flv, you can set a preview image as the album cover and support Jpg/swf/png/gif file. You can also set up each item in the playlist.
shownavigation* (true,false): This parameter is supported only by the JW Image rotator. Use to show or hide picture navigation.
transition* (Fade,bgfade,blocks,bubbles,circles,fluids,lines,random,slowfade): This parameter is supported only by the JW Image rotator. Used to set the effect of picture substitution. Set to "random" to set the effect randomly. The default value is "fade".
width* (number): Sets the width of the SWF, other same height;
Color variables
backcolor* (color): Sets the background color of the player. The default is 0xFFFFFF (white) for JW Media player, and the default is 0x000000 (black) for JW Image rotator.
fontcolor* (color): Sets the colors of text and buttons. The default for JW Media player such as 0x000000 (black) for JW Image Rotator is 0xFFFFFF (white).
lightcolor*: Sets the color of the activated state. The default for JW Media player such as 0x000000 (Black), JW Image Rotator, is 0xcc0000 (red) by default.
Interface parameters
AutoScroll (True,false): When the playlist is too long, the scroll bar is automatically displayed by default. When the value is set to ' true ', the playlist is automatically scrolled according to the mouse.
Displaywidth (number of pixes): Sets the width of the display area, and when the settings are small, the playlist appears on the right side of the display area instead of the bottom.
Kenburns* (True,false): To achieve the implementation of the KB effect in motion (Ken Burns effect), note that when the figure is relatively large, and the speed of the faster, it is recommended to open, otherwise closed. It is recommended to set transition to "Slowfade" to fit.
Largecontrols (True,false): Sets the value to true to enlarge the control area of the button. Recommended for users with poor vision to open
logo* (URL): Set a picture to use as the top-right watermark, support all picture formats, support the PNG effect of the layer is best.
overstretch* (True,false,fit,none): Sets the zoom of the picture/movie in the display area. The "true" proportional stretch is used to fit the display area. "False" stretches only the display area. "Fit" is displayed in full screen. "None" displays the original size. The default is "fit" for JW Media player, and JW Image rotator defaults to "false"
Showdigits (true,false,total): set to "false" to hide the playback time and other information used to save space in the control area. Set to "Total" to display the full time.
Showdownload (True,false): Sets the value used to display the download button in the control area. Links to the address set by link.
Showeq (True,false): Used to display a false audio ripple effect. When playing MP3, setting this value can get a good result.
Showicons* (True,false): Used to show or hide images in the middle of the display area, and the default is true for JW Media player. JW Image rotator defaults to false;
Showvolume (True,false): Used to set whether the Volume control button is displayed
Thumbsinplaylist (True,false): Sets whether the preview is displayed in the list
Playback parameters
Autostart (true,false,muted): Set to Ture, the page will play automatically when it finishes loading. Set to muted, it automatically plays in silent mode, and there is a mute icon in the middle of the display area. Bufferlength (number): Sets the cache time for FLV. Default is 3 seconds
repeat* (true,false,list): The default is Flase, which stops after playing from the current playback position to the tail of the list. Set to list all items in the playlist, and set to True to loop back.
rotatetime* (number): Sets the display time of the picture. The default is 10 seconds for JW Media player, and the default is 5 seconds for JW Image Rotator
Shuffle* (True,false): set to False in order to play, set to true for unordered multicast
Smoothing (True,false): set to False to turn off video smoothing, it is recommended to set true to get better results. But it's good to set false for a big screen or a low-profile machine.
start* (second): Use this variable to position the starting position exactly when using rtmp or HTTP streaming (unconventional Flv/mp3). This parameter is set in the list of XSPE formats so that the section of the settings file is accurate.
volume* (number): Sets the volume by default to 80.
Interactive parameters
audio* (URL): Use this parameter to add a MP3 file as a separate audio, can be used as a picture of the background music commentary and so on.
Bwfile (URL): The address of the file used for bandwidth detection, can be placed in a picture, or rtmp streaming media. You can view the value of the loan in the right-click menu.
Bwstreams (comma-separated List of bitrates):
In conjunction with Bwfile, select different files based on the bandwidth values. Such as: You want to play video.flv and set the value of the key is 100,250,500,1000, when the player found that the bandwidth is 349kbps, will play video_250.flv. So he has a set of valid naming settings that he will automatically switch to, even in the case of playlists.
Callback (URL): Set this parameter to pass data back and forth to the server-side program (php/asp) address. When each item is played and stopped, data is sent to the server to save playback statistics on the server side.
Captions (URL): Sets the value to load text in a text format as a caption. Player to subtitles in SRT format that supports SMIL format and DVD. If you have an FLV file built-in font you can set the value to "captionate". If you have multi-channel subtitles, you can set this value to "Captionate0", "Captionate3" and so on. You can set a value for each item in the list.
Enablejs* (True,false): set to True to turn on JavaScript support. Only online use is supported. JavaScript can control playback, load media, and get detailed information about the current playlist.
Fsbuttonlink (URL): If the user's Flashplayer version is higher than (9.0.28) the player will automatically display a full-screen button. By setting this value, you can link to another page for full-screen display. The server can set the files that will be played.
ID (String): Unique identifier of the player. will be sent back to the server side.
Javascriptid* (String): If you have multiple players on your page, you can set this parameter to a different ID for each player so that you can easily control it with JavaScript. He will be posted back to the GetUpdate () event.
Link (URL): Use this parameter to set a version that is available now, or to force the user to download the current item from that address. You can set this value for each item in the playlist.
linkfromdisplay* (True,false): Sets the page to be accessed when the display area is clicked. The play/Pause action is performed when the display area is clicked by default.
Linktarget* (frame): Set the link target, "_self" opens on the current page. "_blank" opens in a new page.
Streamscript (URL): Set this parameter in order to be compatible with ' pseudo stream media ' flv files.
Type (MP3,FLV,RTMP,JPG,PNG,GIF,SWF,RBS,3GP,MP4,M4V): The player will determine the type based on the last three characters of the file name. This method will no longer work when you redirect using the server-side language. So you can set this parameter to tell the player file type. You can also set up 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 state.
Usecaptions (True,false): set to False to hide captions.
Usefullscreen (True,false): If you don't want to use FLASHPLAYER9 full-screen mode. You can set the "Fsbuttonlink" parameter to replace the full-screen button event.
Usekeys (True,false): set to "false" to cancel keyboard operation (space,up,down,left,right)
Note: You must have a character transfer to?=&. →%3f, =→%3d, &→%26. Your "file" variable must be set to getplaylist.php%3fid%3d123 when it is getplaylist.php?id=123.
Play List
When there is only one item in the playlist, the player plays in single-file playback mode. The player distinguishes between a single file and a playlist file based on the file name. If your loaded file is named Test.mp3, the player will play the mp3 in single-file playback mode, because the extension is mp3. If your file name is getlist.php, the player will think it is a playlist. If you use a dynamic script to load a single file, such as
The player supports three popular playlist formats to ensure versatility. Xspf,rss and Atom.
A generic label for the Xspf/rss/atom list supported by the player.
Form

*image Rotator only supports the first ' audio ' item in the playlist and is used as a background music to play. The player will play all the music items.

* * the "category" element can be used to support ads. You can set the value to "Preroll", "Postroll" or "overlay".
Use the value of the item in the "link" playlist as the ad 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 you do not include a common extension (such as "MP3" or "flv") in the "location" element in the XSPF list format, you can use the "meta" element to specify the file format. (such as <meta rel= ' "type" >mp3</meta>). In the case of RSS and Atom, the file format is automatically identified according to the MimeType.

RTMP streams, the additional "id" Flashvar have to is sent as well. Example: "File=rtmp://my.streaming.server/mypath" and "Id=video_one".

Note that when you play a single file, you support all the parameters, such as you can add a image,title,id,link and so on. If you want to add a preview when you play "video.flv" in single-file playback mode, you can set the parameter "file=video.flv", "image=preview.jpg". When you play rtmp streaming, you can add the parameter "id". such as " File=rtmp://my.streaming.server/mypath "," Id=video_one ".

In particular, two error-prone areas are identified. The first list must be on the same server as the player, which is caused by the security mechanism of flash. Second, use the full address format to include HTTP so that the player cannot find the file.

Custom
There are people who ask me to create some customizable versions. Many of their requirements can already 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 demands. However, in the next version there will be a lot of interesting additional features.

If you are familiar with the ActionScript scripting language, you can modify the program to add functionality yourself.

The player will recently complete the configuration and playlist variables in the instance, and then enter the life cycle of the MCV. In the MCV lifecycle, the Configuration and List Manager (feeder) is always valid.

All methods of the two objects that are marked in red can be called through JavaScript.

The player can be referenced in another flash program. Just copy the image from the downloaded FLV file into your FLV and make sure to copy the downloaded COM directory into your FLV file, which contains all the scripts. You can then access the variable at the position of the first frame in the timeline. Note that you want to set the height and width of the variable, or the player will stretch according to your size.
Such as

Program code

Set the Flashvars (Booleans and numbers should 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 has made the controller a public object, so can control the MediaPlayer with the Sendevent () function From anywhere in your flash site (the schematic above have a list of all sendevent () options). Let ' s continue the small script above:

I created a public controller object for the player, so you can control the player anywhere in your program by using sendevent (), such as:

Program Code mpl.controller.sendEvent ("volume", 50);
Mpl.controller.sendEvent ("Playpause");

Support

FAQ List

1. If you are using IE in the case of a layout disorder, it may be the size is not set, you can use the variable "width" and "height" to force the settings.
2. Note that the security mechanisms of flash and JavaScript can affect your local testing. When your files are placed on different servers, you will also be affected, and you can try to put them on the same server.
3. Full screen function is only available in Flash player9.028.0 or above, if you use SWFObject to embed your player, you can use his auto-upgrade function. Note Set "allowFullScreen" to True
4. If your progress bar does not move, or your video length has a problem. It may be that your FLV has not set the correct metadata. You can use a gadget www.buraks.com/flvmdi/.

Two versions use slightly different, please see inside the description
Official Download Link: http://www.jeroenwijering.com/

How to use flvplayer.swf FLV video Player

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.